public int Edit(ref Mugurtham.Core.User.UserCoreEntity objUserCoreEntity) { try { IUnitOfWork objIUnitOfWork = new UnitOfWork(_ConnectionStringAppKey); using (objIUnitOfWork as IDisposable) { Mugurtham.DTO.User.User objDTOUser = new DTO.User.User(); using (objDTOUser as IDisposable) { assignHomePagePath(ref objUserCoreEntity); AssignDTOFromEntity(ref objDTOUser, ref objUserCoreEntity); } objIUnitOfWork.RepositoryUser.Edit(objDTOUser); objDTOUser = null; } objIUnitOfWork.commit(); objIUnitOfWork = null; } catch (Exception objEx) { Helpers.LogExceptionInFlatFile(objEx); } return(0); }
private int AssignEntityFromDTO(ref Mugurtham.DTO.User.User objDTOUser, ref Mugurtham.Core.User.UserCoreEntity objUserCoreEntity) { try { objUserCoreEntity.CreatedBy = objDTOUser.CreatedBy; objUserCoreEntity.CreatedDate = DateTime.Now; objUserCoreEntity.ID = objDTOUser.ID; objUserCoreEntity.LoginID = objDTOUser.LoginID; objUserCoreEntity.Password = objDTOUser.Password; objUserCoreEntity.IsActivated = objDTOUser.IsActivated; objUserCoreEntity.LocaleID = objDTOUser.LocaleID; objUserCoreEntity.ModifiedBy = objDTOUser.ModifiedBy; objUserCoreEntity.ModifiedDate = DateTime.Now; objUserCoreEntity.Name = objDTOUser.Name; objUserCoreEntity.RoleID = objDTOUser.RoleID; objUserCoreEntity.SangamID = objDTOUser.SangamID; objUserCoreEntity.ThemeID = objDTOUser.ThemeID; objUserCoreEntity.HomePagePath = objDTOUser.HomePagePath; objUserCoreEntity.IsHighlighted = objDTOUser.IsHighlighted; objUserCoreEntity.ShowHoroscope = objDTOUser.ShowHoroscope; objUserCoreEntity.IsMarried = objDTOUser.IsMarried; objUserCoreEntity.PaymentDate = objDTOUser.PaymentDate; } catch (Exception objEx) { Helpers.LogExceptionInFlatFile(objEx); } return(0); }
public ActionResult validateLogin([System.Web.Http.FromBody] Mugurtham.Core.User.UserCoreEntity objUserCoreEntity) { int inLoginStatus = 0; bool boolLogin = false; ConnectionString objConnectionString = new ConnectionString(objUserCoreEntity.CommunityID); using (objConnectionString as IDisposable) { Mugurtham.Core.User.UserCore objUserCore = new Mugurtham.Core.User.UserCore(objConnectionString.AppKeyConnectionString); using (objUserCore as IDisposable) { inLoginStatus = objUserCore.validateLogin(ref objUserCoreEntity, out boolLogin); if (inLoginStatus == 1) { FormsAuthentication.SetAuthCookie(objUserCoreEntity.LoginID, false); Session.Timeout = 60; LoggedInUser objLoggedIn = new LoggedInUser(objUserCoreEntity.LoginID, objUserCoreEntity.CommunityID); objLoggedIn.CommunityID = objConnectionString.CommunityID; objLoggedIn.CommunityName = objConnectionString.CommunityName; objLoggedIn.ConnectionStringAppKey = objConnectionString.AppKeyConnectionString; objLoggedIn.ConnectionString = objConnectionString.AppConnectionString; Session["LoggedInUser"] = objLoggedIn; objUserCore.createSession(Helpers.primaryKey, objUserCoreEntity.LoginID, Request.ServerVariables["REMOTE_ADDR"].ToString(), objLoggedIn.ConnectionString); } else if (inLoginStatus == 6) // Connection Timed Out { objUserCoreEntity.LoginStatus = "6"; } } objUserCore = null; } objConnectionString = null; return(this.Json(objUserCoreEntity)); }
/*========================================================================================================*/ /*BUSINESS FUNCTIONS - APART CRUD*/ /*========================================================================================================*/ public int validateLogin(ref Mugurtham.Core.User.UserCoreEntity objUserCoreEntity, out bool boolLogin) { /* * 1 -> Success * 2 -> Invalid User * 3 -> Invalid Password * 4 -> DeActivated Sangam * 5 -> DeActivated Profile * 6 -> Connection Timed Out * 7 -> Payment Subscription expired */ int intLoginStatus = 0; boolLogin = false; try { Mugurtham.Core.User.UserCoreEntity _objUserCoreEntity = null; _objUserCoreEntity = GetByLoginID(objUserCoreEntity.LoginID); _objUserCoreEntity.CommunityID = objUserCoreEntity.CommunityID; if (_objUserCoreEntity.PaymentDate != null) { if (DateTime.Today >= _objUserCoreEntity.PaymentDate.Value.AddMonths(6)) { Helpers.LogMessageInFlatFile(_objUserCoreEntity.PaymentDate + "<====== Payment Date"); Helpers.LogMessageInFlatFile(_objUserCoreEntity.PaymentDate.Value.AddMonths(6).ToString() + "<======Added Date"); Helpers.LogMessageInFlatFile(DateTime.Today.ToString() + "<======Added Date"); intLoginStatus = 7; return(intLoginStatus); } } if (_objUserCoreEntity.LoginStatus == "6") { intLoginStatus = 6; return(intLoginStatus); } if (_objUserCoreEntity.LoginID == null) { intLoginStatus = 2; objUserCoreEntity.LoginStatus = "2"; return(intLoginStatus); } // Validate if Sangam is activated Sangam.SangamCore objSangamCore = new Sangam.SangamCore(_ConnectionStringAppKey); using (objSangamCore as IDisposable) { Sangam.SangamCoreEntity objSangamCoreEntity = new Sangam.SangamCoreEntity(); using (objSangamCoreEntity as IDisposable) { objSangamCoreEntity = objSangamCore.GetByID(_objUserCoreEntity.SangamID); if (objSangamCoreEntity.IsActivated == "0") { intLoginStatus = 4; objUserCoreEntity.LoginStatus = "4"; } } objSangamCoreEntity = null; } objSangamCore = null; // Validate Connection Timed Out - Server connectivity if (_objUserCoreEntity.LoginStatus == "6") { intLoginStatus = 6; return(intLoginStatus); } if (intLoginStatus == 4) { return(intLoginStatus); } // Validate if User is activated if (_objUserCoreEntity.IsActivated == "0") { intLoginStatus = 5; objUserCoreEntity.LoginStatus = "5"; return(intLoginStatus); } //Validate if loginid and password matches if (_objUserCoreEntity.Password.Trim() == Helpers.EncodePasswordToBase64(objUserCoreEntity.Password.Trim())) { intLoginStatus = 1; _objUserCoreEntity.LoginStatus = "1"; objUserCoreEntity = _objUserCoreEntity; boolLogin = true; } else { intLoginStatus = 3; objUserCoreEntity.LoginStatus = "3"; } } catch (Exception objEx) { Helpers.LogExceptionInFlatFile(objEx); } return(intLoginStatus); }