예제 #1
0
        /// <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);
        }
예제 #2
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));
        }
예제 #3
0
파일: KhachHang.cs 프로젝트: thaimoc/ETour
        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);
        }
예제 #4
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");
        }
예제 #5
0
        /// <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);
        }
예제 #6
0
        /// <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));
        }
예제 #7
0
        /// <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);
        }
예제 #8
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);
        }
예제 #9
0
파일: KhachSan.cs 프로젝트: thaimoc/ETour
        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);
        }
예제 #10
0
파일: KhachSan.cs 프로젝트: thaimoc/ETour
        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);
        }
예제 #11
0
        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);
        }
예제 #12
0
        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);
        }
예제 #13
0
파일: DiemDL.cs 프로젝트: thaimoc/ETour
        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);
        }
예제 #14
0
        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);
        }
예제 #15
0
        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);
        }
예제 #16
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);
        }
예제 #17
0
파일: PhuongTien.cs 프로젝트: thaimoc/ETour
        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);
        }
예제 #18
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("");
        }
예제 #19
0
        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);
        }
예제 #20
0
파일: PhuongTien.cs 프로젝트: thaimoc/ETour
        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);
        }
예제 #21
0
파일: KhachSan.cs 프로젝트: thaimoc/ETour
 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); }
 }
예제 #22
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);
        }
예제 #23
0
        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);
        }
예제 #24
0
        /// <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);
            }
        }
예제 #25
0
        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);
        }
예제 #26
0
        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);
        }
예제 #27
0
        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);
        }
예제 #28
0
파일: Tour.cs 프로젝트: thaimoc/ETour
        public static bool Delete(int _MTour)
        {
            object rs = DataProvider.Instance.ExecuteNonQuery("Tour_Delete", _MTour);

            return(MyConvert.ToInt32(rs) > 0 ? true : false);
        }
예제 #29
0
파일: Tour.cs 프로젝트: thaimoc/ETour
        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);
        }
예제 #30
0
파일: Tour.cs 프로젝트: thaimoc/ETour
        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));
        }