public bool AdminSignUp(ADMIN_PROFILE AdminProfile) { bool adminAdded = false; SqlConnection con = new SqlConnection(ConnectionString); string command = "ADMIN_PROFILE_AdminSignUp"; SqlCommand cmd = new SqlCommand(command, con); cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.Add("@UserID", SqlDbType.UniqueIdentifier).Value = AdminProfile.USER_ID; cmd.Parameters.Add("@PassWord", SqlDbType.NChar).Value = AdminProfile.PASSWORD; cmd.Parameters.Add("@FirstName", SqlDbType.NChar).Value = AdminProfile.FIRST_NAME; cmd.Parameters.Add("@LastName", SqlDbType.NChar).Value = AdminProfile.LAST_NAME; cmd.Parameters.Add("@PhoneNo", SqlDbType.NChar).Value = AdminProfile.PHONE_NO; cmd.Parameters.Add("@Email", SqlDbType.NChar).Value = AdminProfile.EMAIL; try { con.Open(); cmd.ExecuteNonQuery(); adminAdded = true; } catch (Exception ex) { throw; } con.Close(); return(adminAdded); }
public bool AdminUpdate(ADMIN_PROFILE updateAdmin) { bool adminUpdated = false; SqlConnection con = new SqlConnection(ConnectionString); string command = "[dbo].[ADMIN_PROFILE_Edit]"; SqlCommand cmd = new SqlCommand(command, con); cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.Add("@UserID", SqlDbType.UniqueIdentifier).Value = updateAdmin.USER_ID; cmd.Parameters.Add("@FirstName", SqlDbType.NChar).Value = updateAdmin.FIRST_NAME; cmd.Parameters.Add("@LastName", SqlDbType.NChar).Value = updateAdmin.LAST_NAME; cmd.Parameters.Add("@Phone_No", SqlDbType.NChar).Value = updateAdmin.PHONE_NO; cmd.Parameters.Add("@Email", SqlDbType.NVarChar).Value = updateAdmin.EMAIL; cmd.Parameters.Add("@PassWord", SqlDbType.NChar).Value = updateAdmin.PASSWORD; try { con.Open(); cmd.ExecuteNonQuery(); adminUpdated = true; } catch { adminUpdated = false; throw; } return(adminUpdated); }
public ADMIN_PROFILE AdminDetails(Guid userid) { SqlConnection con = new SqlConnection(ConnectionString); string command = "[dbo].[ADMIN_PROFILE_Details]"; SqlCommand cmd = new SqlCommand(command, con); cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.Add("@UserID", SqlDbType.UniqueIdentifier).Value = userid; SqlDataReader reader; ADMIN_PROFILE profile = new ADMIN_PROFILE();; try { con.Open(); reader = cmd.ExecuteReader(); if (reader.Read()) { profile.USER_ID = new Guid(reader["USER_ID"].ToString()); profile.FIRST_NAME = reader["FIRST_NAME"].ToString(); profile.LAST_NAME = reader["LAST_NAME"].ToString(); profile.EMAIL = reader["EMAIL"].ToString(); profile.PHONE_NO = reader["PHONE_NO"].ToString(); profile.PASSWORD = reader["PASSWORD"].ToString(); // profile.STATUS = reader["STATUS"].ToString(); } } catch (Exception ex) { throw ex; } return(profile); }
public ActionResult AdminLogin(string returnUrl) { ADMIN_PROFILE profileForLogin = new ADMIN_PROFILE(); profileForLogin.extraLogin.ReturnUrl = returnUrl; if (SessionHandler.CurrentUser != null) { return(RedirectToAction("Index", "Home")); } return(View(profileForLogin)); }
public ActionResult Edit(ADMIN_PROFILE AdminEdit) { if (AdminEdit.AdminUpdate()) { ViewBag.Message = "Your information updated successfully !!"; } else { ViewBag.Message = "Error occured while updateing the you information." + "\n[AdminSignUpController.Edit {POST} ]"; } return(View(AdminEdit)); }
public ActionResult AdminLogin(ADMIN_PROFILE profile) { if (profile.AdminLogin() != null) { if (profile.extraLogin.ReturnUrl == null) { return(RedirectToAction("Index", "Home")); } else { return(Redirect(profile.extraLogin.ReturnUrl)); } } return(View()); }
public ADMIN_PROFILE AdminLogin(string email, string password) { SqlConnection con = new SqlConnection(ConnectionString); string command = "[dbo].[ADMIN_PROFILE_LogIn]"; SqlCommand cmd = new SqlCommand(command, con); cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.Add("@Email", SqlDbType.NVarChar).Value = email; cmd.Parameters.Add("@PassWord", SqlDbType.NChar).Value = password; SqlDataReader reader; ADMIN_PROFILE adminInfo = null; try { adminInfo = new ADMIN_PROFILE(); con.Open(); reader = cmd.ExecuteReader(); if (reader.Read()) { adminInfo.USER_ID = new Guid(reader["USER_ID"].ToString()); adminInfo.FIRST_NAME = reader["FIRST_NAME"].ToString(); adminInfo.LAST_NAME = reader["LAST_NAME"].ToString(); adminInfo.PHONE_NO = reader["PHONE_NO"].ToString(); adminInfo.EMAIL = reader["EMAIL"].ToString(); adminInfo.STATUS = reader["STATUS"].ToString(); } } catch { adminInfo = null; throw; } return(adminInfo); }
public ActionResult AdminSignUp(ADMIN_PROFILE AdminSignUp) { if (AdminSignUp.PASSWORD.Equals(AdminSignUp.CONFIRMPASSWORD)) { if (AdminSignUp.AdminSignUp()) { //direct login FormsAuthentication.SetAuthCookie(AdminSignUp.EMAIL, AdminSignUp.extraLogin.RememberMe); return(RedirectToAction("AdminLogin", "AdminSignUp")); } else { ViewBag.Message = "Error occured while signing up new user !!" + "\n[AdminSignUpController.AdminSignUp]"; } } else { ViewBag.Message = "Passwords do not match !!"; } return(View()); }
public ActionResult Edit(Guid UserID) { ADMIN_PROFILE adminEdit = new ADMIN_PROFILE(); return(View(adminEdit.AdminDetails(UserID))); }
// // GET: /AdminSignUp/ public ActionResult AdminSignUp() { ADMIN_PROFILE adminProfile = new ADMIN_PROFILE(); return(View(adminProfile)); }