コード例 #1
0
        private void DoLogout(object sender, RoutedEventArgs e)
        {
            ActiveUserController.SetActiveEmployee(null);
            LoginPage loginPage = new LoginPage();

            this.NavigationService.Navigate(loginPage);
        }
コード例 #2
0
        private void DoLoginButton(object sender, RoutedEventArgs e)
        {
            Employee employee = LoginController.DoUserLogin(usernameText.Text, passwordText.Password);

            if (employee == null)
            {
                errorLabelText.Text = "Invalid Credential";
                return;
            }
            else
            {
                LoginController.DoFeedActiveEmployee(employee.EmployeeID);
                if (ActiveUserController.GetActiveEmployee().Department.DepartmentName.Equals("Manager"))
                {
                    ManagerHomePage managerHomePage = new ManagerHomePage();
                    this.NavigationService.Navigate(managerHomePage);
                }
                else if (ActiveUserController.GetActiveEmployee().Department.DepartmentName.Equals("HRD"))
                {
                    HRDHomePage hrdHomePage = new HRDHomePage();
                    this.NavigationService.Navigate(hrdHomePage);
                }
                else if (ActiveUserController.GetActiveEmployee().Department.DepartmentName.Equals("Ride And Attraction"))
                {
                    CreativeHomePage creativeHomePage = new CreativeHomePage();
                    this.NavigationService.Navigate(creativeHomePage);
                }
                else if (ActiveUserController.GetActiveEmployee().Department.DepartmentName.Equals("Sales And Marketing"))
                {
                    this.NavigationService.Navigate(new SalesAndMarketingHomePage());
                }
                else if (ActiveUserController.GetActiveEmployee().Department.DepartmentName.Equals("Construction"))
                {
                    this.NavigationService.Navigate(new ConstructionHomePage());
                }
                else if (ActiveUserController.GetActiveEmployee().Department.DepartmentName.Equals("Accounting And Finance"))
                {
                    this.NavigationService.Navigate(new AccountFinanceHomePage());
                }
                else if (ActiveUserController.GetActiveEmployee().Department.DepartmentName.Equals("Attraction"))
                {
                    this.NavigationService.Navigate(new AttractionHomePage());
                }
                else if (ActiveUserController.GetActiveEmployee().Department.DepartmentName.Equals("Purchasing"))
                {
                    this.NavigationService.Navigate(new PurchasingHomePage());
                }
                else if (ActiveUserController.GetActiveEmployee().Department.DepartmentName.Equals("Kitchen Division"))
                {
                    this.NavigationService.Navigate(new KitchenHomePage());
                }
                else if (ActiveUserController.GetActiveEmployee().Department.DepartmentName.Equals("Dining Room Division"))
                {
                    this.NavigationService.Navigate(new DiningRoomPage());
                }
                MessageBox.Show($"Login Success As {ActiveUserController.GetActiveEmployee().EmployeeName}");
            }
        }
コード例 #3
0
        private void CreateButton_Click(object sender, RoutedEventArgs e)
        {
            Advertisement newAds = new Advertisement();

            newAds.EmployeeID = ActiveUserController.GetActiveEmployee().EmployeeID;
            newAds.Deadline   = AdsDeadline.SelectedDate.Value;
            newAds.AdvertisementDescription = advertisementDescriptionText.Text;
            AdvertisementController.CreateAdvertisement(newAds);
            refreshTable();
        }
コード例 #4
0
        private void AddPurchaseRequest_Click(object sender, RoutedEventArgs e)
        {
            PurchaseRequest purchaseRequest = new PurchaseRequest();

            purchaseRequest.PurchaseDescription   = purchaseDescTextt.Text;
            purchaseRequest.PurchaseRequestedDate = purchaseRequestedDate.SelectedDate.Value;
            purchaseRequest.DepartmentID          = ActiveUserController.GetActiveEmployee().DepartmentID;
            PurchaseRequestController.CreatePurchaseRequest(purchaseRequest);
            MessageBox.Show("Succesfully Sent Request !");
        }
コード例 #5
0
        private void AddFundRequest_Click(object sender, RoutedEventArgs e)
        {
            FundRequest newFund = new FundRequest();

            newFund.FundPrice         = Int32.Parse(fundPriceText.Text);
            newFund.FundReason        = FundReasonText.Text;
            newFund.FundRequestedDate = fundRequestedDate.SelectedDate.Value;
            newFund.DepartmentID      = ActiveUserController.GetActiveEmployee().DepartmentID;
            FundController.CreateFundRequest(newFund);
            MessageBox.Show("Succesfully Sent Request !");
        }
