コード例 #1
0
        //thêm
        //    int index = e.RowIndex;
        //    tbxmssv1.Text = dGVdsphieudangky["Column5", index].Value.ToString();
        //    tbxmapdk.Text = dGVdsphieudangky["Column1", index].Value.ToString();
        //    tbxmaquyenda.Text = dGVdsphieudangky["Column2", index].Value.ToString();

        //    dtpngaydkdt.Text = dGVdsphieudangky["Column4", index].Value.ToString();
        //    tbxmadt.Text = dGVdsphieudangky["Column3", index].Value.ToString();


        private void btnthem_Click(object sender, EventArgs e)
        {
            try
            {
                PhieuPhanCong PPC = new PhieuPhanCong();
                PPC.MaPhieuPC = tbxmaphieuphancong.Text.Trim();
                PPC.NgayPC    = dtpngayphancong.Value;
                PPC.MaGV      = tbxmaGV.Text.Trim();
                PPC.MaQuyenDA = tbxmaquyendoan.Text.Trim();
                PPC.MaChucVu  = tbxmachucvu.Text.Trim();
                PhieuPhanCongBLL PPCBLL = new PhieuPhanCongBLL();

                string _MaPhieuPC = tbxmaphieuphancong.Text.Trim();
                if (!(PPCBLL.CheckID(_MaPhieuPC)))
                {
                    PPCBLL.Insert(PPC);
                    LoadData();
                }
                else
                {
                    MessageBox.Show("Mã phieu phan cong " + _MaPhieuPC.ToString() + "đã tồn tại", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                }
            }

            catch (Exception ex)
            {
                MessageBox.Show("Thêm bị lỗi: " + ex.Message.ToString(), "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Warning);
            }
        }
コード例 #2
0
 private void btnxoa_Click(object sender, EventArgs e)
 {
     try
     {
         string           _MaPhieuPC = tbxmaphieuphancong.Text.Trim();
         PhieuPhanCongBLL PPCBLL     = new PhieuPhanCongBLL();
         PPCBLL.Delete(_MaPhieuPC);
         LoadData();
     }
     catch (Exception ex)
     {
         MessageBox.Show("Xóa bị lỗi: " + ex.Message.ToString(), "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Warning);
     }
 }
コード例 #3
0
        private void btncapnhat_Click(object sender, EventArgs e)
        {
            try
            {
                PhieuPhanCong PPC = new PhieuPhanCong();
                PPC.MaPhieuPC = tbxmaphieuphancong.Text.Trim();
                PPC.NgayPC    = dtpngayphancong.Value;
                PPC.MaGV      = tbxmaGV.Text.Trim();
                PPC.MaQuyenDA = tbxmaquyendoan.Text.Trim();
                PPC.MaChucVu  = tbxmachucvu.Text.Trim();

                PhieuPhanCongBLL PPCBLL = new PhieuPhanCongBLL();

                string _MaPhieuPC = tbxmaphieuphancong.Text.Trim();
                PPCBLL.Update(PPC);
                LoadData();
            }
            catch (Exception ex)
            {
                MessageBox.Show("Sửa bị lỗi: " + ex.Message.ToString(), "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Warning);
            }
        }
コード例 #4
0
        private void LoadData()
        {
            PhieuPhanCongBLL PPC = new PhieuPhanCongBLL();

            dGVdsphieupc.DataSource = PPC.GetData();
        }
コード例 #5
0
        private void LoadData()
        {
            PhieuPhanCongBLL PPCBLL = new PhieuPhanCongBLL();

            dGVdsPPC.DataSource = PPCBLL.GetData();
        }