예제 #1
0
 private void btnLapphieunhap_Click(object sender, EventArgs e)
 {
     if (TxtMaPN.Text == "" || TxtNCC.Text == "")
     {
         MessageBox.Show("Cần nhập đầy đủ thông tin", "Thông Báo", MessageBoxButtons.OK, MessageBoxIcon.Warning);
         TxtMaPN.Focus();
     }
     else
     {
         if (PN.isExistMaPN(TxtMaPN.Text))
         {
             MessageBox.Show("Mã phiếu nhập đã tồn tại", "Thông Báo", MessageBoxButtons.OK, MessageBoxIcon.Warning);
             TxtMaPN.Focus();
         }
         else
         {
             Regex reg = new Regex(match);
             if (reg.IsMatch(this.TxtEmail.Text))
             {
                 PN.Themphieunhap(TxtMaPN.Text, CbNguoilap.Text, DTNgaylap.Value.Date, TxtNCC.Text, txtDiachi.Text, MtbSDT.Text, TxtEmail.Text);
                 Mapn = TxtMaPN.Text;
                 MessageBox.Show("Đã thêm thành công", "Thông Báo", MessageBoxButtons.OK);
                 Hien();
                 Chitietphieunhap ctpn = new Chitietphieunhap();
                 ctpn.MdiParent = this.MdiParent;
                 ctpn.Show();
                 BtnHuybo_Click(sender, e);
             }
             else
             {
                 MessageBox.Show("Email nhập vào không hợp lệ", "Thông Báo", MessageBoxButtons.OK);
             }
         }
     }
 }
예제 #2
0
        private void BtnSua_Click(object sender, EventArgs e)
        {
            DataView  dv = (DataView)DGRDanhsachphieunhap.DataSource;
            DataTable t  = dv.ToTable();

            if (TxtMaPN.Text == "" || TxtNCC.Text == "")
            {
                MessageBox.Show("Cần nhập đầy đủ thông tin", "Thông Báo", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                TxtMaPN.Focus();
            }
            else
            {
                if (PN.isExistMaPN(TxtMaPN.Text) && TxtMaPN.Text != t.Rows[DGRDanhsachphieunhap.CurrentRow.Index]["MaPN"].ToString())
                {
                    MessageBox.Show("Mã phiếu nhập đã tồn tại", "Thông Báo", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    TxtMaPN.Focus();
                }
                else
                {
                    Regex reg = new Regex(match);
                    if (reg.IsMatch(this.TxtEmail.Text))
                    {
                        int MaNCC = int.Parse(t.Rows[DGRDanhsachphieunhap.CurrentRow.Index]["MaNCC"].ToString());
                        PN.Capnhatphieunhap(TxtMaPN.Text, MaNCC, CbNguoilap.Text, DTNgaylap.Value.Date, TxtNCC.Text, txtDiachi.Text, MtbSDT.Text, TxtEmail.Text);
                        Mapn = TxtMaPN.Text;
                        Hien();
                        BtnHuybo_Click(sender, e);
                    }
                    else
                    {
                        MessageBox.Show("Email nhập vào không hợp lệ", "Thông Báo", MessageBoxButtons.OK);
                    }
                }
            }
        }
예제 #3
0
        private void Quanlynhaphang_Load(object sender, EventArgs e)
        {
            if (Dangnhap.TenQ == "Admin")
            {
                load_cbNguoilap();
            }
            else
            {
                CbNguoilap.Text    = Dangnhap.TenTK;
                CbNguoilap.Enabled = false;
            }
            TxtMaPN.Focus();
            Hien();

            this.ControlBox = false;
        }