Пример #1
0
 string disEmpName(string empID)
 {
     string empName = null;
     EMPLOYEEs emp = new EMPLOYEEs();
     DataTable dt = new DataTable();
     dt = emp.getEmployeebyID(empID);
     empName = dt.Rows[0][3].ToString() + " " + dt.Rows[0][4].ToString();
     return empName;
 }
Пример #2
0
        public void loadDGVPT(DataGridView dgv, string id)
        {
            dgv.RowTemplate.Height = 50;
            dgv.AutoResizeColumns(DataGridViewAutoSizeColumnsMode.AllCells);
            dgv.AllowUserToAddRows = false;
            dgv.EditMode           = DataGridViewEditMode.EditProgrammatically;

            EMPLOYEEs ser = new EMPLOYEEs();
            DataTable dt  = new DataTable();

            dt             = ser.getPTbyMemID(id);
            dgv.DataSource = dt;
            dgv.Refresh();
        }
Пример #3
0
        void addNewEmp()
        {
            EMPLOYEEs emp     = new EMPLOYEEs();
            string    groupid = txtGroupID.Text.Trim();
            string    empID   = txtUsername.Text.Trim();
            string    Fname   = txtFname.Text.Trim();
            string    Lname   = txtLname.Text.Trim();
            DateTime  bdate   = dateTimePickerBdate.Value;
            string    Add     = txtAddress.Text.TrimEnd();
            string    Gen     = GenderCheck;
            string    phone   = "";

            if (IsNumber(txtPhone.Text) && (txtPhone.Text != null) && (txtPhone.Text).Length == 10)
            {
                phone = txtPhone.Text.ToString();
            }
            else
            {
                MessageBox.Show("Vui lòng nhập đúng số điện thoại");
            }

            int IDcard = 0;

            try
            {
                if (IsNumber(txtIDCard.Text) && (txtIDCard.Text != null) && (txtIDCard.Text).Length == 10)
                {
                    IDcard = Convert.ToInt32(txtIDCard.Text.TrimEnd());
                }
                else
                {
                    MessageBox.Show("Vui lòng nhập đúng CMND");
                }
            }
            catch (Exception) { }

            int sal = 0;

            try
            {
                if (IsNumber(txtSalary.Text) && txtSalary.Text != null)
                {
                    sal = Convert.ToInt32(txtSalary.Text.TrimEnd());
                }
                else
                {
                    MessageBox.Show("Please insert the Salary");
                }
            }
            catch (Exception) { }

            if (verif())
            {
                MemoryStream picture = new MemoryStream();
                try
                {
                    picAvaEdit.Image.Save(picture, picAvaEdit.Image.RawFormat);
                }
                catch (Exception Exc)
                {
                    MessageBox.Show("Please insert an Avatar");
                }
                if (emp.insertEmployee(empID, groupid, picture, Fname, Lname, bdate, Add, Gen, phone, sal, IDcard) && addAccount())
                {
                    MessageBox.Show("New Employee has been Created!");
                }
                else
                {
                    MessageBox.Show("Please insert information!", "Warning", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                }
            }
        } // Insert nhan vien moi