Esempio n. 1
0
        private void SavePhieuChiTiet(int ID_PhieuXuat)
        {
            clsPhieuXuat_ChiTiet cls1 = new clsPhieuXuat_ChiTiet();

            for (int i = fgChiTietXuat.Rows.Fixed + 1; i < fgChiTietXuat.Rows.Count; i++)
            {
                if (int.Parse(fgChiTietXuat[i, "SoLuongXuat"].ToString()) != 0)
                {
                    if (Check_DB_PXCT(i))
                    {
                        cls1.ID_PhieuXuat = ID_PhieuXuat;
                        cls1.ID_VatTu     = int.Parse(fgChiTietXuat[i, "ID_VatTu"].ToString());
                        cls1.SoLuong      = int.Parse(fgChiTietXuat[i, "SoLuongXuat"].ToString());
                        cls1.Insert();
                    }
                    else
                    {
                        cls1.ID_PhieuXuat = ID_PhieuXuat;
                    }
                    cls1.ID_VatTu = int.Parse(fgChiTietXuat[i, "ID_VatTu"].ToString());
                    cls1.SoLuong  = int.Parse(fgChiTietXuat[i, "SoLuongXuat"].ToString());
                    cls1.Update();
                }
                else
                {
                    DeleteVatTuWTIndex0(ID_PhieuXuat);
                    cls1.ID_PhieuXuat = ID_PhieuXuat;
                    cls1.ID_VatTu     = int.Parse(fgChiTietXuat[i, "ID_VatTu"].ToString());
                    cls1.Delete();
                }
            }
        }
Esempio n. 2
0
        private void btnXoa_Click(object sender, System.EventArgs e)
        {
            DialogResult dg = BaseMessages.ShowQuestionMessage("Bạn có chắc chắn muốn xóa?");

            if (dg == DialogResult.Yes)
            {
                try
                {
                    clsPhieuXuat_ChiTiet cls0 = new clsPhieuXuat_ChiTiet();
                    cls0.ID_PhieuXuat = int.Parse(fgQDX[fgQDX.Row, "ID_PhieuXuat"].ToString());
                    cls0.DeleteWID_PhieuXuatLogic();
                    clsPhieuXuat_ChiTiet_TheKho cls1 = new clsPhieuXuat_ChiTiet_TheKho();
                    cls1.ID_PhieuXuat = int.Parse(fgQDX[fgQDX.Row, "ID_PhieuXuat"].ToString());
                    cls1.DeleteWID_PhieuXuatLogic();
                    clsQD_XuatVatTu cls = new clsQD_XuatVatTu();
                    cls.ID_PhieuXuat = int.Parse(fgQDX[fgQDX.Row, "ID_PhieuXuat"].ToString());
                    cls.Delete();
                    BaseMessages.ShowInformationMessage("Xóa thành công.");
                    Loadfg();
                }
                catch (Exception ex)
                {
                    BaseMessages.ShowErrorMessage("Lỗi" + ex.ToString());
                }
            }
        }
Esempio n. 3
0
        private bool Check_DB_PXCT(int i)
        {
            clsPhieuXuat_ChiTiet cls = new clsPhieuXuat_ChiTiet();

            cls.ID_PhieuXuat = m_iID_PX;
            DataTable dt = cls.SelectAllWTPX();

            foreach (DataRow dr in dt.Rows)
            {
                if (int.Parse(fgChiTietXuat[i, "ID_VatTu"].ToString()) == int.Parse(dr["ID_VatTu"].ToString()))
                {
                    return(false);
                }
            }
            return(true);
        }