コード例 #6
0
        private void UpdateButton_Click(object sender, RoutedEventArgs e)
        {
            Advertisement newAds = new Advertisement();

            newAds.AdvertisementID          = Int32.Parse(idText.Text);
            newAds.Deadline                 = AdsDeadline.SelectedDate.Value;
            newAds.AdvertisementDescription = advertisementDescriptionText.Text;
            newAds.AdvertisementStatus      = "Active";
            newAds.EmployeeID               = ActiveUserController.GetActiveEmployee().EmployeeID;
            AdvertisementController.UpdateAds(newAds);
            refreshTable();
        }
コード例 #7
0
 private void DoInitializeUser()
 {
     userLabelText.Text = "Welcome, " + ActiveUserController.GetActiveEmployee().EmployeeFullname;
 }
コード例 #8
0
        private void DoLoginButton(object sender, RoutedEventArgs e)
        {
            String[] messages = LoginController.DoUserLogin(usernameText.Text, passwordText.Password);

            if (messages[0].Equals(""))
            {
                messages = LoginController.DoCustomerLogin(usernameText.Text, passwordText.Password);
                if (messages[0].Equals(""))
                {
                    errorLabelText.Text = messages[1];
                    return;
                }
                else
                {
                    int id;
                    Int32.TryParse(messages[0], out id);
                    LoginController.DoFeedActiveCustomer(id);
                    CustomerHomePage customerPage = new CustomerHomePage();
                    this.NavigationService.Navigate(customerPage);
                    MessageBox.Show($"Login Success As Customer {ActiveUserController.GetActiveCustomer().CustomerFullname}");
                }
            }
            else
            {
                int id;
                Int32.TryParse(messages[0], out id);
                LoginController.DoFeedActiveEmployee(id);
                if (ActiveUserController.GetActiveEmployee().DepartmentId == 2)
                {
                    //CreativeHomePage creativeHomePage = new CreativeHomePage();
                    this.NavigationService.Navigate(PageFactory.GetInstance("Creative"));
                }
                else if (ActiveUserController.GetActiveEmployee().DepartmentId == 3)
                {
                    //MaintenanceHomePage maintenanceHomePage = new MaintenanceHomePage();
                    this.NavigationService.Navigate(PageFactory.GetInstance("Maintenance"));
                }
                else if (ActiveUserController.GetActiveEmployee().DepartmentId == 4)
                {
                    //ConstructionHomePage constructionHomePage = new ConstructionHomePage();
                    this.NavigationService.Navigate(PageFactory.GetInstance("Construction"));
                }
                else if (ActiveUserController.GetActiveEmployee().DepartmentId == 5)
                {
                    //KitchenHomePage kitchenHomePage = new KitchenHomePage();
                    this.NavigationService.Navigate(PageFactory.GetInstance("Kitchen"));
                }
                else if (ActiveUserController.GetActiveEmployee().DepartmentId == 6)
                {
                    //DiningHomePage diningHomePage = new DiningHomePage();
                    this.NavigationService.Navigate(PageFactory.GetInstance("Dining"));
                }
                else if (ActiveUserController.GetActiveEmployee().DepartmentId == 7)
                {
                    //PurchaseHomePage purchaseHomePage = new PurchaseHomePage();
                    this.NavigationService.Navigate(PageFactory.GetInstance("Purchase"));
                }
                else if (ActiveUserController.GetActiveEmployee().DepartmentId == 10)
                {
                    //SalesMarketingHomePage salesHomePage = new SalesMarketingHomePage();
                    this.NavigationService.Navigate(PageFactory.GetInstance("Sales"));
                }
                else if (ActiveUserController.GetActiveEmployee().DepartmentId == 11)
                {
                    //HRDHomePage hrdHomePage = new HRDHomePage();
                    this.NavigationService.Navigate(PageFactory.GetInstance("HRD"));
                }
                else if (ActiveUserController.GetActiveEmployee().DepartmentId == 12)
                {
                    //FinancialHomePage financialHomePage = new FinancialHomePage();
                    this.NavigationService.Navigate(PageFactory.GetInstance("Finance"));
                }
                else if (ActiveUserController.GetActiveEmployee().DepartmentId == 13)
                {
                    //ManagerHomePage managerHomePage = new ManagerHomePage();
                    this.NavigationService.Navigate(PageFactory.GetInstance("Manager"));
                }
                MessageBox.Show($"Login Success As {ActiveUserController.GetActiveEmployee().EmployeeFullname}");
            }
        }
コード例 #9
0
 private void DoInitializeUser()
 {
     userLabelText.Text = "Welcome, " + ActiveUserController.GetActiveCustomer().CustomerFullname;
 }