Exemplo n.º 1
0
 public void AddData(clsThuNoKhachHang thuNoKhachHang)
 {
     if (!_mdlThuNoKhachHang.AddData(thuNoKhachHang))
     {
         MessageBox.Show("Thêm thu nợ hóa đơn lỗi", "Thêm thu nợ hóa đơn", MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
 }
Exemplo n.º 2
0
        ConnectToSQL _conn = new ConnectToSQL();              //Initialize connectoSQl class

        public bool AddData(clsThuNoKhachHang thuNoKhachHang) //Không add idPhieNhap tại đây
        {
            _conn.CMD.CommandText = String.Format("INSERT [dbo].[tbThuNoKhachHang] (idKhachHang,NgayThu,SoTien,idHoaDon,"
                                                  + "GhiChu,idNhanVien,idCuaHang,SoPhieu,idPhieuNhap) "
                                                  + "VALUES (N'{0}',cast(N'{1}' as datetime),N'{2}',{3},N'{4}',N'{5}',N'{6}',N'{7}',{8})"
                                                  , thuNoKhachHang.IdKhachHang
                                                  , thuNoKhachHang.NgayThu.ToString("yyyy-MM-dd hh:mm:ss.FFF")
                                                  , thuNoKhachHang.SoTien
                                                  , (thuNoKhachHang.IdHoaDon != 0) ? "'" + thuNoKhachHang.IdHoaDon.ToString() + "'" : "null"
                                                  , thuNoKhachHang.GhiChu
                                                  , thuNoKhachHang.IdNhanVien
                                                  , thuNoKhachHang.IdCuaHang
                                                  , thuNoKhachHang.SoPhieu
                                                  , (thuNoKhachHang.IdPhieuNhap != 0) ? "'" + thuNoKhachHang.IdPhieuNhap.ToString() + "'" : "null"
                                                  );

            return(_conn.ExecuteCMD());
        }