private void SetLastLogin(long idUserApplication, long idApplication) { List <LastLoginDto> listLastLogin = LastLoginRepository.GetLastLogin(new LastLoginDto() { IdUserApplication = idUserApplication, IdApplication = idApplication }); LastLoginDto dtoLastLogin = null; if (listLastLogin.Count == 0) { dtoLastLogin = new LastLoginDto(); dtoLastLogin.IdApplication = idApplication; dtoLastLogin.IdUserApplication = idUserApplication; } else { dtoLastLogin = listLastLogin.First(); } if (dtoLastLogin != null) { dtoLastLogin.LastLoginDate = DateTime.Now; LastLoginRepository.SaveLastLogin(dtoLastLogin); } }
/// <summary> /// Gets list object of the table LastLogin. /// </summary> /// <param name="paginationDto">Attributes to apply the pagination.</param> /// <param name="listFilterLastLogin">List that contains the DTOs from LastLogin table that filter the query.</param> /// <returns>List object of the table LastLogin.</returns> /// <author>Mauricio Suárez.</author> public List <LastLoginDto> GetLastLogin(PaginationDto paginationDto, LastLoginDto dtoLastLogin) { List <LastLoginDto> listFilterLastLogin = new List <LastLoginDto>(); listFilterLastLogin.Add(dtoLastLogin); return(this.ExecuteGetLastLogin(paginationDto, listFilterLastLogin)); }
/// <summary> /// Gets list object of the table LastLogin. /// </summary> /// <param name="lFilterLastLogin">List that contains the DTOs from LastLogin table that filter the query.</param> /// <returns>List object of the table LastLogin.</returns> /// <author>Mauricio Suárez.</author> public List <LastLoginDto> GetLastLogin(LastLoginDto dtoLastLogin) { List <LastLoginDto> listFilterLastLogin = new List <LastLoginDto>(); listFilterLastLogin.Add(dtoLastLogin); return(this.ExecuteGetLastLogin(null, listFilterLastLogin)); }
/// <summary> /// Save or update records for the table /// </summary> /// <param name="listDataLastLogin">List of data to store LastLogin.</param> /// <returns>The result of processing the list.</returns> /// <author>Mauricio Suárez.</author> public bool SaveLastLogin(LastLoginDto dtoLastLogin) { List <LastLoginDto> listDataLastLogin = new List <LastLoginDto>(); listDataLastLogin.Add(dtoLastLogin); return(this.SaveLastLogin(listDataLastLogin)); }
public void AddLastLogin(LastLoginDto lastlogindto) { try { LastLoginEntity newLastLogin = LastLoginEntity.Create(_mapper.Map <LastLoginDto, LastLoginEntity>(lastlogindto)); if (newLastLogin != null) { _loginRepository.AddLastLogin(newLastLogin); } else { logCentral.Info("Create User Profile: Invalid User Profile information"); } //LastLoginEntity lastLoginEntity = new LastLoginEntity(); //lastLoginEntity.username = lastlogindto.username; //lastLoginEntity.jda_connection = lastlogindto.jda_connection; //lastLoginEntity.jda_connection_id = lastlogindto.jda_connection_id; //_loginRepository.AddLastLogin(lastLoginEntity); } catch (Exception ex) { logCentral.Error("Create Report", ex); throw; } }
public JsonResult Login(LoginModel model, int lastLogin) { Guid reportId = Guid.NewGuid(); var bu = _rALServices.BusinessUnitById(Convert.ToInt32(model.servername)); Session["servername"] = bu.jda_ip_address; Session["username"] = model.username; Session["password"] = model.password; Session["databasename"] = bu.jda_library; Session["reportId"] = reportId; LoginDto newLogin = new LoginDto { servername = Session["servername"].ToString(), username = Session["username"].ToString(), password = Session["password"].ToString(), dBname = Session["databasename"].ToString() }; if (_rALServices.GetLoginByConnectionString(newLogin) == true) { DisposeDependency(); if (lastLogin > 0) { return(new JsonResult() { JsonRequestBehavior = JsonRequestBehavior.AllowGet, Data = new { responseText = "Success", redirectToUrl = Url.Action("Index", "Home", new { dbname = bu.code + " - " + bu.jda_ip_address + " - " + bu.jda_library }) } }); } else { //Insert New Record var jda_connection = bu.code + " - " + bu.jda_ip_address; LastLoginDto newLastLogin = new LastLoginDto { username = newLogin.username, jda_connection = jda_connection, jda_connection_id = Convert.ToInt32(model.servername) }; _rALServices.AddLastLogin(newLastLogin); return(new JsonResult() { JsonRequestBehavior = JsonRequestBehavior.AllowGet, Data = new { responseText = "Success", redirectToUrl = Url.Action("Index", "Home", new { dbname = bu.code + " - " + bu.jda_ip_address + " - " + bu.jda_library }) } }); } } else { DisposeDependency(); return(new JsonResult() { JsonRequestBehavior = JsonRequestBehavior.AllowGet, Data = new { responseText = "Failed", redirectToUrl = Url.Action("Index", "Login") } }); } }