public bool Create(HoaDonModel model) { string msgError = ""; try { var result = _dbHelper.ExecuteScalarSProcedureWithTransaction(out msgError, "sp_hoa_don_create", "@ID", model.ID, "@Name", model.Name, "@Email", model.Email, "@Address", model.Address, "@Phone", model.Phone, "@Total", model.Total, "@Note", model.Note, //"@DateOrder", model.DateOrder, "@listjson_chitiet", model.listjson_chitiet != null ? MessageConvert.SerializeObject(model.listjson_chitiet) : null); if ((result != null && !string.IsNullOrEmpty(result.ToString())) || !string.IsNullOrEmpty(msgError)) { throw new Exception(Convert.ToString(result) + msgError); } return(true); } catch (Exception ex) { throw ex; } }
public DonHangModel Them(DonHangModel dh) { string msgError = ""; try { var dt = _dbHelper.ExecuteSProcedureReturnDataTable(out msgError, "themdonhang", "@MaKH", dh.MaKH, "@MaShop", dh.MaShop, "@ThanhToan", dh.ThanhToan, "@MaDiaChi", dh.MaDiaChi, "@chitiet", dh.chitiet != null ? MessageConvert.SerializeObject(dh.chitiet) : null, "@TenKh", dh.TenKH, "@Email", dh.Email, "@SoDienThoai", dh.SoDienThoai, "@Xa", dh.Xa, "@Huyen", dh.Huyen, "@Tinh", dh.Tinh, "@DCChiTiet", dh.DCChitiet, "@HashedCardInformation", dh.HashedCardInformation ); if (!string.IsNullOrEmpty(msgError)) { throw new Exception(msgError); } return(dt.ConvertTo <DonHangModel>().FirstOrDefault()); } catch (Exception ex) { throw ex; } }
public bool Create(HoaDonModel model) { string msgError = ""; try { var result = _dbHelper.ExecuteScalarSProcedureWithTransaction(out msgError, "sp_hoa_don_create", "@ma_hoa_don", model.ma_hoa_don, "@ho_ten", model.ho_ten, "@dia_chi", model.dia_chi, "@sdt", model.sdt, "@total", model.total, "@listjson_chitiet", model.listjson_chitiet != null ? MessageConvert.SerializeObject(model.listjson_chitiet) : null); if ((result != null && !string.IsNullOrEmpty(result.ToString())) || !string.IsNullOrEmpty(msgError)) { throw new Exception(Convert.ToString(result) + msgError); } return(true); } catch (Exception ex) { throw ex; } }
public bool Update(HoaDonBanModel model) { string msgError = ""; try { var result = _dbHelper.ExecuteScalarSProcedureWithTransaction(out msgError, "sp_hoadonban_update", "@Mahdb", model.Mahdb, "@Makh", model.Makh, "@Ngayban", model.Ngayban, "@Hoten", model.Ngayban, "@SDT", model.Ngayban, "@Diachi", model.Ngayban, "@Tongtien", model.Tongtien, "@Thanhtoan", model.Thanhtoan, "@Ghichu", model.Ghichu, "@listjson_chitiet", model.listjson_chitiet != null ? MessageConvert.SerializeObject(model.listjson_chitiet) : null); if ((result != null && !string.IsNullOrEmpty(result.ToString())) || !string.IsNullOrEmpty(msgError)) { throw new Exception(Convert.ToString(result) + msgError); } return(true); } catch (Exception ex) { throw ex; } }
public bool Create(BillModel model) { string msgError = ""; try { var result = _dbHelper.ExecuteScalarSProcedureWithTransaction(out msgError, "sp_Bill_create", "@id", model.id, "@name", model.name, "@total", model.total, "@address", model.address, "@phone", model.phone, "@email", model.email, "@created_at", model.created_at, "@listjson_chitiet", model.listjson_chitiet != null ? MessageConvert.SerializeObject(model.listjson_chitiet) : null); if ((result != null && !string.IsNullOrEmpty(result.ToString())) || !string.IsNullOrEmpty(msgError)) { throw new Exception(Convert.ToString(result) + msgError); } return(true); } catch (Exception ex) { throw ex; } }
public HoaDonNhapModel Them(HoaDonNhapModel hdn) { string msgError = ""; try { var dt = _dbHelper.ExecuteSProcedureReturnDataTable(out msgError, "themhdn", "@mancc", hdn.MaNCC, "@mashop", hdn.MaShop, "@chitiet", hdn.chitiet != null ? MessageConvert.SerializeObject(hdn.chitiet) : null); if (!string.IsNullOrEmpty(msgError)) { throw new Exception(msgError); } return(dt.ConvertTo <HoaDonNhapModel>().FirstOrDefault()); } catch (Exception ex) { throw ex; } }
public bool Dat_Hang(string maid, string ten_kh, string noi_giao, string sdt, int thanh_tien, List <ChiTietHoaDonModel> listjson_chitiet) { string msgError = ""; try { var dt = _dbHelper.ExecuteScalarSProcedureWithTransaction(out msgError, "sp_dat_hang_2", "@ma_hoa_don", maid, "@ngay_dat", DateTime.Now, "@ngay_giao", DateTime.Now, "@tinhtrang", 0, "@makh", ten_kh, "@noi_giao", noi_giao, "@sdt", sdt, "@thanh_tien", thanh_tien, "@listjson_chitiet", listjson_chitiet != null ? MessageConvert.SerializeObject(listjson_chitiet) : null); if (!string.IsNullOrEmpty(msgError) || (!string.IsNullOrEmpty(dt.ToString()) && dt != null)) { throw new Exception(msgError); } return(true); } catch (Exception ex) { throw ex; } }
public bool Create(HoaDonModel model) { string msgError = ""; try { var result = _dbHelper.ExecuteScalarSProcedureWithTransaction(out msgError, "sp_hoa_don_create", "@order_id ", model.order_id, "@customer_id ", model.customer_id, "@order_status ", model.order_status, "@order_date ", model.order_date, "@required_date ", model.required_date, "@shipped_date ", model.shipped_date, "@store_id ", model.store_id, "@staff_id", model.staff_id, //"@DateOrder", model.DateOrder, "@listjson_chitiet", model.listjson_chitiet != null ? MessageConvert.SerializeObject(model.listjson_chitiet) : null); if ((result != null && !string.IsNullOrEmpty(result.ToString())) || !string.IsNullOrEmpty(msgError)) { throw new Exception(Convert.ToString(result) + msgError); } return(true); } catch (Exception ex) { throw ex; } }