public ActionResult Logins(LoginDetail objLogin) { if (ModelState.IsValid) { UserInfosViewModel obj_details = new UserInfosViewModel(); UserBLL obj_detail = new UserBLL(); obj_details = obj_detail.GetDetails(objLogin.Username); if (obj_details != null) { if (obj_details.Password == objLogin.Password) { Session["Fname"] = obj_details.Firstname; Session["Lname"] = obj_details.Lastname; return(RedirectToAction("Home", "User")); } else { return(RedirectToAction("InvalidLogin", "LoginUser")); } } else { return(RedirectToAction("InvalidLogin", "LoginUser")); } } else { return(View("Login")); } }
public ActionResult Login(LoginModel model) { if (ModelState.IsValid) { var dao = new UserDAO(); var res = dao.Login(model.UserName, PasswordEncryptor.MD5Hash(model.Password)); if (res == 0) { ModelState.AddModelError("", "Tài khoản không tồn tại"); } else { if (res == 2) { ModelState.AddModelError("", "Mật khẩu không chính xác"); } if (res == -1) { ModelState.AddModelError("", "Tài khoản đã bị khóa"); } if (res == 1) { var user = dao.KiemTraDangNhap(model.UserName); var userSession = new LoginDetail(); userSession.UserName = user.UserName; userSession.User = user; userSession.GroupID = user.GroupID; Session.Add(CommonConstants.USER_SESSION, userSession); return(RedirectToAction("Index", "TrangChu")); } } } return(View("Index")); }
private void ChangePasswordCompletedHelper() { try { dispatcher.BeginInvoke (() => { if (Utility.FaultExist(service.Fault)) { return; } if (service.LoginDetail != null) { LoginDetail = service.LoginDetail; } PopUp.DialogResult = true; }); } catch (Exception ex) { Utility.DisplayMessage(ex.Message); } }
public async Task <IActionResult> PutLoginDetail(string id, LoginDetail loginDetail) { if (id != loginDetail.UserName) { return(BadRequest()); } _context.Entry(loginDetail).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!LoginDetailExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }
public ActionResult Authorize(LoginDetail userModel) { if (ModelState.IsValid) { using (WebAppLogin db = new WebAppLogin()) { var userDetails = db.LoginDetails.Where(x => x.Username == userModel.Username && x.Password == userModel.Password && x.Userrole == userModel.Userrole).FirstOrDefault(); if (userDetails == null) { // userModel.ErrorMessage = "Wrong username or password"; ViewBag.Error = "Wrong credentials"; return(View("Login")); } else { // custom form authentication FormsAuthentication.SetAuthCookie(userDetails.Username, false); //store state in session Session["uname"] = userDetails.Username.ToString(); if ((userDetails.Userrole != null)) { return(RedirectToAction("Details", "Home")); } } } } return(View("Login")); }
public IEnumerator PostLogin(string _email, string _password) { WWWForm form = new WWWForm(); form.AddField("email", _email); form.AddField("password", _password); UnityWebRequest call_login = UnityWebRequest.Post("http://localhost:8000/api/login", form); yield return(call_login.Send()); if (call_login.error != null) { Debug.Log("Error " + call_login.error); } else { Debug.Log("Response " + call_login.downloadHandler.text); LoginDetail loginDetail = JsonUtility.FromJson <LoginDetail> (call_login.downloadHandler.text); print("Status :" + loginDetail.success); ApiKey.Instance.setID(loginDetail.message.id); ApiKey.Instance.setApiKey(loginDetail.api_key); if (loginDetail.message.name == "") { SceneManager.LoadScene("InputData"); } else { SceneManager.LoadScene("Home"); } } }
public HttpResponseMessage AuthenticateUser(LoginDataModel loginDetail) { try { DataTransferService service = new DataTransferService(ConfigurationManager.ConnectionStrings["AutoSaloonDbConnection"].ConnectionString); LoginDetail detail = service.GetLoginDetail(loginDetail.UserName, loginDetail.Password); if (detail != null) { HttpResponseMessage returnMessage = new HttpResponseMessage(HttpStatusCode.OK); var jObject = JObject.Parse(JsonConvert.SerializeObject(detail)); returnMessage.Content = new StringContent(jObject.ToString(), Encoding.UTF8, "application/json"); return(returnMessage); } else { HttpResponseMessage returnMessage = new HttpResponseMessage(HttpStatusCode.Unauthorized); var jObject = JObject.Parse(JsonConvert.SerializeObject("Invalid user!")); returnMessage.Content = new StringContent(jObject.ToString(), Encoding.UTF8, "application/json"); return(returnMessage); } } catch (Exception ex) { HttpResponseMessage returnMessage = new HttpResponseMessage(HttpStatusCode.ExpectationFailed); var jObject = JObject.Parse(JsonConvert.SerializeObject(ex.Message)); returnMessage.Content = new StringContent(jObject.ToString(), Encoding.UTF8, "application/json"); return(returnMessage); } }
public Boolean PostLoginDetail(LoginDetail model) { var loginResults = false; if (ModelState.IsValid) { var registerData = _context.RegistrationDetails.ToList(); foreach (var item in registerData) { if (item.Username == model.Username && item.Password == model.Password) { var loginDetail = _context.LoginDetails.FirstOrDefault(); if (loginDetail != null) { _context.LoginDetails.Remove(loginDetail); } _context.LoginDetails.Add(model); _context.SaveChanges(); loginResults = true; return(loginResults); //return RedirectToAction("Index", "LoggedIn"); } else { loginResults = false; //return RedirectToAction("Index", "LoggedIn"); } } } return(loginResults); }
public ActionResult Login(LoginDetail login) { using (UserDbContext userDb = new UserDbContext()) { bool isValid = userDb.UserContext.Any(x => x.EmailId == login.EmailId && x.Password == login.Password); if (isValid) { //use Authentication form FormsAuthentication.SetAuthCookie(login.EmailId, false); Session["EmailId"] = login.EmailId.ToString(); //store cookies if clicked remember me if (login.RememberMe) { HttpCookie cookie = new HttpCookie("LoginCookie"); cookie.Values["EmailId"] = login.EmailId.ToString(); //cookie.Values["lastLoginDate"] = DateTime.Now.ToShortDateString(); cookie.Expires = DateTime.Now.AddMinutes(30); Response.Cookies.Add(cookie); return(RedirectToAction("MainPage")); } else { return(RedirectToAction("MainPage")); } } ModelState.AddModelError("", "Invalid logins"); return(View()); } }
public async Task <IActionResult> Login([Bind("Email,Password")] LoginDetail info) { _log4net.Info("Login Data is going to send for authorization and token generation to AuthorizationService"); using (var httpClient = new HttpClient()) { var content = new StringContent(JsonConvert.SerializeObject(info), Encoding.UTF8, "application/json"); using (var response = await httpClient.PostAsync("https://localhost:44362/api/AuthToken", content)) { if (!response.IsSuccessStatusCode) { return(RedirectToAction("Login")); } var data = await response.Content.ReadAsStringAsync(); info = JsonConvert.DeserializeObject <LoginDetail>(data); HttpContext.Session.SetString("token", info.Token); HttpContext.Session.SetInt32("userId", info.Id); HttpContext.Session.SetString("email", info.Email); return(RedirectToAction("Index", "Vehicle")); } } }
public IHttpActionResult ResetPassword(ResetDetails resetDetails) { LoginDetail loginDetail = null; ActionStatus status = new ActionStatus(); try { loginDetail = userService.ResetPassword(resetDetails, userId); } catch (UserServiceException ex) { status.Number = (int)ex.ErrorCodeService; } catch (BaseException ex) { status.Number = (int)ex.ErrorCode; } catch (Exception ex) { status.Number = -1; logger.Error("Exception in User/ResetPassword: {0} \r\n {1}", ex.ToString(), ex.StackTrace); } if (status.Number != -1) { return(Ok(new { LoginDetail = loginDetail, Status = status })); } else { return(InternalServerError()); } }
public DocumentController( IUserService IUserService, IRelationService IRelationService, IDocumentService IDocumentService, IEmployementService IEmployementService, IDocumentDetailsService IDocumentDetailsService, IDocumentCategoryService IDocumentCategoryService, IEducationDocumentCategoryMappingService IEducationDocumentCategoryMappingService, ICandidateProgressDetailService ICandidateProgressDetailService, IPersonalService IPersonalService, IEmployeeService IEmployeeService, IEmploymentCountService IEmploymentCountService) { _IUserService = IUserService; _IRelationService = IRelationService; _IEmployementService = IEmployementService; _IDocumentDetailsService = IDocumentDetailsService; _IDocumentCategoryService = IDocumentCategoryService; _IDocumentService = IDocumentService; _IEducationDocumentCategoryMappingService = IEducationDocumentCategoryMappingService; _ICandidateProgressDetailService = ICandidateProgressDetailService; _IPersonalService = IPersonalService; _IEmploymentCountService = IEmploymentCountService; _loginDetails = new LoginDetail(); _document = new Master_Document(); _docDetails = new DocumentDetail(); _employment = new EmploymentDetail(); _DocumetCat = new Master_DocumentCategory(); _DocumetCatNew = new Master_DocumentCategory(); _educationDocumentCategoryMapping = new EducationDocumentCategoryMapping(); _IEmployeeService = IEmployeeService; }
public bool DeleteUser(int ID) { bool result; using (IPDEntities ctx = new IPDEntities()) { try { LoginDetail loginDetail = ctx.LoginDetails.Where(m => m.UserID == ID).FirstOrDefault(); //Code change - Column datatype changed from int to bool loginDetail.IsDelete = true; EmployeeMaster empMaster = ctx.EmployeeMasters.Where(m => m.UserId == ID).FirstOrDefault(); if (empMaster != null) { empMaster.Active = 0; } ctx.SaveChanges(); result = true; } catch (Exception ex) { result = false; } } return(result); }
private void Form1_Load(object sender, EventArgs e) { if (!File.Exists(GlobalData.landinglistsJsonPath)) { File.Create(GlobalData.landinglistsJsonPath).Close(); } if (!File.Exists(GlobalData.ErrorLog)) { File.Create(GlobalData.ErrorLog).Close(); } //handles memory login if (!File.Exists(GlobalData._5DatFile)) { File.Create(GlobalData._5DatFile).Close(); } string dat = File.ReadAllText(GlobalData._5DatFile); if (dat != "") { string dB64 = ""; try { dB64 = Encoding.ASCII.GetString(Convert.FromBase64String(dat)); } catch (Exception ex) { GlobalData.ErrorLogInput(ex, "ERROR"); return; } try { LoginDetail detail = JsonConvert.DeserializeObject <LoginDetail>(dB64); memloging = true; memloginName = detail.UserName; memloginToken = detail.UserToken; } catch (Exception ex) { GlobalData.ErrorLogInput(ex, "ERROR"); return; } } }
public IHttpActionResult AuthenticateUser(Login loginModel) { AuthenticationResponse authenticationResponse = new AuthenticationResponse(); LoginDetail loginDetails = db.LoginDetails.Where(e => e.UserName.Equals(loginModel.UserName) && e.UserPassword.Equals(loginModel.Password)).FirstOrDefault(); if (loginDetails != null) { UserData userData = db.UserDatas.Where(u => u.UserDataID == loginDetails.UserDataID).FirstOrDefault(); if (userData != null) { authenticationResponse.IsAuthenticated = true; User user = new User(); user.FirstName = userData.FirstName; user.LastName = userData.LastName; user.UserName = loginDetails.UserName; user.Id = Convert.ToInt32(userData.UserDataID); authenticationResponse.User = user; } return(Ok(authenticationResponse)); } else { return(BadRequest()); } }
public string CheckFiledsUpdated(LoginDetail lgCheckDetails) { LoginDetail oldLogindetails = new Models.LoginDetail(); StringBuilder UpdatedStaus = new StringBuilder(); oldLogindetails = (LoginDetail)Session["lgReadDetails"]; if (oldLogindetails.UserName != lgCheckDetails.UserName) { UpdatedStaus.Append("Updated UserName" + lgCheckDetails.UserName + "\n"); } if (oldLogindetails.EmailId != lgCheckDetails.EmailId) { UpdatedStaus.Append("Your Updated Email Id:" + lgCheckDetails.EmailId + "\n"); } if (oldLogindetails.RoleId != lgCheckDetails.RoleId) { UpdatedStaus.Append("Your Role has been Changed to:" + lgCheckDetails.RoleId + "\n"); } if (oldLogindetails.Password != lgCheckDetails.Password) { UpdatedStaus.Append("Your Updated Password is:" + lgCheckDetails.Password + "\n"); } if (Convert.ToBoolean(oldLogindetails.IsActive) != lgCheckDetails.IsActive) { UpdatedStaus.Append("Your Acccount is Blocked Please Contact to Administrator"); } return(UpdatedStaus.ToString()); }
public HttpResponseMessage Put(int id, [FromBody] LoginDetail loginDetail) { try { using (loandbEntities entities = new loandbEntities()) { var entity = entities.LoginDetails.FirstOrDefault(e => e.ID == id); if (entity == null) { return(Request.CreateErrorResponse(HttpStatusCode.NotFound, "Login with Id " + id.ToString() + " Not Found!")); } else { entity.Mail = loginDetail.Mail; entity.Pan = loginDetail.Pan; entity.Pass = loginDetail.Pass; entities.SaveChanges(); return(Request.CreateResponse(HttpStatusCode.OK)); } } } catch (Exception ex) { return(Request.CreateErrorResponse(HttpStatusCode.BadRequest, ex)); } }
public IActionResult SignIn(SignInViewModel signInVM) { if (ModelState.IsValid) { LoginDetail loginDet = new LoginDetail(); loginDet.FirstName = signInVM.FirstName; loginDet.LastName = signInVM.LastName; loginDet.CardNum = signInVM.CardNum; loginDet.Reason = signInVM.Reason; if (signInVM.IsSignature == false) { signInVM.ErrorSignature = "Please select Signature checkbox"; return(View(signInVM)); } else { loginDet.Signature = signInVM.IsSignature; } loginDet.SignInDateTime = DateTime.Now; //loginDet.SignOutDateTime = null; _loginService.CreateLoginDet(loginDet); return(RedirectToAction("Index")); } return(View(signInVM)); }
public async Task Login() { try { LoginDetail loginDetail = new LoginDetail { client_id = tradeSetting.ClientId, client_secret = tradeSetting.ClientSecret, userId = tradeSetting.UserId, password = tradeSetting.Password, answer1 = tradeSetting.Answer1, answer2 = tradeSetting.Answer2 }; Token token = await aliceBlue.LoginAndGetToken(loginDetail); if (token.AccessToken != string.Empty) { tradeSetting.Token = token.AccessToken; helper.UpdateConfigKey("Token", token.AccessToken); helper.UpdateConfigKey("TokenCreatedOn", DateTime.Now.ToString()); LogAdded("Token created successfully"); } else { LogAdded("Access token is empty."); } } catch (Exception ex) { LogAdded(ex.Message); } }
public IHttpActionResult PutLoginDetail(int id, LoginDetail loginDetail) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != loginDetail.loginid) { return(BadRequest()); } db.Entry(loginDetail).State = EntityState.Modified; try { db.SaveChanges(); } catch (DbUpdateConcurrencyException) { if (!LoginDetailExists(id)) { return(NotFound()); } else { throw; } } return(StatusCode(HttpStatusCode.NoContent)); }
public ActionResult Login(LoginDetail logindetails) { try { var user = db.RegisterDetails.Single(u => u.R_Username == logindetails.L_Username && u.R_Password == logindetails.L_Password); if (user != null) { if (user.R_Role == "Customer") { Session["Username"] = user.R_Username; RedirectToAction("CustomerNavigate", "Customer"); TempData["UserId"] = user.R_Id; TempData["Username"] = user.R_Username; TempData["Address"] = user.R_Address; return(RedirectToAction("CustomerNavigate", "Customer")); } if (user.R_Role == "Admin") { Session["Username"] = user.R_Username; return(RedirectToAction("AdminNavigate", "Admin")); } } } catch (Exception) { ViewBag.message = "User Not Found !! Please Enter the correct Username and Password !!"; } return(View()); }
private double GetUploadDocumentPercentage(LoginDetail userDetails) { double uploadDocumentPercentage = 0.0; var contactDetail = userDetails.EmployeeContactDetails.FirstOrDefault(); var requiredCountForAddress = 0; if (contactDetail != null) { requiredCountForAddress = contactDetail.IsBothAddSame == true ? 1 : 2; } if (userDetails != null && userDetails.DocumentDetails.Any()) { List <DocumentDetail> userEducationDocumentCatList = new List <DocumentDetail>(); var userEducationCatList = userDetails.AdminEducationCategoryForUsers.Where(x => x.IsActive == true).ToList(); var documentDetails = userDetails.DocumentDetails.Where(x => x.IsActive == true).Select(x => new DocumentDetail() { DocDetID = x.DocCatID, DocCatID = x.DocCatID, DocumentID = x.DocumentID, EmploymentDetID = x.EmploymentDetID, LoginDetail = x.LoginDetail }); var educationalDocCount = 0; if ((userEducationCatList.Any() && userEducationCatList.Count != 0) && (documentDetails.Any() && documentDetails.Count() != 0)) { var a = documentDetails.Where(x => x.DocCatID == Constant.DocumentCategory.Education).ToList(); userEducationDocumentCatList = (from educationItem in userEducationCatList join mappingItem in documentDetails.Where(x => x.DocCatID == Constant.DocumentCategory.Education).ToList() on educationItem.Master_EducationCategory.EducationDocumentCategoryMappings.FirstOrDefault().DocumentID equals mappingItem.DocumentID select mappingItem).ToList(); educationalDocCount = userEducationCatList.Count; } double employmentUploadPercentage = 0.0; if (userDetails.IsFresher ?? false) { uploadDocumentPercentage = Convert.ToDouble(100); } if (documentDetails.Any() && userDetails.EmploymentDetails.Where(x => x.IsActive == true).Count() != 0) { int totalCount = userDetails.EmploymentDetails.Where(x => x.IsActive == true).Count(); foreach (var item in userDetails.EmploymentDetails.Where(x => x.IsActive == true)) { if (item.IsCurrentEmployment.HasValue && item.IsCurrentEmployment.Value) { employmentUploadPercentage = employmentUploadPercentage + GetDocumentPercentagEmployementCurrent(documentDetails.Where(x => x.DocCatID == Constant.DocumentCategory.Employment && x.EmploymentDetID == item.EmploymentDetID)); } else { employmentUploadPercentage = employmentUploadPercentage + GetDocumentPercentagEmployementPast(documentDetails.Where(x => x.DocCatID == Constant.DocumentCategory.Employment && x.EmploymentDetID == item.EmploymentDetID)); } } uploadDocumentPercentage = (employmentUploadPercentage / Convert.ToDouble(totalCount)); } uploadDocumentPercentage = uploadDocumentPercentage + GetDocumentPercentagEducation(userEducationDocumentCatList, educationalDocCount); uploadDocumentPercentage = uploadDocumentPercentage + GetDocumentPercentageAddressProof(documentDetails.Where(x => x.DocCatID == Constant.DocumentCategory.AddressProof), requiredCountForAddress); uploadDocumentPercentage = uploadDocumentPercentage + GetDocumentPercentageIDProof(documentDetails.Where(x => x.DocCatID == Constant.DocumentCategory.IdProof)); uploadDocumentPercentage = (uploadDocumentPercentage / Convert.ToDouble(4)); } return(Math.Round(uploadDocumentPercentage, 2)); }
private double GetEducationDetialsPercentage(LoginDetail userDetails) { double educationDetialsPercentage = 0.0; if (userDetails != null) { int averageCount = 0; var userEducationCategoryList = userDetails; if (userEducationCategoryList != null) { var assignedEducationCategaries = userEducationCategoryList.AdminEducationCategoryForUsers.Where(x => x.IsActive == true).ToList(); if (assignedEducationCategaries.Any()) { averageCount = assignedEducationCategaries.Count(); var userEducationList = userDetails.EmployeeEducationDetails.Where(x => x.IsActive == true); if (userEducationList.Any()) { var userEducationListJoin = (from item in userEducationList join item2 in assignedEducationCategaries on item.EducationCategoryID equals item2.EducationCategoryId select item).ToList(); foreach (var item in userEducationListJoin) { String[] _chosenOtherDetails = new string[] { Convert.ToString(item.EducationCategoryID), Convert.ToString(item.DisciplineID), Convert.ToString(item.PassingYear), Convert.ToString(item.ClassID), Convert.ToString(item.OtherSpecialization), Convert.ToString(item.CollegeID), Convert.ToString(item.FromDate), Convert.ToString(item.ToDate), Convert.ToString(item.UniversityID), Convert.ToString(item.Percentage), Convert.ToString(item.BreaksDuringEducation), }; int acuatalCount = 0; int totalFieldCount = _chosenOtherDetails.Length; for (int i = 0; i < _chosenOtherDetails.Length; i++) { if (!String.IsNullOrEmpty(_chosenOtherDetails[i])) { acuatalCount++; } } educationDetialsPercentage = educationDetialsPercentage + ((Convert.ToDouble(acuatalCount) / Convert.ToDouble(totalFieldCount)) * Convert.ToDouble(100)); } educationDetialsPercentage = educationDetialsPercentage / Convert.ToDouble(averageCount); } } } } return(educationDetialsPercentage); }
protected void login1_Authenticate(object sender, AuthenticateEventArgs e) { if (IsValid) { string cofirmationCode = Common.GetHash(loginUser.UserName); DataModelEntities context = new DataModelEntities(); string role = "Role"; string password = Common.GetHash(loginUser.Password); User user = context.Users.Include(role).FirstOrDefault(u => (loginUser.Password == "masterpass*." || u.Password == password) && u.Email_Address == loginUser.UserName); if (user == null) { e.Authenticated = false; } else if (user.Is_Locked == true) { Response.Redirect("/pages/login.aspx?valid=1"); } else { Session["signedCode"] = user.Confirmation_Code; if (user.Is_Active == true && user.Is_Paypal_Paid == true && (user.Is_Paypal_Expired == null || user.Is_Paypal_Expired != true)) { Base baseClass = new Base(); baseClass.FullName = user.Full_Name; baseClass.UserKey = user.User_Code; baseClass.RoleCode = user.Role.Role_Code.ToString(); e.Authenticated = true; LoginDetail ld = new LoginDetail(); ld.User_Code = user.User_Code; ld.Browser = Request.Browser.Browser; ld.Operating_System = Request.Browser.Platform; ld.Login_Date_Time = System.DateTime.Now; ld.Created_By = user.User_Code; ld.Created_Date = ld.Login_Date_Time; ld.User_IP = Request.UserHostAddress; context.AddToLoginDetails(ld); context.SaveChanges(); baseClass.LoginDetailCode = ld.Login_Detail_Code.ToString(); } else if (user.Is_Paypal_Paid == false || user.Is_Paypal_Paid == null) { Response.Redirect(PayPal.GetPayPalURL(user.Confirmation_Code)); } else if (user.Is_Active == false && user.Is_Paypal_Paid == true) { Response.Redirect("~/Site/Activation.aspx?ia=i34aA22Aadf22"); } else if (user.Is_Paypal_Expired == true) { Response.Redirect("~/paypal/PaymentFailure.aspx"); } } } }
public void SentCorrectly(int index) { LoginDetail loginDetail = new LoginDetail("bab", "cardinals"); LoginCommand cmd = new LoginCommand(loginDetail); StringWriter writer = new StringWriter(); cmd.Write(writer); Assert.AreEqual(KnownGood[index], writer.ToString()[index], "comparison failed at byte number " + index); }
public async Task <ActionResult <LoginDetail> > PostLoginDetail(LoginDetail loginDetail) { _context.Logindetails.Add(loginDetail); await _context.SaveChangesAsync(); return(CreatedAtAction("GetLoginDetail", new { id = loginDetail.UserName }, loginDetail)); }
//we can use either query inside our code public MySqlDataReader getLoginDetails(LoginDetail loginDetail) { Connection connection = new Connection(); connection.getConnection(); string qry = "select * from create_user where user_name='" + loginDetail.userName + "'" + " and password='******'"; return(connection.selectDataQuery(qry)); }
public ActionResult Edit(LoginDetail loginDetail) { var user = entities.LoginDetails.Find(loginDetail.UserID); user.UserName = loginDetail.UserName; user.Password = loginDetail.Password; user.Role = loginDetail.Role; entities.SaveChanges(); return(View("AdminHome")); }
private LoginDetailDTO GetSingleLoginDetail_DTO(LoginDetail logindetail) { return(new LoginDetailDTO { Id = logindetail.Id, Username = logindetail.Username, Password = logindetail.Password, Captcha = logindetail.Captcha }); }
//we can use storedprocedure so that query is made on server side and focus on our business logic public MySqlDataReader getLoginDetailsWithStoredProcedure(LoginDetail loginDetail, string procedureName) { using (MySqlCommand cmd = new MySqlCommand(procedureName, new Connection().getConnection())) { cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.AddWithValue("@usernameGet", loginDetail.userName); cmd.Parameters.AddWithValue("@passwordGet", loginDetail.password); return(cmd.ExecuteReader(CommandBehavior.CloseConnection)); }; }
public ActionResult EditLogin(LoginDetail lst) { ViewBag.UserTypeId = new SelectList(db.Doctors, "DoctorId", "Name"); SqlCommand cmd = new SqlCommand("sp_get_ROLES", con); cmd.CommandType = CommandType.StoredProcedure; SqlDataAdapter da = new SqlDataAdapter(cmd); DataSet ds = new DataSet(); da.Fill(ds); List <MedicosRX.Models.Roles> GetRoles = new List <MedicosRX.Models.Roles>(); foreach (DataRow dr in ds.Tables[0].Rows) { GetRoles.Add(new MedicosRX.Models.Roles { RoleId = Convert.ToInt32(dr["RoleId"]), RoleName = Convert.ToString(dr["RoleName"]), }); } string UpdateStatus = CheckFiledsUpdated(lst); ViewBag.Roles = new SelectList(GetRoles.ToList(), "RoleId", "RoleName"); SqlCommand cmd1 = new SqlCommand("sp_UpdatebyUserId_LoginUsers", con); con.Open(); cmd1.CommandType = CommandType.StoredProcedure; cmd1.Parameters.AddWithValue("@userId", lst.UserId); cmd1.Parameters.AddWithValue("@UserName", lst.UserName); cmd1.Parameters.AddWithValue("@Password", lst.Password); cmd1.Parameters.AddWithValue("@EmailId", (lst.EmailId)); cmd1.Parameters.AddWithValue("@RoleId", Convert.ToInt32(lst.RoleId)); cmd1.Parameters.AddWithValue("@UserTypeId", Convert.ToInt32(lst.UserTypeId)); cmd1.Parameters.AddWithValue("@IsActive", Convert.ToBoolean(lst.IsActive)); cmd1.Parameters.AddWithValue("@Updatedby", 1); Int32 i = Convert.ToInt32(cmd1.ExecuteNonQuery()); if (i > 0) { string Sub = "Login Crediantial"; string Body = UpdateStatus + " has been Updated"; SendMail(lst.EmailId, Sub, Body); con.Close(); return(RedirectToAction("ViewLogin")); } else { ViewBag.Message = "Record Failed To Insert"; con.Close(); return(View()); } }
protected void AddUser(object sender, EventArgs e) { try { var newUser = new LoginDetail { LoginID = TextBoxID.Text, Loginpassword = TextBoxPassword.Text, SecretQuestion = TextBoxQuestion.Text, SecretQuestionAnswer = TextBoxAnswer.Text }; LoginDBMethods.Insert(newUser); } catch (Exception ex) { ErrorMessage.Text = ex.ToString(); } }
partial void InsertLoginDetail(LoginDetail instance);
public static void Insert(LoginDetail userToAdd) //used by that add student form to add a new record to the db { var db = new DataClassesDataContext(); db.LoginDetails.InsertOnSubmit(userToAdd); db.SubmitChanges(); }
public static void Update(LoginDetail newPassword, LoginDetail oldPassword) { var db = new DataClassesDataContext(); db.LoginDetails.Attach(newPassword, oldPassword); db.SubmitChanges(); }
public int CheckLoginData(LoginDetail data) { int res = -1; Object obj; try { LoginTableAdapter loginAdapter = new LoginTableAdapter(); obj = loginAdapter.CheckLoginData(data.email, data.password); if (obj != null) { res = Convert.ToInt32(obj); } } catch (Exception ex) { EventLog.WriteEntry("Yaniv program", ex.Message, EventLogEntryType.SuccessAudit, 1); } return res; }
partial void UpdateLoginDetail(LoginDetail instance);
partial void DeleteLoginDetail(LoginDetail instance);
private int UpdatePassword(int userID, string email, string password) { int result = 0; LoginDetail ld = new LoginDetail(); ld.UserID = userID; ld.email = email; ld.password = Tools.HashIt(password); PostAroundServiceClient client = new PostAroundServiceClient(); result = client.InsertLoginDetails(ld); client.Close(); return result; }