public async Task <IActionResult> Edit(int id, [Bind("HumanResourcesDepartmentID,Initial,LengthOfService,AcceptRawMaterials")] HumanResourceDepartment humanResourceDepartment)
        {
            if (id != humanResourceDepartment.HumanResourcesDepartmentID)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(humanResourceDepartment);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!HumanResourceDepartmentExists(humanResourceDepartment.HumanResourcesDepartmentID))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(humanResourceDepartment));
        }
        public async Task <IActionResult> Create([Bind("HumanResourcesDepartmentID,Initial,LengthOfService,AcceptRawMaterials")] HumanResourceDepartment humanResourceDepartment)
        {
            if (ModelState.IsValid)
            {
                _context.Add(humanResourceDepartment);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(humanResourceDepartment));
        }
Ejemplo n.º 3
0
        public static void CheckLogin(String username, String password)
        {
            Employee emp = DatabaseConnectionHandler.GetInstance().Employee.Where(x => x.EmployeeUsername.Equals(username) && x.EmployeePassword.Equals(password)).ToList().FirstOrDefault();

            if (emp == null)
            {
                MessageBox.Show("Invalid Username and Password");
            }
            else
            {
                idEmp = emp.EmployeeId;
                if (emp.EmployeeDepartmentId == 1)
                {
                    ManagementDepartment md = new ManagementDepartment();
                    md.Show();
                    login = 1;
                }
                else if (emp.EmployeeDepartmentId == 2)
                {
                    AttractionDepartment ad = new AttractionDepartment();
                    if (emp.EmployeeRole.Equals("Selling Ticket"))
                    {
                        ad.viewSellingEmployee();
                        ad.Show();
                        login = 1;
                    }
                    else
                    {
                        ad.viewEntranceGateEmployee();
                        ad.Show();
                        login = 1;
                    }
                }
                else if (emp.EmployeeDepartmentId == 3)
                {
                    MaintenanceDepartment md = new MaintenanceDepartment();
                    md.Show();
                    login = 1;
                }
                else if (emp.EmployeeDepartmentId == 4)
                {
                    RideandAttarctionCreativeDepartment rad = new RideandAttarctionCreativeDepartment();
                    rad.Show();
                    login = 1;
                }
                else if (emp.EmployeeDepartmentId == 5)
                {
                    ConstructionDepartment cd = new ConstructionDepartment();
                    cd.Show();
                    login = 1;
                }
                else if (emp.EmployeeDepartmentId == 6)
                {
                    RestaurantDepartment rd = new RestaurantDepartment();
                    if (emp.EmployeeRole.Equals("Waiter"))
                    {
                        rd.Show();
                        login = 1;
                    }
                    else
                    {
                        rd.Show();
                        login = 1;
                    }
                }
                else if (emp.EmployeeDepartmentId == 7)
                {
                    PurchaseDepartment pd = new PurchaseDepartment();
                    pd.Show();
                    login = 1;
                }
                else if (emp.EmployeeDepartmentId == 8)
                {
                    FundDepartment fd = new FundDepartment();
                    fd.Show();
                    login = 1;
                }
                else if (emp.EmployeeDepartmentId == 9)
                {
                    HotelDepartment hd = new HotelDepartment();
                    hd.Show();
                    login = 1;
                }
                else if (emp.EmployeeDepartmentId == 10)
                {
                    SalesAndMarketingDepartment smd = new SalesAndMarketingDepartment();
                    smd.Show();
                    login = 1;
                }
                else if (emp.EmployeeDepartmentId == 11)
                {
                    HumanResourceDepartment hrd = new HumanResourceDepartment();
                    hrd.Show();
                    login = 1;
                }
            }
        }