/// <summary> /// Check user login in-case auto and direct login mode. /// </summary> /// <param name="model">The user login information.</param> /// <returns>The login status.</returns> public DCW001Login DCW001CheckLoginByMultiStatus(DCW001Login model) { DCW001Login results; // Create new DBManager object for check user login into system. using (DBManager manager = new DBManager("stp_DCW001UserLogin")) { // Declare parameter input for stp_DCW001UserLogin. manager.Add("@userName", model.TANTOSHA_NAME); manager.Add("@password", model.PASSWORD); // Get the user login information from database. DataTable dataTable = manager.GetDataTable(); // Check data login from database. if (dataTable.Rows.Count == 0) { results = null; } else { results = EntityHelper <DCW001Login> .GetListObject(dataTable)[0]; } } // Return status login to service. return(results); }
public DCW001Login DCW001CheckLoginByMultiStatus(DCW001Login model) { // Create new object get status login. DCW001Login objResultLogin = new DCW001Login(); // Create new DataAccess object for get active status. DCW001Da dataAccess = new DCW001Da(); // Check login status. // return dataAccess.LI0001CheckLoginByMultiStatus(model); return(dataAccess.DCW001CheckLoginByMultiStatus(model)); }
public ActionResult DCW001Index(string TANTOSHA_NAME, string PASSWORD, string domainLogin) { // remove all cache CacheUtil.RemoveAllCache(); DCW001Login model = new DCW001Login(); if (TANTOSHA_NAME != null) { model.TANTOSHA_NAME = TANTOSHA_NAME; model.PASSWORD = PASSWORD; } // 1. Input check. if (ModelState.IsValid) { //Create new object get status login. DCW001Login objResultLogin = new DCW001Login(); // Create new Service object to check login status. using (DCW001Services service = new DCW001Services()) { objResultLogin = service.DCW001CheckLoginByMultiStatus(model); if (service.DCW001CheckDomainLogin(domainLogin)) { return(RedirectToAction("LoginFail", "Error", new { area = "Common" })); } /// 2. Check login by user. if (objResultLogin == null) { // Return Errorpage return(RedirectToAction("LoginFail", "Error", new { area = "Common" })); } // 3. Save user login information into session common. base.CmnEntityModel.UserName = objResultLogin.TANTOSHA_NAME; base.CmnEntityModel.Password = objResultLogin.PASSWORD; base.CmnEntityModel.ShainNo = objResultLogin.RACK_SEACH_KANO_FLG; CacheUtil.SaveCache(CacheKeys.CmnEntityModel, base.CmnEntityModel); return(base.Redirect("DCW002Menu", "DCW002", new { area = "DCW" })); } } return(this.View(model)); }