コード例 #1
0
        private void btn_luu_Click(object sender, EventArgs e)
        {
            if (txt_ho.Text == "" || txt_ten.Text == "" ||
                cbo_gioiTinh.Text == "" || dt_ngaySinh.EditValue == null || dt_ngayLamViec.EditValue == null ||
                txt_email.Text == "" || txt_sdt.Text == "" || txt_diaChi.Text == "")
            {
                XtraMessageBox.Show("Chưa điền đầy đủ thông tin!!", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Warning);
            }
            else
            {
                if (gvDTO != null)
                {
                    GetDetail();

                    int kq = gvBUS.UpdateGV(gvDTO);
                    if (kq == 1)
                    {
                        XtraMessageBox.Show(string.Format("Sửa giáo viên mã {0} thành công!", gvDTO.MaNV), "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Information);
                        ucQLNV_GiaoVien.LoadDSNV_GV();
                        this.Close();
                    }
                    else
                    {
                        XtraMessageBox.Show("Sửa không thành công", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    }
                }
            }
        }
コード例 #2
0
 private void btn_qlnv_gv_LinkClicked(object sender, DevExpress.XtraNavBar.NavBarLinkEventArgs e)
 {
     Loading.ShowLoading();
     ShowForm(ucQLGV);
     ucQLGV.LoadDSNV_GV();
     Loading.HideLoading();
 }
コード例 #3
0
        private void btn_luu_Click(object sender, EventArgs e)
        {
            if (txt_ho.Text == "" || txt_ten.Text == "" ||
                cbo_gioiTinh.Text == "" || dt_ngaySinh.EditValue == null || dt_ngayLamViec.EditValue == null ||
                txt_email.Text == "" || txt_sdt.Text == "" || txt_diaChi.Text == "")
            {
                XtraMessageBox.Show("Chưa điền đầy đủ thông tin!!", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Warning);
            }
            else
            {
                if (dt_ngaySinh.DateTime.Year >= DateTime.Now.Year)
                {
                    XtraMessageBox.Show("Năm sinh không được lớn hơn hoặc bằng năm hiện tại!!", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                }
                else
                {
                    if (dt_ngayLamViec.DateTime < DateTime.Now)
                    {
                        XtraMessageBox.Show("Ngày bắt đầu làm việc không được nhỏ hơn ngày hiện tại!!", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    }
                    else
                    {
                        if (txt_sdt.Text.Length < 10)
                        {
                            XtraMessageBox.Show("Số điện thoại phải đủ 10 số!!", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                        }
                        else
                        {
                            if (!txt_sdt.Text.StartsWith("0"))
                            {
                                XtraMessageBox.Show("Số điện thoại phải bắt đầu bằng số 0!!", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                            }
                            else
                            {
                                if (Utilities.IsValidEmail(txt_email.Text.Trim()) == false)
                                {
                                    XtraMessageBox.Show("Địa chỉ email sai định dạng!!", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                                }
                                else
                                {
                                    if (gvDTO != null)
                                    {
                                        GetDetail();

                                        int kq = gvBUS.AddGV(gvDTO);
                                        if (kq == 1)
                                        {
                                            XtraMessageBox.Show(string.Format("Thêm giáo viên mã {0} thành công!", gvDTO.MaNV), "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Information);
                                            ucQLNV_GiaoVien.LoadDSNV_GV();
                                            RefreshTextBox();
                                        }
                                        else
                                        {
                                            XtraMessageBox.Show("Thêm không thành công", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                                            gvDTO = null;
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }