public DataTable Emp_login_data(LoginModel reg_module) { try { Database db = DatabaseFactory.CreateDatabase(); using (DbCommand dbcmd = db.GetSqlStringCommand(Query.Emp_login_data(reg_module))) { DataTable dt = db.ExecuteDataSet(dbcmd).Tables[0]; return dt; } } catch (OleDbException e) { throw e; } }
public static string Emp_login_data(LoginModel reg) { StringBuilder sb = new StringBuilder(); sb.Append("Select * from OMS_RIGHTS where EMP_ID='" + reg.Emp_ID + "' and PASSWORD ='" + reg.Password + " "); return sb.ToString(); }
public ActionResult Login(LoginModel module) { if (ModelState.IsValid) { try { DataTable dt = module.Login(module); if (dt.Rows.Count == 0) { ModelState.AddModelError("", "Invaild Login details"); return View(); } else { ModelState.AddModelError("", "Successful Login"); module.Emp_ID = ""; module.Password = ""; return View(); } } catch (Exception) { } } return View(module); }
public DataTable Login(LoginModel Login) { try { Employee_registration reg = new Employee_registration(); DataTable dt = reg.Emp_login_data(Login); return dt; } catch (OleDbException e) { throw e; } }