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);
         }
     }
 }
Esempio n. 2
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);
                }

            }
        }