Ejemplo n.º 1
0
 private void bt_CNDL_Click(object sender, EventArgs e)
 {
     if (string.IsNullOrEmpty(tb_TenTacGia.Text))
     {
         MessageBox.Show("Không được để trống thể loại sách.", "Chú ý", MessageBoxButtons.OK, MessageBoxIcon.Warning); tb_TenTacGia.Focus();
     }
     else
     {
         try
         {
             TacGiaService sv  = new TacGiaService();
             TacGiaDtos    tdg = new TacGiaDtos();
             TenTacGia     = HelperGUI.Instance.KiemTraHoTen(tb_TenTacGia.Text);
             NgaySinh      = dt_NgaySinh.Value;
             tdg.TenTacGia = TenTacGia;
             tdg.NgaySinh  = NgaySinh;
             sv.AddFormTacGia(tdg);
             MessageBox.Show("Thêm thành công!");
             HelperGUI.ResetAllControls(groupControl_ThemTacGia);
         }
         catch
         {
         }
     }
 }
Ejemplo n.º 2
0
        private void bt_CNDL_Click(object sender, EventArgs e)
        {
            TacGiaService sv  = new TacGiaService();
            TacGiaDtos    tdg = new TacGiaDtos();

            TenTacGia     = HelperGUI.Instance.KiemTraHoTen(tb_TenTacGia.Text);
            NgaySinh      = dt_NgaySinh.Value;
            tdg.TenTacGia = TenTacGia;
            tdg.NgaySinh  = NgaySinh;
            sv.AddFormTacGia(tdg);
            MessageBox.Show("Thêm thành công!");
            fillAllDataFromTableTacGia();
            HelperGUI.ResetAllControls(groupControl_TTTG);
        }
Ejemplo n.º 3
0
 private void bt_CNDL_Click(object sender, EventArgs e)
 {
     if (string.IsNullOrEmpty(tb_ThemTheLoaiSach.Text))
     {
         MessageBox.Show("Không được để trống thể loại sách.", "Chú ý", MessageBoxButtons.OK, MessageBoxIcon.Warning); tb_ThemTheLoaiSach.Focus();
     }
     else
     {
         try
         {
             LoaiSachService sv  = new LoaiSachService();
             LoaiSachDtos    tdg = new LoaiSachDtos();
             TenLoaiSach     = tb_ThemTheLoaiSach.Text;
             tdg.TenLoaiSach = TenLoaiSach;
             sv.AddFromLoaiSach(tdg);
             MessageBox.Show("Thêm thành công");
             HelperGUI.ResetAllControls(groupControl_ThemTheLoai);
         }
         catch
         {
         }
     }
 }
Ejemplo n.º 4
0
 private void bt_Lamlai_Click(object sender, EventArgs e)
 {
     HelperGUI.ResetAllControls(groupControl_TTTG);
 }
Ejemplo n.º 5
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
         {
         }
     }
 }
Ejemplo n.º 6
0
 private void bt_Lamlai_Click(object sender, EventArgs e)
 {
     HelperGUI.ResetAllControls(groupControl_TTPM);
     listbox_TenDauSach.Items.Clear();
 }
Ejemplo n.º 7
0
        private void bt_CNDL_Click(object sender, EventArgs e)
        {
            if (string.IsNullOrEmpty(tb_TenDauSach.Text))
            {
                MessageBox.Show("Không được để trống tên đầu sách.", "Chú ý", MessageBoxButtons.OK, MessageBoxIcon.Warning); tb_TenDauSach.Focus();
            }
            else if (string.IsNullOrEmpty(cbb_TheLoaiSach.Text))
            {
                MessageBox.Show("Không được để trống thể loại sách.", "Chú ý", MessageBoxButtons.OK, MessageBoxIcon.Warning); cbb_TheLoaiSach.Focus();
            }
            else if (string.IsNullOrEmpty(tb_TenTacGia.Text))
            {
                MessageBox.Show("Không được để trống tên tác giả.", "Chú ý", MessageBoxButtons.OK, MessageBoxIcon.Warning); tb_TenTacGia.Focus();
            }
            else if (string.IsNullOrEmpty(tb_NhaXuatBan.Text))
            {
                MessageBox.Show("Không được để trống nhà xuất bản.", "Chú ý", MessageBoxButtons.OK, MessageBoxIcon.Warning); tb_NhaXuatBan.Focus();
            }
            else if (string.IsNullOrEmpty(tb_NamXuatBan.Text))
            {
                MessageBox.Show("Không được để trống năm xuất bản.", "Chú ý", MessageBoxButtons.OK, MessageBoxIcon.Warning); tb_NamXuatBan.Focus();
            }
            else if (string.IsNullOrEmpty(tb_GiaTien.Text))
            {
                MessageBox.Show("Không được để trống giá tiền", "Chú ý", MessageBoxButtons.OK, MessageBoxIcon.Warning); tb_GiaTien.Focus();
            }
            else if (string.IsNullOrEmpty(tb_SoLuong.Text))
            {
                MessageBox.Show("Không được để trống số lượng.", "Chú ý", MessageBoxButtons.OK, MessageBoxIcon.Warning); tb_SoLuong.Focus();
            }
            else if (string.IsNullOrEmpty(tb_DonGia.Text))
            {
                MessageBox.Show("Không được để trống đơn giá.", "Chú ý", MessageBoxButtons.OK, MessageBoxIcon.Warning); tb_DonGia.Focus();
            }
            else
            {
                try
                {
                    SachService sv = new SachService();
                    SachDTO     s  = new SachDTO();

                    TenDauSach    = tb_TenDauSach.Text;
                    TenLoaiSach   = cbb_TheLoaiSach.Text;
                    TenTG         = tb_TenTacGia.Text;
                    NhaXB         = tb_NhaXuatBan.Text;
                    NamXB         = Int32.Parse(tb_NamXuatBan.Text);
                    GiaTien       = HelperGUI.Instance.checkMoney(GiaTien, tb_GiaTien);
                    SoLuong       = Int32.Parse(tb_SoLuong.Text);
                    DonGia        = HelperGUI.Instance.checkMoney(DonGia, tb_DonGia);
                    NgayNhap      = dt_NgayNhap.Value;
                    s.IDTacGia    = IDTacGia;
                    s.IDSach      = IDSach;
                    s.TenTG       = TenTG;
                    s.IDDauSach   = IDDauSach;
                    s.NamXB       = NamXB;
                    s.NhaXB       = NhaXB;
                    s.GiaTien     = GiaTien;
                    s.DonGia      = DonGia;
                    s.SoLuong     = SoLuong;
                    s.TenDauSach  = TenDauSach;
                    s.TenLoaiSach = TenLoaiSach;
                    s.NgayNhap    = NgayNhap;
                    sv.ADDFormSach(s);
                    MessageBox.Show("Thêm thành công!");
                    fillTheLoaiSachDataFromTableSach();
                    HelperGUI.ResetAllControls(groupControl_TTS);
                }
                catch
                {
                }
            }
        }