Esempio n. 1
0
 private void load_department()
 {
     department               = new classes.Department();
     cbLocation.DataSource    = department.select_all_department();
     cbLocation.DisplayMember = "department_name";
     cbLocation.ValueMember   = "id";
 }
Esempio n. 2
0
 private void btnSave_Click(object sender, EventArgs e)
 {
     if (string.IsNullOrEmpty(txtDepartmentName.Text))
     {
         MessageBox.Show("Please indicate the department name.", "Add Department", MessageBoxButtons.OK, MessageBoxIcon.Error);
         txtDepartmentName.Focus();
         return;
     }
     else
     {
         if (new classes.Configuration().CheckIfExist("department_name", "Department", txtDepartmentName.Text))
         {
             MessageBox.Show(txtDepartmentName.Text + " is already exist.", "Add Department", MessageBoxButtons.OK, MessageBoxIcon.Error);
             txtDepartmentName.Focus();
             txtDepartmentName.Text = "";
             return;
         }
         else
         {
             department = new classes.Department();
             department.department_name = txtDepartmentName.Text;
             department.add_department();
             MessageBox.Show(txtDepartmentName.Text + " has been added.", "Add Department", MessageBoxButtons.OK, MessageBoxIcon.Information);
             if (request_from == "Add Employee")
             {
                 wf.admin.mu.frmAddEmployee.instance.display_data();
             }
             else
             {
                 frmViewDepartment.instance.display_department_data();
             }
             this.Close();
         }
     }
 }
 private void display_department()
 {
     department = new classes.Department();
     cbDepartment.DataSource    = department.select_all_department();
     cbDepartment.DisplayMember = "department_name";
     cbDepartment.ValueMember   = "id";
 }
Esempio n. 4
0
 private void update_department()
 {
     department = new classes.Department();
     if (department.update_inventory_department(inventory_id, Convert.ToInt32(cbDepartment.SelectedValue)))
     {
         MessageBox.Show("Department has been updated!", "Update Department", MessageBoxButtons.OK, MessageBoxIcon.Question);
         frmViewItem.instance.display_selected_inventory(inventory_id);
         this.Close();
     }
 }
Esempio n. 5
0
        public void display_selected_department()
        {
            txtCurrentDepartment.Text = department_name.ToString();

            department = new classes.Department();
            cbDepartment.DataSource    = department.select_inventory_department_except_this(department_id);
            cbDepartment.DisplayMember = "department_name";
            cbDepartment.ValueMember   = "id";
            cbDepartment.SelectedIndex = 0;
        }
Esempio n. 6
0
        public void display_department_data()
        {
            dprtmnt = new classes.Department();
            dgvDepartment.DataSource          = dprtmnt.select_department_table();
            dgvDepartment.AutoGenerateColumns = false;

            if (dgvDepartment.Columns.Contains("action") && dgvDepartment.Columns["action"].Visible)
            {
            }
            else
            {
                DataGridViewButtonColumn button = new DataGridViewButtonColumn();
                {
                    button.Name       = "action";
                    button.HeaderText = "Action";
                    button.Text       = "Update";
                    button.UseColumnTextForButtonValue = true;
                    this.dgvDepartment.Columns.Add(button);
                }
            }
        }
Esempio n. 7
0
        private void btnFinish_Click(object sender, EventArgs e)
        {
            hasError = false;
            if (string.IsNullOrEmpty(txtLocation.Text) || txtLocation.Text == "Location")
            {
                hasError = true;
                MessageBox.Show("Please indicate the location you want to install this application.", "Setup", MessageBoxButtons.OK, MessageBoxIcon.Error);
                txtLocation.Focus();
            }
            else
            {
                if (string.IsNullOrEmpty(txtUsername.Text) || txtUsername.Text == "Username")
                {
                    hasError = true;
                    MessageBox.Show("Please indicate the username of this machine.", "Setup", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    txtUsername.Focus();
                }
                else
                {
                    if (string.IsNullOrEmpty(txtPassword.Text) || txtPassword.Text == "Password")
                    {
                        hasError = true;
                        MessageBox.Show("Please indicate the password of this machine.", "Setup", MessageBoxButtons.OK, MessageBoxIcon.Error);
                        txtPassword.Focus();
                    }
                    else
                    {
                        if (hasError == true)
                        {
                            MessageBox.Show("We cannot process your request at this time. Please try again later.", "Setup", MessageBoxButtons.OK, MessageBoxIcon.Error);
                            return;
                        }
                        else
                        {
                            department = new classes.Department();
                            department.department_name = txtLocation.Text;

                            if (department.select_department())
                            {
                                MessageBox.Show("The server is already installed in this department.", "Setup", MessageBoxButtons.OK, MessageBoxIcon.Error);
                                txtLocation.Text = "";
                                txtLocation.Focus();
                                return;
                            }
                            else
                            {
                                department.add_department();

                                setup = new classes.Setup();
                                setup.machine_name  = txtMachineName.Text;
                                setup.ip_address    = txtIPAddress.Text;
                                setup.mac_address   = txtMACAddress.Text;
                                setup.username      = txtUsername.Text;
                                setup.password      = txtPassword.Text;
                                setup.department_id = department.select_department_id();

                                setup.port   = 8888;
                                setup.status = "Idle";
                                setup.type   = "Server";

                                if (setup.select_machine_name())
                                {
                                    MessageBox.Show("This machine is already installed.", "Setup", MessageBoxButtons.OK, MessageBoxIcon.Error);
                                    return;
                                }
                                else
                                {
                                    if (setup.select_ip_address())
                                    {
                                        MessageBox.Show("The ip address is been using by another computer. To avoid conflict, please change your ip address.", "Setup", MessageBoxButtons.OK, MessageBoxIcon.Error);
                                        return;
                                    }
                                    else
                                    {
                                        setup.add_local_account_information();
                                        setup.add_machine_information();
                                        setup.add_computer_unit();
                                        MessageBox.Show("Server has been set-up!", "Setup", MessageBoxButtons.OK, MessageBoxIcon.Information);
                                        setup.add_directory();
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }