private void InsertCTPhieuThu(int ma)
 {
     Info.CTPHIEUTHU info = new Info.CTPHIEUTHU();
     if (rdKH.Checked == true)
     {
         for (int i = 0; i < lvThu.Items.Count; i++)
         {
             try
             {
                 info = SetInfoCTPIEUTHU(ma, lvThu.Items[i].SubItems[1].Text, float.Parse(lvThu.Items[i].SubItems[2].Text));
                 BLL.TPhieuThu tPhieuThu = new BLL.TPhieuThu();
                 tPhieuThu.InsertCT_PHIEUTHU(info);
             }
             catch (Exception ex)
             {
                 TLog.WriteErr("frmPHIEUTHU_InsertCTPhieuThu", ex.Message + "|" + ex.StackTrace);
             }
         }
     }
     else
     {
         try
         {
             info = SetInfoCTPIEUTHU(ma, DBNull.Value.ToString(), float.Parse(txtTongTien.Text));
             BLL.TPhieuThu tPhieuThu = new BLL.TPhieuThu();
             tPhieuThu.InsertCT_PHIEUTHU(info);
         }
         catch (Exception ex)
         {
             TLog.WriteErr("frmPHIEUTHU_InsertCTPhieuThu", ex.Message + "|" + ex.StackTrace);
         }
     }
 }
 public Info.CTPHIEUTHU SetInfoCTPIEUTHU(int ma, string maHD, float Tien)
 {
     Info.CTPHIEUTHU info = new Info.CTPHIEUTHU {
     };
     info.MaPhieu  = ma;
     info.MaHDXuat = maHD;
     info.Tien     = Tien;
     return(info);
 }
Example #3
0
        private void InsertCTPhieuThu(int ma)
        {
            Info.CTPHIEUTHU info = new Info.CTPHIEUTHU();
            if (rdKH.Checked == true)
            {
                for (int i = 0; i < lvThu.Items.Count; i++)
                {
                    try
                    {
                        info = SetInfoCTPIEUTHU(ma, lvThu.Items[i].SubItems[1].Text, float.Parse(lvThu.Items[i].SubItems[2].Text));
                        BLL.TPhieuThu tPhieuThu = new BLL.TPhieuThu();
                         tPhieuThu.InsertCT_PHIEUTHU(info);

                    }
                    catch (Exception ex)
                    {
                        TLog.WriteErr("frmPHIEUTHU_InsertCTPhieuThu", ex.Message + "|" + ex.StackTrace);
                    }

                }
            }
            else {
                try
                {
                    info = SetInfoCTPIEUTHU(ma, DBNull.Value.ToString(), float.Parse(txtTongTien.Text));
                    BLL.TPhieuThu tPhieuThu = new BLL.TPhieuThu();
                   tPhieuThu.InsertCT_PHIEUTHU(info);
                }
                catch (Exception ex)
                {
                    TLog.WriteErr("frmPHIEUTHU_InsertCTPhieuThu", ex.Message + "|" + ex.StackTrace);
                }

            }
        }
Example #4
0
 public Info.CTPHIEUTHU SetInfoCTPIEUTHU(int ma,string maHD, float Tien)
 {
     Info.CTPHIEUTHU info = new Info.CTPHIEUTHU { };
     info.MaPhieu = ma;
     info.MaHDXuat=maHD;
     info.Tien = Tien;
     return info;
 }