public ActionResult Cashier_details() { CashierRepository orepo = new CashierRepository(); List <Cashier> ll = orepo.GetAll(); return(View(ll)); }
public ActionResult ConfirmChangePassword(string oldpass, string Pass, string cpass) { CashierRepository orepo = new CashierRepository(); LoginRepository lrepo = new LoginRepository(); Cashier of = orepo.Get(Convert.ToInt32(Session["Id"])); Logininfo log = lrepo.Get(Session["Name"].ToString()); if (Session["Password"].ToString() == oldpass) { if (Pass != cpass) { ViewData["Message"] = "Password Didn't match"; } else { of.Cashier_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")); }
public override void OnAuthorization(System.Web.Http.Controllers.HttpActionContext actionContext) { base.OnAuthorization(actionContext); if (actionContext.Request.Headers.Authorization == null) { actionContext.Response = actionContext.Request.CreateResponse(HttpStatusCode.Unauthorized); } else { string encodedString = actionContext.Request.Headers.Authorization.Parameter; string decodedString = Encoding.UTF8.GetString(Convert.FromBase64String(encodedString)); string[] arr = decodedString.Split(new char[] { ':' }); string username = arr[0]; string password = arr[1]; CashierRepository urepo = new CashierRepository(); if (username == urepo.Get(username).Cashier_Name&& password == urepo.Get(username).Cashier_password) { Thread.CurrentPrincipal = new GenericPrincipal(new GenericIdentity(username), null); } else { actionContext.Response = actionContext.Request.CreateResponse(HttpStatusCode.Unauthorized); } } }
public ActionResult ConfirmEditProfile(Cashier cs) { CashierRepository crepo = new CashierRepository(); crepo.Update(cs); ViewData["Message"] = "Edit Successfull"; Session["Cashier"] = cs; return(View("Empty")); }
private void SubmitButtonLog_Click(object sender, EventArgs e) { CashierRepository cashier = new CashierRepository(); /****************************************************************************************** ** Get field values ** ******************************************************************************************/ //Get String of field. var FieldName = UserNameCashierLogField.Text.ToString(); //Get String of password. var FieldPass = PasswordCashierLogField.Text.ToString(); /****************************************************************************************** ** Get model values ** ******************************************************************************************/ //Get whole data of user (user name and pass). var UserNamePass = cashier.GetCashier().FirstOrDefault(x => x.cashier_user_name == FieldName && x.cashier_password == FieldPass); /****************************************************************************************** ** Log in proccessing ** ******************************************************************************************/ // Checking empty fields if (FieldName.Length == 0 || FieldPass.Length == 0) { MessageBox.Show("Не сте въвели някое от полетата !"); } else { // Check user name and pass. if (UserNamePass != null) { //If there are user name and password. Program will proceed to Admin panel. this.Hide(); AdministrationPanel adminPanel = new AdministrationPanel(); adminPanel.ShowDialog(); } else { //Else message will show MessageBox.Show("Въвели сте грешен user name или парола !"); } } }
public UnitOfWork(ShopContext context) { _context = context; Shops = new ShopRepository(context); Cashboxes = new CashboxRepository(context); Transactions = new TransactionRepository(context); Cashiers = new CashierRepository(context); Orders = new OrderRepository(context); Products = new ProductRepository(context); Categories = new CategoryRepository(context); }
public ActionResult Cashier_Salary() { CashierRepository brepo = new CashierRepository(); List <Cashier> blist = brepo.GetAll(); List <Cashier> slist = new List <Cashier>(); foreach (Cashier of in blist) { if (of.Cashier_branch != Session["Branch"].ToString()) { } else { slist.Add(of); } } return(View(slist)); }
public ActionResult ConfirmCashier_Salary(int Cashier_Id) { CashierRepository brepo = new CashierRepository(); Cashier br = brepo.Get(Cashier_Id); DateTime d = DateTime.Now; if (d >= Convert.ToDateTime(br.Cashier_LastPaymentDate).AddDays(30)) { br.Cashier_LastPaymentDate = d.ToString(); br.Cashier_TotalPayment += br.Cashier_Salary; br.Cashier_Balance += br.Cashier_Salary; brepo.Update(br); ViewData["Message"] = "Salary Payment Successfull"; } else { ViewData["Message"] = "To Early to Pay Salary"; } return(View("Empty")); }
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")); }
private void ConfirmButtonReg_Click(object sender, EventArgs e) { var context = new CashierSystemEntities(); /****************************************************************************************** ** Getting values in registration form ** ******************************************************************************************/ // Get value in registration form – text field first name. var FirstNameReg = NameCashierRegField.Text.ToString(); // Get value in registration form – text field last name. var LastNameReg = LnameCashierRegField.Text.ToString(); // Get value in registration form – text field user name. var UserNameReg = UserNameCashierRegField.Text.ToString(); // Get value in registration form – text field password. var PassReg = PasswordCashierRegField.Text.ToString(); // Get value in registration form – text field confirm password. var PassConfig = ConfirmPassCashierRegFiedl.Text.ToString(); /****************************************************************************************** ** Getting data model ** ******************************************************************************************/ // Object newCashier of type CashierRepository. CashierRepository newCashier = new CashierRepository(); // Get only user name from table Cashier. var onlyUserName = context.Cashier.FirstOrDefault(un => un.cashier_user_name == UserNameReg); /****************************************************************************************** ** Registration proccessing ** ******************************************************************************************/ // Check if any field is empty. if (FirstNameReg.Length == 0 || LastNameReg.Length == 0 || UserNameReg.Length == 0 || PassReg.Length == 0 || PassConfig.Length == 0) { // If there is empty field, it shows message. MessageBox.Show("Не сте въвели някое от полетата!"); } else { // Check password and confirm password match. if (PassReg.Equals(PassConfig)) { // Check is user exist if (onlyUserName != null) { // Return message that user exists MessageBox.Show("Съществува такъв потребител ! Сменете потребителското име"); } else { // Add to table new cashier newCashier.AddCashier(FirstNameReg, LastNameReg, UserNameReg, PassReg); // Clear all fields NameCashierRegField.Text = ""; LnameCashierRegField.Text = ""; UserNameCashierRegField.Text = ""; PasswordCashierRegField.Text = ""; ConfirmPassCashierRegFiedl.Text = ""; // Confirmed record MessageBox.Show("Успешен запис !"); } } else { // If there is no matching of confirm pass and pass, shows message. MessageBox.Show("Паролите не съвпадат !"); } } }