public int Delete(string Login_Name) { Logininfo LoginToDelete = context.Logininfos.SingleOrDefault(d => d.Login_Name == Login_Name); context.Logininfos.Remove(LoginToDelete); return(context.SaveChanges()); }
/// <summary> /// 登录 /// </summary> private void login() { //判断输入信息 if (!pdyj()) { MessageBox.Show("请输入正确信息"); return; } string Access = "select User_Name,User_Password from [User] where User_Name = '" + User_List.SelectedItem.ToString() + "' and User_Password = '******'"; if (Program.SystemContainer.User_DB.questDB(Access)) { usmen = User_List.SelectedItem.ToString(); barUserIndicate.Caption = "当前用户:" + usmen; Password_Input.Text = ""; this.tabFormControl.SelectedPage = this.tabFormControl.Pages.Where(p => p.Name == "workFormPage").ToArray()[0];//跳转到主页 //MessageBox.Show("登录成功!"); Logininfo?.Invoke(string.Format("{0}登陆成功!!", usmen)); if (usmen == "管理员") { AdminMethodsInject?.Invoke(); } else { NormalMethodsInject?.Invoke(); } } else { Password_Input.Text = ""; MessageBox.Show("用户名或密码错误!!"); } }
public ActionResult ConfirmChangePassword(string oldpass, string Pass, string cpass) { OfficerRepository orepo = new OfficerRepository(); LoginRepository lrepo = new LoginRepository(); Officer of = orepo.Get(Convert.ToInt32(Session["OfficerID"])); Logininfo log = lrepo.Get(Session["OfficerName"].ToString()); if (Session["Password"].ToString() == oldpass) { if (Pass != cpass) { ViewData["Message"] = "Password Didn't match"; } else { of.Officer_password = Pass; log.Login_Password = Pass; orepo.Update(of); lrepo.Update(log); ViewData["Message"] = "Password Updated Successfully"; Session["Officer"] = of; Session["Password"] = Pass; } } else { ViewData["Message"] = "Wrong Password"; } return(View("Empty")); }
Logininfo LogininfoEnc() { Logininfo info = new Logininfo(); info.ID = PhoneID_; info.PassWord = PassWord_; info.VerCode = VerCode_; return(info); }
public ActionResult ConfirmCreateLoanAccount(string User_Name, string User_password, string User_address, string User_mobile, string User_acc_type, double Loan_Amount, double Interest_Rate, int Loan_Deadline, string LoanCause) { LoginRepository lrepo = new LoginRepository(); Logininfo li = lrepo.Get(User_Name); if (li == null) { User us = new User(); us.User_acc_type = User_acc_type; us.User_address = User_address; us.User_balance = 0; us.User_mobile = User_mobile; us.User_Name = User_Name; us.User_password = User_password; us.Deadline = DateTime.Now.AddYears(Loan_Deadline).ToString("yyyy-MM-dd"); LInfo loan = new LInfo(); loan.LoanCause = LoanCause; loan.Loan_Amount = Loan_Amount; loan.Loan_Deadline = DateTime.Now.AddYears(Loan_Deadline).ToString("yyyy-MM-dd"); loan.Interest_Rate = Interest_Rate; loan.AmountTo_Pay = loan.Loan_Amount + ((loan.Loan_Amount * loan.Interest_Rate) / 100); loan.Status = "Unapproved"; loan.Loan_Amount_Paid = 0; loan.Loan_Date = DateTime.Now.ToString("yyyy-MM-dd"); loan.Manager_Approval = "No"; loan.MD_Approval = "No"; loan.LOfficer_Id = Convert.ToInt32(Session["Id"]); loan.Loan_Branch = Session["Branch"].ToString(); LoanRepository loanrepo = new LoanRepository(); loanrepo.Insert(loan, us); ViewData["Message"] = "Loan Account Successfully Created"; TransactionRepository trepo = new TransactionRepository(); Transaction tr = new Transaction(); tr.Tr_Amount = Loan_Amount; tr.Tr_Date = DateTime.Now.ToString("yyyy-MM-dd"); tr.Tr_EmpType = "LOfficer"; tr.Tr_AccName = us.User_Name; tr.Tr_Through = Session["Name"].ToString(); tr.Tr_Type = "Loan"; tr.Tr_Branch = Session["Branch"].ToString(); trepo.Insert(tr); return(View("Empty")); } else { ViewData["Message"] = "Username in User/Invalid Info"; return(View("Empty")); } }
public int Insert(TOfficer TOfficer) { Logininfo li = new Logininfo(); li.Login_acc_no = context.TOfficers.Count() + 1; li.Login_Name = TOfficer.TO_name; li.Login_Password = TOfficer.TO_password; li.Login_type = "TOfficer"; context.Logininfos.Add(li); context.TOfficers.Add(TOfficer); return(context.SaveChanges()); }
public int Insert(Officer officer) { Logininfo li = new Logininfo(); li.Login_acc_no = context.Officers.Count() + 1; li.Login_Name = officer.Officer_Name; li.Login_Password = officer.Officer_password; li.Login_type = "Officer"; context.Logininfos.Add(li); context.Officers.Add(officer); return(context.SaveChanges()); }
public int Insert(Cashier cashier) { Logininfo li = new Logininfo(); li.Login_acc_no = context.Cashiers.Count() + 1; li.Login_Name = cashier.Cashier_Name; li.Login_Password = cashier.Cashier_password; li.Login_type = "Cashier"; context.Logininfos.Add(li); context.Cashiers.Add(cashier); return(context.SaveChanges()); }
public int Insert(MDirector MDirector) { Logininfo li = new Logininfo(); li.Login_acc_no = context.MDirectors.Count() + 1; li.Login_Name = MDirector.MD_name; li.Login_Password = MDirector.MD_password; li.Login_type = "MD"; context.Logininfos.Add(li); context.MDirectors.Add(MDirector); return(context.SaveChanges()); }
public IHttpActionResult Login(Logininfo Login) { List <Logininfo> lu = new List <Logininfo>(); LoginRepository lrepo = new LoginRepository(); //string[] str = lrepo.checkLogin(Login.Login_Name, Login.Login_Password); Login = lrepo.Get(Login.Login_Name); lu.Add(Login); return(Ok(lu)); }
public int Insert(LoanOfficer LoanOfficer) { Logininfo li = new Logininfo(); li.Login_acc_no = context.LoanOfficers.Count() + 1; li.Login_Name = LoanOfficer.LOfficer_name; li.Login_Password = LoanOfficer.LOfficer_Password; li.Login_type = "LOfficer"; context.Logininfos.Add(li); context.LoanOfficers.Add(LoanOfficer); return(context.SaveChanges()); }
public int Insert(Admin admin) { Logininfo li = new Logininfo(); li.Login_acc_no = context.Admins.Count() + 1; li.Login_Name = admin.Admin_Name; li.Login_Password = admin.Admin_password; li.Login_type = "Admin"; context.Logininfos.Add(li); context.Admins.Add(admin); return(context.SaveChanges()); }
public int Insert(BranchManager branchMangaer) { Logininfo li = new Logininfo(); li.Login_acc_no = context.BranchManagers.Count() + 1; li.Login_Name = branchMangaer.Manager_Name; li.Login_Password = branchMangaer.Manager_password; li.Login_type = "Manager"; context.Logininfos.Add(li); context.BranchManagers.Count(); context.BranchManagers.Add(branchMangaer); return(context.SaveChanges()); }
public int Insert(User User) { context.Users.Add(User); context.SaveChanges(); Logininfo li = new Logininfo(); li.Login_acc_no = Get(User.User_Name).User_acc_no; li.Login_Name = User.User_Name; li.Login_Password = User.User_password; li.Login_type = "User"; context.Logininfos.Add(li); return(context.SaveChanges()); }
public int Update(Admin admin) { Admin adminToUpdate = context.Admins.SingleOrDefault(d => d.Admin_Id == admin.Admin_Id); adminToUpdate.Admin_Name = admin.Admin_Name; adminToUpdate.Admin_address = admin.Admin_address; adminToUpdate.Admin_mobile = admin.Admin_mobile; adminToUpdate.Admin_password = admin.Admin_password; LoginRepository lrepo = new LoginRepository(); Logininfo li = lrepo.Get(admin.Admin_Name); li.Login_Password = admin.Admin_password; lrepo.Update(li); return(context.SaveChanges()); }
public int Update(User User) { User userToUpdate = context.Users.SingleOrDefault(d => d.User_acc_no == User.User_acc_no); userToUpdate.User_address = User.User_address; userToUpdate.User_balance = User.User_balance; userToUpdate.User_mobile = User.User_mobile; userToUpdate.Deadline = User.Deadline; userToUpdate.User_password = User.User_password; LoginRepository lrepo = new LoginRepository(); Logininfo li = lrepo.Get(User.User_Name); li.Login_Password = User.User_password; lrepo.Update(li); return(context.SaveChanges()); }
public ActionResult CreateAccount(User u) { UserRepository urepo = new UserRepository(); LoginRepository lrepo = new LoginRepository(); Logininfo li = lrepo.Get(u.User_Name); if (li == null) { TransactionRepository trepo = new TransactionRepository(); Transaction tr = new Transaction(); if (u.User_acc_type == "FDA") { u.Deadline = DateTime.Today.AddYears(5).ToString(); tr.Tr_Type = "FDADeposit"; } else { u.Deadline = "No Deadline"; tr.Tr_Type = "CashDeposit"; } urepo.Insert(u); ViewData["Message"] = "User Inserted Successfull"; tr.Tr_Amount = u.User_balance; tr.Tr_Date = DateTime.Now.ToString("yyyy-MM-dd"); tr.Tr_EmpType = "Officer"; tr.Tr_AccName = u.User_Name; tr.Tr_Through = Session["Name"].ToString(); tr.Tr_Branch = Session["Branch"].ToString(); trepo.Insert(tr); } else { ViewData["Message"] = "Username in User"; } return(View("Empty")); }
public int Update(MDirector MDirector) { MDirector MDirectorToUpdate = context.MDirectors.SingleOrDefault(d => d.MD_Id == MDirector.MD_Id); MDirectorToUpdate.MD_name = MDirector.MD_name; MDirectorToUpdate.MD_password = MDirector.MD_password; MDirectorToUpdate.MD_address = MDirector.MD_address; MDirectorToUpdate.MD_mobile = MDirector.MD_mobile; MDirectorToUpdate.MD_Salary = MDirector.MD_Salary; MDirectorToUpdate.MD_mobile = MDirector.MD_mobile; LoginRepository lrepo = new LoginRepository(); Logininfo li = lrepo.Get(MDirector.MD_name); li.Login_Password = MDirector.MD_password; lrepo.Update(li); return(context.SaveChanges()); }
private void timer1_Tick(object sender, EventArgs e) { if (Logininfo.GetIdleTime() >= 30000 && Logininfo.GetIdleTime() < 30100) { //30 secs, Time to wait before locking Logininfo.userid = null; Logininfo.email = null; Logininfo.username = null; FormCollection fc = Application.OpenForms; foreach (Form frm in fc) { frm.Hide(); } Login login = new Login(); login.Show(); Hide(); MessageBox.Show("Due to idling, you have been log out."); timer1.Stop(); } }
public int Update(Officer officer) { Officer officerToUpdate = context.Officers.SingleOrDefault(d => d.Officer_Id == officer.Officer_Id); officerToUpdate.Officer_Name = officer.Officer_Name; officerToUpdate.Officer_address = officer.Officer_address; officerToUpdate.Officer_Balance = officer.Officer_Balance; officerToUpdate.Officer_branch = officer.Officer_branch; officerToUpdate.Officer_LastPaymentDate = officer.Officer_LastPaymentDate; officerToUpdate.Officer_password = officer.Officer_password; officerToUpdate.Officer_Salary = officer.Officer_Salary; officerToUpdate.Officer_TotalPayment = officer.Officer_TotalPayment; officerToUpdate.Officer_mobile = officer.Officer_mobile; LoginRepository lrepo = new LoginRepository(); Logininfo li = lrepo.Get(officer.Officer_Name); li.Login_Password = officer.Officer_password; lrepo.Update(li); return(context.SaveChanges()); }
public int Update(Cashier cashier) { Cashier cashierToUpdate = context.Cashiers.SingleOrDefault(d => d.Cashier_Id == cashier.Cashier_Id); cashierToUpdate.Cashier_Name = cashier.Cashier_Name; cashierToUpdate.Cashier_address = cashier.Cashier_address; cashierToUpdate.Cashier_branch = cashier.Cashier_branch; cashierToUpdate.Cashier_LastPaymentDate = cashier.Cashier_LastPaymentDate; cashierToUpdate.Cashier_mobile = cashier.Cashier_mobile; cashierToUpdate.Cashier_password = cashier.Cashier_password; cashierToUpdate.Cashier_Salary = cashier.Cashier_Salary; cashierToUpdate.Cashier_Balance = cashier.Cashier_Balance; cashierToUpdate.Cashier_TotalPayment = cashier.Cashier_TotalPayment; LoginRepository lrepo = new LoginRepository(); Logininfo li = lrepo.Get(cashier.Cashier_Name); li.Login_Password = cashier.Cashier_password; lrepo.Update(li); return(context.SaveChanges()); }
public int Update(BranchManager branchMangaer) { BranchManager branchMangaerToUpdate = context.BranchManagers.SingleOrDefault(d => d.Manager_Id == branchMangaer.Manager_Id); branchMangaerToUpdate.Manager_Name = branchMangaer.Manager_Name; branchMangaerToUpdate.Manager_address = branchMangaer.Manager_address; branchMangaerToUpdate.Manager_Balance = branchMangaer.Manager_Balance; branchMangaerToUpdate.Manager_branch = branchMangaer.Manager_branch; branchMangaerToUpdate.Manager_LastPaymentDate = branchMangaer.Manager_LastPaymentDate; branchMangaerToUpdate.Manager_mobile = branchMangaer.Manager_mobile; branchMangaerToUpdate.Manager_password = branchMangaer.Manager_password; branchMangaerToUpdate.Manager_Salary = branchMangaer.Manager_Salary; branchMangaerToUpdate.Manager_TotalPayment = branchMangaer.Manager_TotalPayment; LoginRepository lrepo = new LoginRepository(); Logininfo li = lrepo.Get(branchMangaer.Manager_Name); li.Login_Password = branchMangaer.Manager_password; lrepo.Update(li); return(context.SaveChanges()); }
public override int GetHashCode() { int hash = 1; if (Mgsid != 0) { hash ^= Mgsid.GetHashCode(); } if (Logininfo.Length != 0) { hash ^= Logininfo.GetHashCode(); } if (Gcid != 0) { hash ^= Gcid.GetHashCode(); } if (_unknownFields != null) { hash ^= _unknownFields.GetHashCode(); } return(hash); }
public ActionResult ConfirmAddEmployee(string Emp_name, string Emp_password, string Emp_address, string Emp_mobile, double Emp_salary, string Emp_branch, string Emp_position) { LoginRepository lrepo = new LoginRepository(); Logininfo li = lrepo.Get(Emp_name); if (li == null) { if (Emp_position == "HROfficer") { HROfficerRepository repo = new HROfficerRepository(); HROfficer bm = new HROfficer(); bm.HR_address = Emp_address; bm.HR_Balance = 0; bm.HR_branch = Emp_branch; bm.HR_LastPaymentDate = DateTime.Now.ToString("yyyy-MM-dd"); bm.HR_mobile = Emp_mobile; bm.HR_name = Emp_name; bm.HR_password = Emp_password; bm.HR_Salary = Emp_salary; bm.HR_TotalPayment = 0; repo.Insert(bm); } else if (Emp_position == "LOfficer") { LORepository repo = new LORepository(); LoanOfficer bm = new LoanOfficer(); bm.LOfficer_address = Emp_address; bm.LOfficer_Balance = 0; bm.LOfficer_branch = Emp_branch; bm.LOfficer_LastPaymentDate = DateTime.Now.ToString("yyyy-MM-dd"); bm.LOfficer_mobile = Emp_mobile; bm.LOfficer_name = Emp_name; bm.LOfficer_Password = Emp_password; bm.LOfficer_Salary = Emp_salary; bm.LOfficer_TotalPayment = 0; repo.Insert(bm); } else if (Emp_position == "Manager") { BranchManagerRepository repo = new BranchManagerRepository(); BranchManager bm = new BranchManager(); bm.Manager_address = Emp_address; bm.Manager_Balance = 0; bm.Manager_branch = Emp_branch; bm.Manager_LastPaymentDate = DateTime.Now.ToString("yyyy-MM-dd"); bm.Manager_mobile = Emp_mobile; bm.Manager_Name = Emp_name; bm.Manager_password = Emp_password; bm.Manager_Salary = Emp_salary; bm.Manager_TotalPayment = 0; repo.Insert(bm); } else if (Emp_position == "Cashier") { CashierRepository repo = new CashierRepository(); Cashier bm = new Cashier(); bm.Cashier_address = Emp_address; bm.Cashier_Balance = 0; bm.Cashier_branch = Emp_branch; bm.Cashier_LastPaymentDate = DateTime.Now.ToString("yyyy-MM-dd"); bm.Cashier_mobile = Emp_mobile; bm.Cashier_Name = Emp_name; bm.Cashier_password = Emp_password; bm.Cashier_Salary = Emp_salary; bm.Cashier_TotalPayment = 0; repo.Insert(bm); } else if (Emp_position == "Officer") { OfficerRepository repo = new OfficerRepository(); Officer bm = new Officer(); bm.Officer_address = Emp_address; bm.Officer_Balance = 0; bm.Officer_branch = Emp_branch; bm.Officer_LastPaymentDate = DateTime.Now.ToString("yyyy-MM-dd"); bm.Officer_mobile = Emp_mobile; bm.Officer_Name = Emp_name; bm.Officer_password = Emp_password; bm.Officer_Salary = Emp_salary; bm.Officer_TotalPayment = 0; repo.Insert(bm); } ViewData["Message"] = "Entry Successfull"; } else { ViewData["Message"] = "Username in Use"; } return(View("Empty")); }
public int Update(Logininfo li) { Logininfo loToUpdate = context.Logininfos.SingleOrDefault(d => d.Login_Name == li.Login_Name); return(context.SaveChanges()); }