/// <summary> /// Updete theo khóa chính /// </summary> /// <param name="product">New Product</param> /// <returns>Number or row with was updated</returns> public static bool Update(Product product) { object rs = DataProvider.Instance.ExecuteNonQuery("Products_Update", product._ProductID, product._ProductName, product._SupplierID, product._QuantityPerUnit, product._UnitPrice, product._UnitsInStock, product._UnitsOnOrder, product._Discontinued); return(MyConvert.ToInt32(rs) > 0); }
/// <summary> /// Thêm một sản phẩm mới vào csdl /// </summary> /// <param name="product">New Product</param> /// <returns>ProductID</returns> public static int Add(Product product) { object rs = DataProvider.Instance.ExecuteNonQueryWithOutput("@ProductID", "Products_Add", 0, product._ProductName, product._SupplierID, product._QuantityPerUnit, product._UnitPrice, product._UnitsInStock, product._UnitsOnOrder, product._Discontinued); return(MyConvert.ToInt32(rs)); }
public static bool Update(KhachHang kh) { object rs = DataProvider.Instance.ExecuteNonQuery("KhachHang_UPDATE", kh.ID, kh.Ho, kh.Ten, kh.NgaySinh, kh.GTinh, kh.SoDT, kh.SoTaiKhoan, kh.DiaChi, kh.ThanhPho, kh.QuocGia); return(MyConvert.ToInt32(rs) > 0); }
public static string NewBestID() { List <HuongDanVien> list = HuongDanVien.All(); if (list.Count > 0) { string id = list[list.Count - 1].ID; string[] s = id.Split('V'); id = s[1]; int newMaSo = MyConvert.ToInt32(id) + 1; if (newMaSo >= 99999) { MessageBox.Show("Cạn kho mã số cho hướng dẫn viên!", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); return(""); } id = newMaSo.ToString(); while (id.Length < 4) { id = "0" + id; } id = "HDV" + id; return(id); } return("HDV0000"); }
/// <summary> /// Thêm mới một orderDetails vào csdl /// </summary> /// <param name="orderDetail">New OrderDetail</param> public static int Add(OrderDetail orderDetail) { object rs = DataProvider.Instance.ExecuteNonQuery("[Order Details_Add]", orderDetail._OrderID, orderDetail._ProductID, orderDetail._UnitPrice, orderDetail._Quantity, orderDetail.Discount); int affected = MyConvert.ToInt32(rs); return(affected); }
/// <summary> /// Thêm mới một nhà cung cấp /// </summary> /// <param name="supplier">New Supplier</param> /// <returns>SupplierID</returns> public static int Add(Supplier supplier) { object rs = DataProvider.Instance.ExecuteNonQueryWithOutput("@SupplierID", "Suppliers_Add", 0, supplier._CompanyName, supplier._ContactName, supplier._ContactTitle, supplier._Address, supplier._City, supplier._Region, supplier._PostalCode, supplier._Country, supplier._Phone, supplier._Fax, supplier._HomePage); return(MyConvert.ToInt32(rs)); }
/// <summary> /// Cập nhật thông tin một nhà cung cấp /// </summary> /// <param name="supplier">New Supplier</param> /// <returns>Số dòng được update</returns> public static bool Update(Supplier supplier) { object rs = DataProvider.Instance.ExecuteNonQuery("Suppliers_Update", supplier._SupplierID, supplier._CompanyName, supplier._ContactName, supplier._ContactTitle, supplier._Address, supplier._City, supplier._Region, supplier._PostalCode, supplier._Country, supplier._Phone, supplier._Fax, supplier._HomePage); return(MyConvert.ToInt32(rs) > 0); }
public static OrderDetail GetDataOrderDetailToExcel(OleDbDataReader reader) { OrderDetail odd = new OrderDetail(); odd.OrderID = MyConvert.ToInt32(reader["OrderID"]); odd.ProductID = MyConvert.ToInt32(reader["ProductID"]); odd.UnitPrice = MyConvert.ToDouble(reader["UnitPrice"]); odd.Quantity = MyConvert.ToInt16(reader["Quantity"]); odd.Discount = MyConvert.ToInt32(reader["Discount"]); return(odd); }
public static bool Delete(int _id) { object rs = DataProvider.Instance.ExecuteNonQuery("KhachSan_Delete", _id); int affected = MyConvert.ToInt32(rs); if (affected > 0) { return(true); } return(false); }
public static bool Update(KhachSan ks) { object rs = DataProvider.Instance.ExecuteNonQuery("KhachSan_Update", ks.ID, ks.TenKS, ks.SoSao, ks.DiaChi, ks.SoDienThoai); int affected = MyConvert.ToInt32(rs); if (affected > 0) { return(true); } return(false); }
public static bool Update(DiaDiemDL dd) { object rs = DataProvider.Instance.ExecuteNonQuery("DiaDiem_Update", dd.ID, dd.TenDD, dd.QuocGia); int affected = MyConvert.ToInt32(rs); if (affected > 0) { return(true); } return(false); }
public static bool Add(DiaDiemDL dd) { object rs = DataProvider.Instance.ExecuteNonQueryWithOutput("@ID", "DiaDiem_Add", dd.ID, dd.TenDD, dd.QuocGia); int affected = MyConvert.ToInt32(rs); if (affected > 0) { return(true); } return(false); }
public static bool Update(DiemDL dl) { object rs = DataProvider.Instance.ExecuteNonQuery("DiemDL_Update", dl.ID, dl.TenDiem, dl.MaDD, dl.DiaChi); int affected = MyConvert.ToInt32(rs); if (affected > 0) { return(true); } return(false); }
public static bool DeleteMKS(int _MKS) { object rs = DataProvider.Instance.ExecuteNonQuery("KSanDLich_DeleteMKS", _MKS); int affected = MyConvert.ToInt32(rs); if (affected > 0) { return(true); } return(false); }
public static int Update(NCCPTien _Nccc) { object rs = DataProvider.Instance.ExecuteNonQuery("NCCPTien_Update", _Nccc.ID, _Nccc.TenNCC, _Nccc.DiaChi, _Nccc.DienThoai); int affected = MyConvert.ToInt32(rs); if (affected > 0) { return(affected); } return(0); }
public static bool Delete(KSanDLich ksdl) { object rs = DataProvider.Instance.ExecuteNonQuery("KSanDLich_Delete", ksdl.MKS, ksdl.MDiemDL); int affected = MyConvert.ToInt32(rs); if (affected > 0) { return(true); } return(false); }
public static int Delete(int _MaPT) { object rs = DataProvider.Instance.ExecuteNonQuery("PTien_Delete", _MaPT); int affected = MyConvert.ToInt32(rs); if (affected > 0) { return(affected); } return(0); }
/// <summary> /// Add thêm một customer vào database /// </summary> /// <param name="cus">The customer to add</param> /// <returns>CustomerID hoặc Empty String</returns> public static string Add(Customer cus) { object rs = DataProvider.Instance.ExecuteNonQuery("Customers_Add", cus._CustomerID, cus._CompanyName, cus._ContactName, cus._Address, cus._PostalCode, cus._Country, cus._Phone, cus._Fax); int affected = MyConvert.ToInt32(rs); if (affected > 0) { return(cus._CustomerID); } return(""); }
public static bool Delete(string _MKHang) { object rs = DataProvider.Instance.ExecuteNonQuery("DatCho_DeleteByMKHang", _MKHang); int affected = MyConvert.ToInt32(rs); if (affected > 0) { return(true); } return(false); }
public static int Update(PhuongTien _Pt) { object rs = DataProvider.Instance.ExecuteNonQuery("PTien_Update", _Pt.ID, _Pt.TenPT, _Pt.TienNghi, _Pt.SoChoToiDa, _Pt.SoChoToiThieu, _Pt.NhaCungCap); int affected = MyConvert.ToInt32(rs); if (affected > 0) { return(affected); } return(0); }
public static int Add(KhachSan ks) { try { object rs = DataProvider.Instance.ExecuteNonQueryWithOutput("@ID", "KhachSan_Add", ks.ID, ks.TenKS, ks.SoSao, ks.DiaChi, ks.SoDienThoai); int affected = MyConvert.ToInt32(rs); if (affected > 0) { return(int.Parse(rs.ToString())); } return(0); } catch { return(0); } }
public static Employee GetDataEmployeeToExcel(OleDbDataReader reader) { Employee emp = new Employee(); emp.EmployeeID = MyConvert.ToInt32(reader["EmployeeID"].ToString()); emp.EmployeeName = MyConvert.ToString(reader["Name"].ToString()); emp.HireDate = MyConvert.ToDateTime(reader["HireDate"].ToString()); emp.BirthDate = MyConvert.ToDateTime(reader["BirthDate"].ToString()); emp.Address = MyConvert.ToString(reader["Address"].ToString()); emp.PostalCode = MyConvert.ToString(reader["PostalCode"].ToString()); emp.Country = MyConvert.ToString(reader["Country"].ToString()); emp.HomePhone = MyConvert.ToString(reader["HomePhone"].ToString()); return(emp); }
public static Product GetDataProductToExcel(OleDbDataReader reader) { Product pro = new Product(); pro.ProductID = MyConvert.ToInt32(reader["ProductID"]); pro.ProductName = MyConvert.ToString(reader["ProductName"]); pro.SupplierID = MyConvert.ToInt32(reader["SupplierID"]); pro.QuantityPerUnit = MyConvert.ToString(reader["ProductName"]); pro.UnitPrice = MyConvert.ToDouble(reader["UnitPrice"]); pro.UnitsInStock = MyConvert.ToInt16(reader["UnitsInStock"]); pro.UnitsOnOrder = MyConvert.ToInt16(reader["UnitsOnOrder"]); pro.Discontinued = MyConvert.ToBool(reader["Discontinued"]); return(pro); }
/// <summary> /// Cập nhật thông tin hóa đơn theo khóa chính OrderID /// </summary> /// <param name="order"></param> /// <returns></returns> public static bool Update(Order order) { object numberAffected = DataProvider.Instance.ExecuteNonQueryWithOutput("@OrderID", "Orders_Update", 0, order._CustomerID, order._EmployeeID, order._OrderDate, order._RequiredDate, order.ShippedDate, order._Freight, order._ShipAddress, order._ShipPostalCode, order._Status); int affected = MyConvert.ToInt32(numberAffected); if (affected > 0) { return(true); } else { return(false); } }
public static Order GetDataOrderToExcel(OleDbDataReader reader) { Order od = new Order(); od.OrderID = MyConvert.ToInt32(reader["OrderID"]); od.CustomerID = MyConvert.ToString(reader["CustomerID"]); od.EmployeeID = MyConvert.ToInt32(reader["EmployeeID"]); od.OrderDate = MyConvert.ToDateTime(reader["OrderDate"]); od.RequiredDate = MyConvert.ToDateTime(reader["RequiredDate"]); od.ShippedDate = MyConvert.ToDateTime(reader["ShippedDate"]); od.Freight = MyConvert.ToDouble(reader["Freight"]); od.ShipAddress = MyConvert.ToString(reader["ShipAddress"]); od.ShipPostalCode = MyConvert.ToString(reader["ShipPostalCode"]); od.Status = MyConvert.ToString(reader["Status"]); return(od); }
public static bool Update(HuongDanVien hdv, List <HDV_Tour> list) { object rs = DataProvider.Instance.ExecuteNonQuery("HDV_Update", hdv.ID, hdv.Ho, hdv.Ten, hdv.NgaySinh, hdv.GioiTinh, hdv.DiaChi, hdv.QuocGia, hdv.DienThoai, hdv.TrangThai); int affected = MyConvert.ToInt32(rs); if (affected > 0) { foreach (HDV_Tour i in list) { if (!HDV_Tour.Add(i)) { MessageBox.Show(String.Format("Adding the specialized tour is faile at ID = {0}", i.MTour), "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } } return(true); } return(false); }
public static Supplier GetDataSupplierToExcel(OleDbDataReader reader) { Supplier sup = new Supplier(); sup.SupplierID = MyConvert.ToInt32(reader["SupplierID"]); sup.CompanyName = MyConvert.ToString(reader["CompanyName"]); sup.ContactName = MyConvert.ToString(reader["ContactName"]); sup.ContactTitle = MyConvert.ToString(reader["ContactTitle"]); sup.Address = MyConvert.ToString(reader["ContactTitle"]); sup.City = MyConvert.ToString(reader["City"]); sup.Country = MyConvert.ToString(reader["Country"]); sup.Region = MyConvert.ToString(reader["Region"]); sup.PostalCode = MyConvert.ToString(reader["Region"]); sup.Phone = MyConvert.ToString(reader["Region"]); sup.Fax = MyConvert.ToString(reader["Region"]); sup.HomePage = MyConvert.ToString(reader["Region"]); return(sup); }
public static bool Delete(int _MTour) { object rs = DataProvider.Instance.ExecuteNonQuery("Tour_Delete", _MTour); return(MyConvert.ToInt32(rs) > 0 ? true : false); }
public static bool Update(Tour t) { object rs = DataProvider.Instance.ExecuteNonQuery("Tour_Update", t.ID, t.TenTour, t.XuatPhat, t.TrangThai); return(MyConvert.ToInt32(rs) > 0 ? true : false); }
public static int Add(Tour t) { object rs = DataProvider.Instance.ExecuteNonQueryWithOutput("@ID", "Tour_Add", t.ID, t.TenTour, t.XuatPhat, t.TrangThai); return(MyConvert.ToInt32(rs)); }