コード例 #1
0
        private void bt_TimKiem_Click(object sender, EventArgs e)
        {
            TheDocGiaService    sv = new TheDocGiaService();
            List <TheDocGiaDTO> ls = new List <TheDocGiaDTO>();

            if (cbb_ThongTinTimKiem.Text == "Họ và tên")
            {
                ls = sv.getFromTheDocGiaSearchHoTen(tb_NhapTT.Text);
                dgv_DuLieu.DataSource = ls;
            }
            else if (cbb_ThongTinTimKiem.Text == "Email")
            {
                ls = sv.getFromTheDocGiaSearchEmaiLDG(tb_NhapTT.Text);
                dgv_DuLieu.DataSource = ls;
            }
            else if (cbb_ThongTinTimKiem.Text == "Địa chỉ")
            {
                ls = sv.getFormTheDocGiaSearchDiaChiDG(tb_NhapTT.Text);
                dgv_DuLieu.DataSource = ls;
            }
            else if (cbb_ThongTinTimKiem.Text == "Tài khoản")
            {
                ls = sv.getFormTheDocGiaSearchUserName(tb_NhapTT.Text);
                dgv_DuLieu.DataSource = ls;
            }
        }
コード例 #2
0
        //get All data from Table dbo.TheDocGia
        public void fillAllDataFromTableTheDocGia()
        {
            List <TheDocGiaDTO> ls    = new List <TheDocGiaDTO>();
            TheDocGiaService    TDGsv = new TheDocGiaService();

            ls = TDGsv.getAllDocGiaAndUser();
            dgv_DuLieu.DataSource = ls;
        }
コード例 #3
0
 private void bt_CNDL_Click(object sender, EventArgs e)
 {
     if (string.IsNullOrEmpty(tb_HoTenDG.Text))
     {
         MessageBox.Show("Không được để trống họ tên độc giả.", "Chú ý", MessageBoxButtons.OK, MessageBoxIcon.Warning); tb_HoTenDG.Focus();
     }
     else if (string.IsNullOrEmpty(tb_User.Text))
     {
         MessageBox.Show("Không được để trống Tài khoản.", "Chú ý", MessageBoxButtons.OK, MessageBoxIcon.Warning); tb_User.Focus();
     }
     else if (string.IsNullOrEmpty(tb_Passwork.Text))
     {
         MessageBox.Show("Không được để trống Passwork.", "Chú ý", MessageBoxButtons.OK, MessageBoxIcon.Warning); tb_Passwork.Focus();
     }
     else if (string.IsNullOrEmpty(tb_Diachi.Text))
     {
         MessageBox.Show("Không được để trống địa chỉ.", "Chú ý", MessageBoxButtons.OK, MessageBoxIcon.Warning); tb_Diachi.Focus();
     }
     else if (string.IsNullOrEmpty(tb_Email.Text))
     {
         MessageBox.Show("Không được để trống Email.", "Chú ý", MessageBoxButtons.OK, MessageBoxIcon.Warning); tb_Email.Focus();
     }
     else if (HelperGUI.Instance.checkIsMail(tb_Email) == false)
     {
         MessageBox.Show("Email không hợp lệ", "Chú ý", MessageBoxButtons.OK, MessageBoxIcon.Warning); tb_Email.Focus();
     }
     else if (string.IsNullOrEmpty(cb_LoaiDocGia.Text))
     {
         MessageBox.Show("Không được để trống loại độc giả.", "Chú ý", MessageBoxButtons.OK, MessageBoxIcon.Warning); cb_LoaiDocGia.Focus();
     }
     else
     {
         try
         {
             TheDocGiaService sv   = new TheDocGiaService();
             TheDocGiaDtos    tdg  = new TheDocGiaDtos();
             UserDtos         user = new UserDtos();
             HoTenDG          = HelperGUI.Instance.KiemTraHoTen(tb_HoTenDG.Text);
             UserName         = tb_User.Text;
             Pwd              = tb_Passwork.Text;
             DiaChiDG         = tb_Diachi.Text;
             EmailDG          = tb_Email.Text;
             NgayLapThe       = dt_NgayLT.Value;
             tdg.HoTenDG      = HoTenDG;
             tdg.IDLoaiDocGia = IDLoaiDG;
             tdg.NgayLapThe   = NgayLapThe;
             tdg.NgaySinhDG   = NgaySinhDG;
             tdg.DiaChiDG     = DiaChiDG;
             tdg.EmailDG      = EmailDG;
             user.Password    = Pwd;
             user.UserName    = UserName;
             sv.AddTheDocGiaAndUser(tdg, user);
             MessageBox.Show("Thêm thành công!");
             fillAllDataFromTableTheDocGia();
             HelperGUI.ResetAllControls(groupControl_TTDG);
         }
         catch
         {
         }
     }
 }