public bool AddUserBL(UserViewModel vmodel) { UserDL udl = new UserDL(); var userreturn = udl.AddUser(vmodel); return(userreturn); }
public ActionResult JobSeekerRegistration(User ObjUser) { if (!string.IsNullOrEmpty(ObjUser.FirstName) && !string.IsNullOrEmpty(ObjUser.LastName) && !string.IsNullOrEmpty(ObjUser.Email) && !string.IsNullOrEmpty(ObjUser.Password)) { UserDL userDL = new UserDL(); int result; result = userDL.AddUserDetails(ObjUser); if (result == 1) { // SendMail(ObjUser.FirstName, ObjUser.LastName, ObjUser.Email); TempData["Message"] = "Registraion Successfull!!"; ModelState.Clear(); //TempData["msg"] = "Your Account has been made, please verify it by clicking the activation link that has been send to your email."; return(RedirectToAction("Login")); } else { TempData["Message"] = "Already Email Registraion!!"; ModelState.Clear(); return(View()); } } return(View()); }
/// <summary> /// Checks if a user record with the defined password and username exists. /// </summary> /// <param name="username"></param> /// <param name="password"></param> /// <returns>1 if present, 0 if missing.</returns> public static int AuthenticateUser(string username, string password) { //Using an SQL connection. using (SqlConnection conn = new SqlConnection(Connection.ConnectionString(Connection.ConType.One))) { // Create SQL command, pass connection and name of stored procedure. SqlCommand command = new SqlCommand("GetUser", conn); // Declare that a store procedure is used. command.CommandType = CommandType.StoredProcedure; // Encript and reference encripted password. string hashedPassword = UserDL.EncriptPassword(password); // Pass parameters to stored procedures. command.Parameters.AddWithValue("@username", username); command.Parameters.AddWithValue("@password", hashedPassword); conn.Open(); int result = Convert.ToInt32(command.ExecuteScalar()); conn.Dispose(); // If username already exists will return a value bigger than 0. return(result); } }
public static List <Object> RetrieveUsers() { try { string eKey = System.Configuration.ConfigurationManager.AppSettings.Get("ekey"); List <User> users = UserDL.RetrieveUsers(); List <Object> returnedUsers = new List <Object>(); foreach (User user in users) { object userObj = new { ID = user.ID, Lastname = user.Lastname, Othernames = user.Othernames, Gender = user.Gender, PhoneNumber = user.PhoneNumber, Email = user.Email, Username = user.Username, CreatedOn = String.Format("{0:dddd, MMMM d, yyyy}", Convert.ToDateTime(user.CreatedOn)), Role = new { ID = user.Role.ID, Name = user.Role.Name }, Branch = new { ID = user.Branch.ID, Name = user.Branch.Name } }; returnedUsers.Add(userObj); } return(returnedUsers); } catch (Exception ex) { throw ex; } }
public bool DeleteUserDetail(int userId) { objUserDL = new UserDL(); var isSubmitted = objUserDL.DeleteUserDetail(userId); return(isSubmitted); }
public void ChangePassword(Guid id, string newpassword) { var userDL = new UserDL(); var pass_md5 = GetMD5Password(newpassword); userDL.ChangePassword(id, pass_md5); }
/// <summary> /// To get User details from DL using EF /// </summary> /// <returns></returns> public List <UserModel> GetUserDetails() { objUserDL = new UserDL(); var vGetUserDetails = objUserDL.GetUserDetails(); return(vGetUserDetails); }
/// <summary> /// Insert the User values which user entered to DB from DL using EF /// </summary> /// <param name="objGET_User_DETAILS_Result"></param> /// <returns></returns> public bool SubmitUserDetail(UserModel userModel) { objUserDL = new UserDL(); var isSubmitted = objUserDL.SubmitUserDetail(userModel); return(isSubmitted); }
public string CreateUser(User user, int mode) { // validation string result = "Success"; var userDL = new UserDL(); user.Password = GetMD5Password(user.Password); if (mode == 1) { if (string.IsNullOrWhiteSpace(user.Password)) { return("PasswordNotEmpty"); } if (_users.Any(x => x.Username == user.Username)) { return("ExistUserName"); } userDL.CreateUser(user); } else { userDL.UpdateUser(user); } return(result); }
public ActionResult UserLogin(UserDL userDl) { UniversityContext context = new UniversityContext(); if (userDl.Password == null) { ViewBag.PasswordValidation = "Password is required"; return(View(userDl)); } var searchUser = context.Users.Where(x => x.UserID == userDl.UserID && x.Password == userDl.Password).FirstOrDefault(); if (searchUser == null) //if username and password is matching { ViewBag.isValidate = 0; ViewBag.ValidationMsg = " Invalid User ID or Incorrect Password "; return(View(userDl)); } else { Session["Name"] = context.Users.Where(x => x.UserID == userDl.UserID).FirstOrDefault().FirstName; ViewBag.isValidate = 1; ViewBag.ValidationMsg = " Logged in successfully "; Session["UserId"] = userDl.UserID; return(RedirectToAction("HomePage", "Home")); } }
//---- LOGIN ------------------------------------------------------------------------------------------------------------------------ /// <summary> /// Author : Mir Bilal /// Remarks : /// 1. First calls the encrypt class to encrypt the password to be stored in the database. /// 2. calls the validate method in DL with the encrypt password for login. /// <returns></returns> public static DataTable ValidateUser(string Email, string password) { string encryptpass = Encrypt.EncryptPassword(password); DataTable ds = UserDL.ValidateUser(Email, encryptpass); return(ds); }
public ActionResult Registration(UserDL user) { UniversityContext context = new UniversityContext(); var ExistUser = context.Users.Where(x => x.UserID == user.UserID).FirstOrDefault(); if (ModelState.IsValid) { if (ExistUser != null) { ViewBag.newUserValidate = 0; ViewBag.newUserValidationMsg = "User Already Registered "; } else { context.Users.Add(user); context.SaveChanges(); ViewBag.newUserValidate = 1; ViewBag.newUserValidationMsg = "Your details are submitted successfully"; return(View(user)); } } return(View(user)); }
/// <summary> /// Deletes the users. /// </summary> /// <param name="uList">The u list.</param> /// <returns></returns> public string DeleteUsers(string uList) { var userDl = new UserDL(); string result = userDl.DeleteUsers(uList); return(result); }
/// <summary> /// Deletes the user views. /// </summary> /// <param name="uvList">The uv list.</param> /// <returns></returns> public int DeleteUserViews(string uvList) { var userDl = new UserDL(); int result = userDl.DeleteUserViews(uvList); return(result); }
public static bool Save(User user, out string message) { try { if (UserDL.UserExists(user)) { message = string.Format("User with username: {0} exists already", user.Username); return(false); } else { message = string.Empty; if (UserDL.Save(user)) { return(true); } else { return(false); } } } catch (Exception ex) { throw ex; } }
/// <summary> /// Author : Mir Bilal /// Remark : Call to fetch email to check wheather a particular user with the particular email exists.. /// <returns></returns> public static bool Fetchemail(string email) { if (UserDL.FetchEmail(email).Rows.Count > 0) { return(false); } else { return(true); } }
public static User RetrieveUserByUsername(string username) { try { return(UserDL.RetrieveUserByUsername(username)); } catch (Exception ex) { throw ex; } }
public static bool ChangePassword(string username, string password) { try { return(UserDL.ChangePassword(username, password)); } catch (Exception ex) { throw ex; } }
public static bool Update(User user) { try { return(UserDL.Update(user)); } catch (Exception ex) { throw ex; } }
//--------Examination Objective------------------------------------------Student---------------------------------------------------------------------------------------------- /// <summary> /// Author : Mir Bilal /// Remark : Call to check wheather particular student has already submitted their answers for the Questions of particular subject.... /// </summary> public static bool FetchRemark(int userid, int paperid) { if (UserDL.FetchRemark(userid, paperid).Rows.Count > 0) { return(false); } else { return(true); } }
//-------Assignment--------------------------------------------------Student--------------------------------------------------------------------------- public static bool AlreadySubmitAssignment(int userid, int classid, int subjectid, int assignmentid) { if (UserDL.AlreadySubmitAssignment(userid, classid, subjectid, assignmentid).Rows.Count > 0) { return(false); } else { return(true); } }
public int SaveUserregisrationBL(User objUserBL) // passing Bussiness object Here { try { UserDL objUserdl = new UserDL(); // Creating object of Dataccess return(objUserdl.AddUserDetails(objUserBL)); // calling Method of DataAccess } catch { throw; } }
public IActionResult MaterialList() { try { var userDL = new UserDL(); List <User> users = userDL.GetUsers(); ViewBag.UserList = users; return(View()); } catch (Exception) { return(null); } }
public ResultViewModel Get(int?id = null) { var rest = new ResultViewModel(); try { rest.Response = UserDL.GetAllUsers(id); } catch (Exception ex) { rest.Error = ex.Message; // throw; } return(rest); }
public IActionResult InvoiceList() { try { var userDL = new UserDL(); List <User> users = userDL.GetUsers(); ViewBag.UserList = users; return(View()); } catch (Exception) { return(BadRequest()); } //var invoiceBL = new InvoiceBL(); //List<Invoice> invoices = invoiceBL.GetInvoices(); //ViewBag.InvoiceList = invoices; }
public ResultViewModel Post(RequestModel req) { var res = new ResultViewModel(); try { //UserDL dl = new UserDL(); var data = Extensions.GetPayLoad(req); res.Response = UserDL.AddUser(data); // TODO: Add insert logic here //return RedirectToAction("Index"); } catch (Exception ex) { res.Error = ex.Message; } return(res); }
public static bool UserExists(string username, string password) { try { var user = new User(); user = UserDL.AuthenticateUser(username, PasswordHash.MD5Hash(password)); if (user == null) { return(false); } else { return(true); } } catch (Exception ex) { throw ex; } }
public static dynamic AuthenticateUser(string username, string password) { try { User user = UserDL.AuthenticateUser(username, password); if (user != null) { dynamic userObj = new ExpandoObject(); List <dynamic> userFunctions = new List <dynamic>(); Role userRole = RoleDL.RetrieveRoleByID(user.UserRole); foreach (RoleFunction roleFunction in userRole.RoleFunctions) { dynamic function = new { Name = roleFunction.Function.Name, PageLink = roleFunction.Function.PageLink }; userFunctions.Add(function); } userObj.ID = user.ID; userObj.Username = user.Username; userObj.Role = userRole.Name; userObj.Function = userFunctions; userObj.BranchID = BranchDL.RetrieveBranchByID(user.UserBranch).ID; return(userObj); } return(user); } catch (Exception ex) { throw ex; } }
/// <summary> /// Gets the user tree by manager. /// </summary> /// <param name="clientId">The client identifier.</param> /// <returns></returns> public List <UserDto> GetUserTreeByManager(UserDto clientId) { var userDl = new UserDL(); return(userDl.GetUserTreeByManager(clientId)); }
/// <summary> /// Gets the managers. /// </summary> /// <param name="clientId">The client identifier.</param> /// <returns></returns> public List <UserDto> GetManagers(UserDto clientId) { var userDl = new UserDL(); return(userDl.GetManagers(clientId)); }