コード例 #1
0
ファイル: LoaiTP.cs プロジェクト: Diagru25/QuanLyKho_HaDung
        private void btnXoa_Click(object sender, EventArgs e)
        {
            if (btnXoa.Text == "Xóa")
            {
                DialogResult rs = MessageBox.Show("Bạn có chắc chắn muốn xóa ?", "Thông báo", MessageBoxButtons.YesNo);
                if (rs == DialogResult.Yes)
                {
                    long Emp_ID = Convert.ToInt32(grv_LTP.GetFocusedRowCellValue("ID"));

                    bool result = new TypeProductDAO().Delete_TypeProduct(Emp_ID);
                    if (result)
                    {
                        MessageBox.Show("Xóa loại thành phẩm thành công");
                        Disable_Control();
                        Load_dgr_LTP();
                    }
                    else
                    {
                        MessageBox.Show("Có lỗi xảy ra");
                    }
                }
            }

            if (btnXoa.Text == "Hủy")
            {
                btnThem.Text = "Thêm";
                btnSua.Text  = "Sửa";
                btnXoa.Text  = "Xóa";

                Disable_Control();
                Load_dgr_LTP();
            }
        }
コード例 #2
0
ファイル: LoaiTP.cs プロジェクト: Diagru25/QuanLyKho_HaDung
        private void btnSua_Click(object sender, EventArgs e)
        {
            if (btnSua.Text == "Sửa")
            {
                btnSua.Text     = "Lưu";
                btnSua.Image    = Resources.download_32x32;
                btnXoa.Text     = "Hủy";
                btnXoa.Image    = Resources.cancel_32x32;
                btnThem.Enabled = false;

                Enable_Control();

                return;
            }

            if (btnSua.Text == "Lưu")
            {
                if (Validate())
                {
                    TypeProduct item = new TypeProduct();

                    item.ID       = Convert.ToInt32(txbMaLTP.Text);
                    item.Name     = txbTenLTP.Text;
                    item.Faculty  = txb_TacDung.Text;
                    item.Describe = txb_MoTa.Text;

                    bool result = new TypeProductDAO().Update_TypeProduct(item);

                    if (result)
                    {
                        MessageBox.Show("Sửa loại thành phẩm thành công");
                        Disable_Control();
                        Load_dgr_LTP();
                    }
                    else
                    {
                        MessageBox.Show("Sửa loại thành phẩm xảy ra lỗi");
                    }
                }
                return;
            }
        }
コード例 #3
0
ファイル: LoaiTP.cs プロジェクト: Diagru25/QuanLyKho_HaDung
        private void btnThem_Click(object sender, EventArgs e)
        {
            if (btnThem.Text == "Thêm")
            {
                btnThem.Text   = "Lưu";
                btnThem.Image  = Resources.download_32x32;
                btnXoa.Text    = "Hủy";
                btnXoa.Image   = Resources.cancel_32x32;
                btnSua.Enabled = false;

                Clear_Control();
                Enable_Control();

                return;
            }

            if (btnThem.Text == "Lưu")
            {
                if (Validate())
                {
                    TypeProduct item = new TypeProduct();

                    item.Name     = txbTenLTP.Text;
                    item.Faculty  = txb_TacDung.Text;
                    item.Describe = txb_MoTa.Text;

                    long result = new TypeProductDAO().Insert_TypeProduct(item);

                    if (result != 0)
                    {
                        MessageBox.Show("Thêm loại thành phẩm thành công");
                        Disable_Control();
                        Load_dgr_LTP();
                    }
                    else
                    {
                        MessageBox.Show("Thêm loại thành phẩm xảy ra lỗi");
                    }
                }
                return;
            }
        }
コード例 #4
0
 public static bool UpdateTypeProduct(TypeProductDTO tydr) => TypeProductDAO.UpdateTypeProduct(tydr);
コード例 #5
0
 public static bool InsertTypeProduct(TypeProductDTO tydr) => TypeProductDAO.InsertTypeProduct(tydr);
コード例 #6
0
 public static List <TypeProductDTO> GetListTypeProductWithStatusOne(int status) => TypeProductDAO.GetListTypeProductWithStatusOne(status);
コード例 #7
0
 public static List <TypeProductDTO> GetAllListTypeProduct() => TypeProductDAO.GetAllListTypeProduct();
コード例 #8
0
 public static bool DeleteTypeProduct(TypeProductDTO tydr) => TypeProductDAO.DeleteTypeProduct(tydr);