コード例 #1
0
 private void BtnEdit_Click(object sender, EventArgs e)
 {
     if (tbxName.Text == "Name" || tbxName.Text == "")
     {
         MessageBox.Show("Please, input name");
         return;
     }
     if (rtbDescription.Text == "Description" || rtbDescription.Text == "")
     {
         MessageBox.Show("Please, input description");
         return;
     }
     if (MessageBox.Show("Do you really want to edit this department?", "Question", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
     {
         string name         = tbxName.Text;
         string description  = rtbDescription.Text;
         int    neededpeople = Convert.ToInt32(numPeople.Value);
         foreach (Department dep in Department.GetAllDepartments())
         {
             if (dep.DepartmentId == depId)
             {
                 dep.EditDepartment(name, description, neededpeople);
             }
         }
         this.Close();
         previousForm.UpdateGUI();
     }
 }
コード例 #2
0
ファイル: HiringRequest.cs プロジェクト: fabestine1/MyThing
        public HiringRequest(string username, string firstName, string lastName, decimal hourlyWage, int departmentId, DateTime contractStartDate, long phoneNumber, string email)
        {
            InitializeComponent();

            this.FormBorderStyle = FormBorderStyle.FixedSingle;
            this.Enabled         = false;

            tbUsername.Text            = username;
            tbFirstName.Text           = firstName;
            tbLastName.Text            = lastName;
            nHourlyWage.Value          = hourlyWage;
            dtbContractStartDate.Value = contractStartDate;
            tbPhoneNumber.Text         = phoneNumber.ToString();
            tbEmail.Text = email;

            List <Department> departments = Department.GetAllDepartments();

            foreach (Department d in departments)
            {
                if (d.DepartmentId == departmentId)
                {
                    cmbDepartment.Text = d.Name;
                }
            }
            ;
        }
コード例 #3
0
        public void UpdateGUI()
        {
            departments = null;
            controls.Clear();
            reportControls.Clear();
            flpReports.Controls.Clear();
            flpDepartments.Controls.Clear();
            departments = Department.GetAllDepartments();
            reports     = Report.GetAllReports();

            foreach (Department d in departments)
            {
                controls.Add(new DepartmentUserControl(d.DepartmentId, d.Name, d.Description, d.NeededPeople, this));
            }

            foreach (DepartmentUserControl department in controls)
            {
                flpDepartments.Controls.Add(department);
            }

            foreach (Report r in reports)
            {
                if (r.ReportStatus == "unread")
                {
                    reportControls.Add(new ReportControl(r.ReportId, r.ReportSubject, r.ReportMessage, r.ReportStatus, this));
                }
            }

            foreach (ReportControl report in reportControls)
            {
                flpReports.Controls.Add(report);
            }
        }
コード例 #4
0
 public FiringRequest(int user_id, int workerRole)
 {
     InitializeComponent();
     this.FormBorderStyle = FormBorderStyle.FixedSingle;
     tbxFirstName.Enabled = false;
     tbxLastName.Enabled  = false;
     cmbEmployees.Enabled = false;
     cmbManagers.Enabled  = false;
     PopulateDepartments(Department.GetAllDepartments());
     PopulateManagers(Manager.GetAllManagers());
     PopulateEmployees(Employee.GetAllEmployees());
     this.loggedUserId   = user_id;
     this.workerRole     = workerRole;
     rtbReason.MaxLength = 400;
     if (workerRole == (int)ProfileRoles.ADMINISTRATOR)
     {
         btnSendFiringRequest.Visible = false;
         this.Text            = "Remove manager!";
         cmbEmployees.Visible = false;
     }
     else if (workerRole == (int)ProfileRoles.MANAGER)
     {
         btnRemoveManager.Visible = false;
         cmbManagers.Visible      = false;
     }
 }
コード例 #5
0
 public PromotionRequest(int user_id)
 {
     InitializeComponent();
     this.loggedUserId    = user_id;
     this.FormBorderStyle = FormBorderStyle.FixedSingle;
     PopulateDepartments(Department.GetAllDepartments());
     PopulateEmployees(Employee.GetAllEmployees());
 }
コード例 #6
0
 public ViewWorkersWorkingToday()
 {
     InitializeComponent();
     controls = new List <CurrentWorkingWorkerControl>();
     PopulateDepartments(Department.GetAllDepartments());
     cmbShifts.Items.Add("morning");
     cmbShifts.Items.Add("afternoon");
     cmbShifts.Items.Add("evening");
 }
コード例 #7
0
 public StockView(int workerRole)
 {
     InitializeComponent();
     PopulateDepartments(Department.GetAllDepartments());
     populateStocks(Stock.GetAllStocks());
     if (workerRole == (int)ProfileRoles.EMPLOYEE)
     {
         this.Width = 580;
     }
 }
コード例 #8
0
 private void deleteDepartmentBttn_Click(object sender, EventArgs e)
 {
     foreach (Department dep in Department.GetAllDepartments())
     {
         if (dep.DepartmentId == depId)
         {
             dep.RemoveDepartment();
         }
     }
     form.UpdateGUI();
 }
コード例 #9
0
        public AddStock()
        {
            InitializeComponent();

            this.StartPosition = FormStartPosition.CenterScreen;
            departmentsCmbbxAddingStock.Items.Clear();
            List <Department> departments = Department.GetAllDepartments();

            foreach (Department d in departments)
            {
                departmentsCmbbxAddingStock.Items.Add(new DepartmentComboBoxItem(d));
            }
        }
コード例 #10
0
 private void deleteDepartmentBttn_Click(object sender, EventArgs e)
 {
     if (MessageBox.Show("Do you really want to remove this department?", "Question", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
     {
         foreach (Department dep in Department.GetAllDepartments())
         {
             if (dep.DepartmentId == depId)
             {
                 dep.RemoveDepartment();
             }
         }
         form.UpdateGUI();
     }
 }
コード例 #11
0
        private void BtnEdit_Click(object sender, EventArgs e)
        {
            string name         = tbxName.Text;
            string description  = rtbDescription.Text;
            int    neededpeople = Convert.ToInt32(numPeople.Value);

            foreach (Department dep in Department.GetAllDepartments())
            {
                if (dep.DepartmentId == depId)
                {
                    dep.EditDepartment(name, description, neededpeople);
                }
            }
            this.Close();
            previousForm.UpdateGUI();
        }
コード例 #12
0
        public void UpdateGUI()
        {
            departments = null;
            controls.Clear();
            flpDepartments.Controls.Clear();
            departments = Department.GetAllDepartments();

            foreach (Department d in departments)
            {
                controls.Add(new DepartmentUserControl(d.DepartmentId, d.Name, d.Description, d.NeededPeople, this));
            }

            foreach (DepartmentUserControl department in controls)
            {
                flpDepartments.Controls.Add(department);
            }
        }
コード例 #13
0
 public PromotionRequest(bool flag,int departmentId,string firstName,string lastName,decimal hourlyWage,decimal previousHourlyWage)
 {
     InitializeComponent();
     this.FormBorderStyle = FormBorderStyle.FixedSingle;
     numericHourlywage.Value = hourlyWage;
     cmbEmployee.Text = firstName + " " + lastName;
     lblCurrentWage.Text = previousHourlyWage.ToString() + "$/Hourly";
     if (flag)
     {
         this.Enabled = false;
         this.FormBorderStyle = FormBorderStyle.FixedSingle;
         List<Department> departments = Department.GetAllDepartments();
         foreach (Department d in departments)
         {
             if (d.DepartmentId == departmentId) cmbDepartment.Text = d.Name;
         }
     }
 }
コード例 #14
0
ファイル: CreateAccount.cs プロジェクト: fabestine1/MyThing
 public CreateAccount(int user_id, int workerRole)
 {
     InitializeComponent();
     this.FormBorderStyle = FormBorderStyle.FixedSingle;
     pc = new PeopleController();
     PopulateDepartments(Department.GetAllDepartments());
     this.loggedInUser = user_id;
     //dtbContractStartDate.MinDate = System.DateTime.Now;
     //dtbContractStartDate.Value = System.DateTime.Now;
     //dtpBirthdate.Value = System.DateTime.Now;
     //dtpBirthdate.MaxDate = System.DateTime.Now;
     contactCounter = 0;
     if (!addContact)
     {
         btnAddOtherContact.Enabled = false;
         btnOpenContact.Enabled     = false;
         btnDeleteContact.Enabled   = false;
     }
     this.workerRole = workerRole;
     if (workerRole == (int)ProfileRoles.ADMINISTRATOR)
     {
         btnEdit.Visible        = true;
         btnSendRequest.Visible = false;
         rbEmployee.Visible     = false;
         rbEmployee.Checked     = false;
     }
     else if (workerRole == (int)ProfileRoles.MANAGER)
     {
         btnEdit.Visible          = false;
         btnCreateAccount.Visible = false;
         rbAdmin.Visible          = false;
         rbManager.Visible        = false;
         rbEmployee.Checked       = true;
         rbEmployee.Visible       = true;
         rbEmployee.Enabled       = false;
         this.Text = "Hiring Request";
     }
     if (tbUsername.Text == "" || tbUsername.Text == "Username")
     {
         btnAssignShifts.Enabled = false;
     }
 }
コード例 #15
0
        public FiringRequest(bool flag, int departmentId, string username, string firstName, string lastName, string description)
        {
            InitializeComponent();
            this.FormBorderStyle = FormBorderStyle.FixedSingle;
            if (flag)
            {
                this.Enabled      = false;
                tbxFirstName.Text = firstName;
                tbxLastName.Text  = lastName;
                rtbReason.Text    = description;

                List <Department> departments = Department.GetAllDepartments();
                foreach (Department d in departments)
                {
                    if (d.DepartmentId == departmentId)
                    {
                        cmbDepartment.Text = d.Name;
                    }
                }
            }
        }
コード例 #16
0
 private void LoadDepartments()
 {
     PopulateDepartments(Department.GetAllDepartments(), departmentsCmbbxAddingStock);
     PopulateDepartments(Department.GetAllDepartments(), departmentAvailableCmbbx);
 }
コード例 #17
0
ファイル: SearchForWorker.cs プロジェクト: fabestine1/MyThing
 public SearchForEmployee()
 {
     InitializeComponent();
     PopulateDepartments(Department.GetAllDepartments());
 }