1. RegistrationController(web Api controller)
using LaySous.CineTot.ServiceAPI.Entities;
using LaySous.CineTot.ServiceAPI.Interfaces;
using LaySous.CineTot.ServiceAPI.Models;
using LaySous.CineTot.ServiceAPI.POCO;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Net.Http;
using System.Web.Http;
namespace LaySous.CineTot.ServiceAPI.Controllers
{
public class RegistrationController : ApiController
{
static readonly IRegistration oRegistration = new MRegistration();
[HttpPost]
public CRegReturn QuickRegister(Registrations RegistrationData)
{
return oRegistration.NewRegistration(RegistrationData);
}
}
}
2.IRegistrations
using LaySous.CineTot.ServiceAPI.Entities;
using LaySous.CineTot.ServiceAPI.POCO;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace LaySous.CineTot.ServiceAPI.Interfaces
{
public interface IRegistration
{
CRegReturn NewRegistration(Registrations RegistrationData);
}
}
3.CRegReturn.cs
using LaySous.CineTot.ServiceAPI.Entities;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
namespace LaySous.CineTot.ServiceAPI.POCO
{
public class CRegReturn
{
public string VerifyCode;
public CServerMessage ServerMsg;
}
}
4.Registrations
namespace LaySous.CineTot.ServiceAPI.Entities
{
using System;
using System.Collections.Generic;
public partial class Registrations
{
public long RegistrationSK { get; set; }
public string CineTotID { get; set; }
public string eMailID { get; set; }
public string Password { get; set; }
public string PhoneNo { get; set; }
public string Country { get; set; }
public Nullable<System.DateTime> RegisterDate { get; set; }
public Nullable<System.DateTime> LeavingDate { get; set; }
public string IsActive { get; set; }
public string eMailVerified { get; set; }
public string eMailVerificationCode { get; set; }
public string IsTwitterVerified { get; set; }
public string IsDirectlyVerified { get; set; }
public string DirectlyVerifiedUserSK { get; set; }
public string RegistrationStageCode { get; set; }
public Nullable<System.DateTime> LastLoginDateTime { get; set; }
public string UserRoleCode { get; set; }
public string IsQCVerified_ { get; set; }
public string AppSource_ { get; set; }
public System.DateTime DateCreated { get; set; }
public Nullable<long> UserModified { get; set; }
public Nullable<System.DateTime> DateModified { get; set; }
public string TwitterID { get; set; }
public string GalleryViewEnabledTo { get; set; }
public string AccountName { get; set; }
}
}
5. MRegistration
using LaySous.CineTot.ServiceAPI.Interfaces;
using LaySous.CineTot.ServiceAPI.POCO;
using System;
using System.Linq;
using LaySous.CineTot.ServiceAPI.Entities;
using System.Collections.Generic;
namespace LaySous.CineTot.ServiceAPI.Models
{
public class MRegistration : IRegistration
{
public CRegReturn NewRegistration(Registrations RegistrationData)
{
FytotCtx oDataContext = null;
CRegReturn oRegReturn = null;
CServerMessage oServerMessage = null;
MCommon oCommon = null;
try
{
oServerMessage = new CServerMessage();
oServerMessage.Msg = CCommon.EnumMessages.FAILED.ToString();
oRegReturn = new CRegReturn();
oDataContext = new FytotCtx();
if (oDataContext.Registrations.Where(R => R.eMailID.Trim().ToLower() == RegistrationData.eMailID.Trim().ToLower()).Count() > 0)
{
oServerMessage.Msg = CCommon.EnumMessages.LOGINID_EXISTS.ToString();
}
else
{
oCommon = new MCommon();
RegistrationData.CineTotID = oCommon.GenerateRollNo(RegistrationData.UserRoleCode);
RegistrationData.eMailVerificationCode = oCommon.GenerateVerifyCode();
RegistrationData.eMailID = GetEncryption(RegistrationData.eMailID, "AD");
RegistrationData.Password = GetEncryption(RegistrationData.Password, "AB");
RegistrationData.PhoneNo = GetNumberEncryption(RegistrationData.PhoneNo, "NB");
oDataContext.Registrations.Add(RegistrationData);
oDataContext.SaveChanges();
oRegReturn.VerifyCode = RegistrationData.eMailVerificationCode;
oServerMessage.Msg = CCommon.EnumMessages.SUCCESS.ToString();
}
}
catch (Exception oEx)
{
oServerMessage.Msg = CCommon.EnumMessages.EXCEPTION.ToString();
oServerMessage.ExMsg = oEx.Message.ToString();
}
finally
{
oCommon = null;
oDataContext = null;
}
oRegReturn.ServerMsg = oServerMessage;
return oRegReturn;
}
}
}
using LaySous.CineTot.ServiceAPI.Entities;
using LaySous.CineTot.ServiceAPI.Interfaces;
using LaySous.CineTot.ServiceAPI.Models;
using LaySous.CineTot.ServiceAPI.POCO;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Net.Http;
using System.Web.Http;
namespace LaySous.CineTot.ServiceAPI.Controllers
{
public class RegistrationController : ApiController
{
static readonly IRegistration oRegistration = new MRegistration();
[HttpPost]
public CRegReturn QuickRegister(Registrations RegistrationData)
{
return oRegistration.NewRegistration(RegistrationData);
}
}
}
2.IRegistrations
using LaySous.CineTot.ServiceAPI.Entities;
using LaySous.CineTot.ServiceAPI.POCO;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace LaySous.CineTot.ServiceAPI.Interfaces
{
public interface IRegistration
{
CRegReturn NewRegistration(Registrations RegistrationData);
}
}
3.CRegReturn.cs
using LaySous.CineTot.ServiceAPI.Entities;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
namespace LaySous.CineTot.ServiceAPI.POCO
{
public class CRegReturn
{
public string VerifyCode;
public CServerMessage ServerMsg;
}
}
4.Registrations
namespace LaySous.CineTot.ServiceAPI.Entities
{
using System;
using System.Collections.Generic;
public partial class Registrations
{
public long RegistrationSK { get; set; }
public string CineTotID { get; set; }
public string eMailID { get; set; }
public string Password { get; set; }
public string PhoneNo { get; set; }
public string Country { get; set; }
public Nullable<System.DateTime> RegisterDate { get; set; }
public Nullable<System.DateTime> LeavingDate { get; set; }
public string IsActive { get; set; }
public string eMailVerified { get; set; }
public string eMailVerificationCode { get; set; }
public string IsTwitterVerified { get; set; }
public string IsDirectlyVerified { get; set; }
public string DirectlyVerifiedUserSK { get; set; }
public string RegistrationStageCode { get; set; }
public Nullable<System.DateTime> LastLoginDateTime { get; set; }
public string UserRoleCode { get; set; }
public string IsQCVerified_ { get; set; }
public string AppSource_ { get; set; }
public System.DateTime DateCreated { get; set; }
public Nullable<long> UserModified { get; set; }
public Nullable<System.DateTime> DateModified { get; set; }
public string TwitterID { get; set; }
public string GalleryViewEnabledTo { get; set; }
public string AccountName { get; set; }
}
}
5. MRegistration
using LaySous.CineTot.ServiceAPI.Interfaces;
using LaySous.CineTot.ServiceAPI.POCO;
using System;
using System.Linq;
using LaySous.CineTot.ServiceAPI.Entities;
using System.Collections.Generic;
namespace LaySous.CineTot.ServiceAPI.Models
{
public class MRegistration : IRegistration
{
public CRegReturn NewRegistration(Registrations RegistrationData)
{
FytotCtx oDataContext = null;
CRegReturn oRegReturn = null;
CServerMessage oServerMessage = null;
MCommon oCommon = null;
try
{
oServerMessage = new CServerMessage();
oServerMessage.Msg = CCommon.EnumMessages.FAILED.ToString();
oRegReturn = new CRegReturn();
oDataContext = new FytotCtx();
if (oDataContext.Registrations.Where(R => R.eMailID.Trim().ToLower() == RegistrationData.eMailID.Trim().ToLower()).Count() > 0)
{
oServerMessage.Msg = CCommon.EnumMessages.LOGINID_EXISTS.ToString();
}
else
{
oCommon = new MCommon();
RegistrationData.CineTotID = oCommon.GenerateRollNo(RegistrationData.UserRoleCode);
RegistrationData.eMailVerificationCode = oCommon.GenerateVerifyCode();
RegistrationData.eMailID = GetEncryption(RegistrationData.eMailID, "AD");
RegistrationData.Password = GetEncryption(RegistrationData.Password, "AB");
RegistrationData.PhoneNo = GetNumberEncryption(RegistrationData.PhoneNo, "NB");
oDataContext.Registrations.Add(RegistrationData);
oDataContext.SaveChanges();
oRegReturn.VerifyCode = RegistrationData.eMailVerificationCode;
oServerMessage.Msg = CCommon.EnumMessages.SUCCESS.ToString();
}
}
catch (Exception oEx)
{
oServerMessage.Msg = CCommon.EnumMessages.EXCEPTION.ToString();
oServerMessage.ExMsg = oEx.Message.ToString();
}
finally
{
oCommon = null;
oDataContext = null;
}
oRegReturn.ServerMsg = oServerMessage;
return oRegReturn;
}
}
}
No comments:
Post a Comment