Example #1
0
        public void DeleteProductInOrder()
        {
            SqlCommand c = new SqlCommand();

            c.CommandText = "EXECUTE dbo.SP_Delete_Product_In_order @Order_ID, @Product_ID ";
            c.Parameters.AddWithValue("@Order_ID", this.orderFromSupplier.getID());
            c.Parameters.AddWithValue("@Product_ID", this.productInOrder.get_productID());
            SQL_CON SC = new SQL_CON();

            SC.execute_non_query(c);
        }
        public void UpdateProductInPurchase()
        {
            SqlCommand c = new SqlCommand();

            c.CommandText = "EXECUTE dbo.SP_Update_Products_In_Purchase @Purchase_ID, @Product_ID, @Quantity";
            c.Parameters.AddWithValue("@Product_ID", this.product.get_productID());
            c.Parameters.AddWithValue("@Purchase_ID", this.purchase.getID());
            c.Parameters.AddWithValue("@Quantity", this.quantity);
            SQL_CON SC = new SQL_CON();

            SC.execute_non_query(c);
        }
Example #3
0
        public void createProductInCourse()
        {
            SqlCommand c = new SqlCommand();

            c.CommandText = "EXECUTE dbo.SP_Add_Products_In_Courses @Course_Number, @Product_ID, @Quantity";
            c.Parameters.AddWithValue("@Course_Number", this.course.get_Coursenumber());
            c.Parameters.AddWithValue("@Product_ID", this.product.get_productID());
            c.Parameters.AddWithValue("@Quantity", this.quantity);
            SQL_CON SC = new SQL_CON();

            SC.execute_non_query(c);
        }
Example #4
0
        public void createCustomerInCourse()
        {
            SqlCommand c = new SqlCommand();

            c.CommandText = "EXECUTE dbo.SP_Add_CUSTOMERS_In_Course @Course_Number, @Customer_ID";
            c.Parameters.AddWithValue("@Course_Number", this.course.get_Coursenumber());
            c.Parameters.AddWithValue("@Customer_ID", this.customer.get_customerID());

            SQL_CON SC = new SQL_CON();

            SC.execute_non_query(c);
        }
Example #5
0
        public void create_supplier()
        {
            SqlCommand c = new SqlCommand();

            c.CommandText = "EXECUTE dbo.SP_Add_Suppliers @Supplier_ID, @Supplier_Name, @Supplier_Phone, @Supplier_Email, @Supplier_Address, @Supplier_Description";
            c.Parameters.AddWithValue("@Supplier_ID", this.supplierID);
            c.Parameters.AddWithValue("@Supplier_Name", this.supplierName);
            c.Parameters.AddWithValue("@Supplier_Phone", this.supplierPhone);
            c.Parameters.AddWithValue("@Supplier_Email", this.supplierEmail);
            c.Parameters.AddWithValue("@Supplier_Address", this.supplierAddress);
            c.Parameters.AddWithValue("@Supplier_Description", this.supplierDescription);
            SQL_CON SC = new SQL_CON();

            SC.execute_non_query(c);
        }
Example #6
0
        public void createPromocode()
        {
            SqlCommand c = new SqlCommand();

            c.CommandText = "EXECUTE dbo.SP_Add_Promo_Code @Promo_Code_Name, @Promo_Description, @Promo_Start_Date, @Promo_Discount_Percent,@Promo_End_Date";
            c.Parameters.AddWithValue("@Promo_Code_Name", this.promoName);
            c.Parameters.AddWithValue("@Promo_Description", this.promoDescription);
            c.Parameters.AddWithValue("@Promo_Start_Date", this.promoStartDate);
            c.Parameters.AddWithValue("@Promo_Discount_Percent", this.promoDiscountPercent);
            c.Parameters.AddWithValue("@Promo_End_Date", this.promoEndDate);

            SQL_CON SC = new SQL_CON();

            SC.execute_non_query(c);
        }
Example #7
0
        public void update_purchase()
        {
            SqlCommand c = new SqlCommand();

            c.CommandText = "EXECUTE dbo.SP_Update_Purchase @Purchase_ID, @Purchase_Price, @Purchase_By_Employee, @Purchase_By_Customer, @Purchase_Date, @Payment_Method, @Purchase_Promo_Code";
            c.Parameters.AddWithValue("@Purchase_ID", this.purchaseID);
            c.Parameters.AddWithValue("@Purchase_Price", this.purchasePrice);
            c.Parameters.AddWithValue("@Purchase_By_Employee", this.purchaseByEmployee.get_employeeID());
            c.Parameters.AddWithValue("@Purchase_By_Customer", this.purchaseByCustomer.get_customerID());
            c.Parameters.AddWithValue("@Purchase_Date", this.purchaseDate);
            c.Parameters.AddWithValue("@Payment_Method", this.paymentMethod.ToString());
            c.Parameters.AddWithValue("@Purchase_Promo_Code", this.purchasePromoCode.getPromoName());
            SQL_CON SC = new SQL_CON();

            SC.execute_non_query(c);
        }
Example #8
0
        public static void init_Courses()//מילוי המערך מתוך בסיס הנתונים
        {
            SqlCommand c = new SqlCommand();

            c.CommandText = "EXECUTE dbo.Get_All_Courses";
            SQL_CON       SC  = new SQL_CON();
            SqlDataReader rdr = SC.execute_query(c);

            Shorashim_Courses = new List <ShorashimCourse>();

            while (rdr.Read())
            {
                ShorashimCourse cou = new ShorashimCourse(rdr.GetValue(0).ToString(), rdr.GetValue(1).ToString(), DateTime.Parse(rdr.GetValue(2).ToString()), rdr.GetValue(3).ToString(), rdr.GetValue(4).ToString(), int.Parse(rdr.GetValue(5).ToString()), int.Parse(rdr.GetValue(6).ToString()), rdr.GetValue(7).ToString(), rdr.GetValue(8).ToString(), false);
                Shorashim_Courses.Add(cou);
            }
        }
Example #9
0
        public static void init_ProductsInOrder()//מילוי המערך מתוך בסיס הנתונים
        {
            SqlCommand c = new SqlCommand();

            c.CommandText = "EXECUTE dbo.Get_All_Products_In_Supplier_Order";
            SQL_CON       SC  = new SQL_CON();
            SqlDataReader rdr = SC.execute_query(c);

            productsInOrder = new List <ProductInOrder>();

            while (rdr.Read())
            {
                ProductInOrder pio = new ProductInOrder(seekProduct(rdr.GetValue(1).ToString()), seekOrder_From_Supplier(int.Parse(rdr.GetValue(0).ToString())), int.Parse(rdr.GetValue(2).ToString()), false);
                productsInOrder.Add(pio);
            }
        }
Example #10
0
        public static void init_PromoCodes()//מילוי המערך מתוך בסיס הנתונים
        {
            SqlCommand c = new SqlCommand();

            c.CommandText = "EXECUTE dbo.Get_All_PromoCodes";
            SQL_CON       SC  = new SQL_CON();
            SqlDataReader rdr = SC.execute_query(c);

            promoCodes = new List <PromoCodes>();

            while (rdr.Read())
            {
                PromoCodes pc = new PromoCodes(rdr.GetValue(0).ToString(), rdr.GetValue(1).ToString(), DateTime.Parse(rdr.GetValue(2).ToString()), double.Parse(rdr.GetValue(3).ToString()), DateTime.Parse(rdr.GetValue(4).ToString()), false);
                promoCodes.Add(pc);
            }
        }
Example #11
0
        public static void init_Supplier()//מילוי המערך מתוך בסיס הנתונים
        {
            SqlCommand c = new SqlCommand();

            c.CommandText = "EXECUTE dbo.Get_All_Suppliers";
            SQL_CON       SC  = new SQL_CON();
            SqlDataReader rdr = SC.execute_query(c);

            suppliers = new List <Supplier>();

            while (rdr.Read())
            {
                Supplier s = new Supplier(int.Parse(rdr.GetValue(0).ToString()), rdr.GetValue(1).ToString(), rdr.GetValue(2).ToString(), rdr.GetValue(3).ToString(), rdr.GetValue(4).ToString(), rdr.GetValue(5).ToString(), false);
                suppliers.Add(s);
            }
        }
Example #12
0
        public static void init_Customer_In_Courses()//init  data from sql
        {
            SqlCommand c = new SqlCommand();

            c.CommandText = "EXECUTE dbo.Get_All_Customers_In_Courses";
            SQL_CON       SC  = new SQL_CON();
            SqlDataReader rdr = SC.execute_query(c);

            Customers_In_Course = new List <CustomerInCourse>();

            while (rdr.Read())
            {
                CustomerInCourse CusiCou = new CustomerInCourse(seekCourse(rdr.GetValue(0).ToString()), seekCustomer(int.Parse(rdr.GetValue(1).ToString())), false);
                Customers_In_Course.Add(CusiCou);
            }
        }
Example #13
0
        public static void init_Product_In_Courses()//init  data from sql
        {
            SqlCommand c = new SqlCommand();

            c.CommandText = "EXECUTE dbo.Get_All_Products_In_Courses";
            SQL_CON       SC  = new SQL_CON();
            SqlDataReader rdr = SC.execute_query(c);

            Products_In_Course = new List <ProductInCourse>();

            while (rdr.Read())
            {
                ProductInCourse proipCo = new ProductInCourse(seekCourse(rdr.GetValue(0).ToString()), seekProduct((rdr.GetValue(1).ToString())), int.Parse(rdr.GetValue(2).ToString()), false);
                Products_In_Course.Add(proipCo);
            }
        }
Example #14
0
        // initalizing customer from sql
        public static void init_customers()
        {
            SqlCommand c = new SqlCommand();

            c.CommandText = "EXECUTE dbo.Get_All_Customers";
            SQL_CON       SC  = new SQL_CON();
            SqlDataReader rdr = SC.execute_query(c);

            customers = new List <Customer>();

            while (rdr.Read())
            {
                Gender   gender = (Gender)Enum.Parse(typeof(Gender), rdr.GetValue(3).ToString());
                Customer cu     = new Customer(int.Parse(rdr.GetValue(0).ToString()), rdr.GetValue(1).ToString(), rdr.GetValue(2).ToString(), gender, rdr.GetValue(4).ToString(), rdr.GetValue(5).ToString(), DateTime.Parse(rdr.GetValue(6).ToString()), rdr.GetValue(7).ToString(), rdr.GetValue(8).ToString(), false);
                customers.Add(cu);
            }
        }
Example #15
0
        // initalizing products from sql
        public static void init_Products()//מילוי המערך מתוך בסיס הנתונים
        {
            SqlCommand c = new SqlCommand();

            c.CommandText = "EXECUTE dbo.Get_All_Products";
            SQL_CON       SC  = new SQL_CON();
            SqlDataReader rdr = SC.execute_query(c);

            products = new List <Product>();

            while (rdr.Read())
            {
                ProductCategory pc = (ProductCategory)Enum.Parse(typeof(ProductCategory), rdr.GetValue(5).ToString());
                Product         p  = new Product(rdr.GetValue(0).ToString(), rdr.GetValue(1).ToString(), Program.seekSupplier(int.Parse(rdr.GetValue(2).ToString())), double.Parse(rdr.GetValue(3).ToString()), double.Parse(rdr.GetValue(4).ToString()), pc, rdr.GetValue(6).ToString(), int.Parse(rdr.GetValue(7).ToString()), int.Parse(rdr.GetValue(8).ToString()), int.Parse(rdr.GetValue(9).ToString()), int.Parse(rdr.GetValue(10).ToString()), 0, false);
                products.Add(p);
            }
        }
Example #16
0
        public void update_Course()
        {
            SqlCommand c = new SqlCommand();

            c.CommandText = "EXECUTE dbo.SP_Update_Course  @Course_Number, @Course_Name, @Course_Date_Time, @Course_Lecturer_Name, @Course_Lecturer_Phone, @Participant_Price, @Cost_To_Company, @Curse_Location, @Curse_Description ";
            c.Parameters.AddWithValue("@Course_Number", this.courseNumber);
            c.Parameters.AddWithValue("@Course_Name", this.courseName);
            c.Parameters.AddWithValue("@Course_Date_Time", this.courseDateTime);
            c.Parameters.AddWithValue("@Course_Lecturer_Name", this.courseLecturerName);
            c.Parameters.AddWithValue("@Course_Lecturer_Phone", this.LecturerPhone);
            c.Parameters.AddWithValue("@Participant_Price", this.participantPrice);
            c.Parameters.AddWithValue("@Cost_To_Company", this.costToCompany);
            c.Parameters.AddWithValue("@Curse_Location", this.courseLocation);
            c.Parameters.AddWithValue("@Curse_Description", this.courseDescription);
            SQL_CON SC = new SQL_CON();

            SC.execute_non_query(c);
        }
Example #17
0
        // initalizing employees from sql
        public static void init_employees()
        {
            SqlCommand c = new SqlCommand();

            c.CommandText = "EXECUTE dbo.Get_All_Employees";
            SQL_CON       SC  = new SQL_CON();
            SqlDataReader rdr = SC.execute_query(c);

            employees = new List <Employee>();

            while (rdr.Read())
            {
                Role     role   = (Role)Enum.Parse(typeof(Role), rdr.GetValue(9).ToString());
                Gender   gender = (Gender)Enum.Parse(typeof(Gender), rdr.GetValue(10).ToString());
                Employee e      = new Employee(int.Parse(rdr.GetValue(0).ToString()), rdr.GetValue(1).ToString(), rdr.GetValue(2).ToString(), rdr.GetValue(3).ToString(), rdr.GetValue(4).ToString(), DateTime.Parse(rdr.GetValue(5).ToString()), DateTime.Parse(rdr.GetValue(6).ToString()), rdr.GetValue(7).ToString(), rdr.GetValue(8).ToString(), role, gender);
                employees.Add(e);
            }
        }
Example #18
0
        // initalizing orders from sql
        public static void init_ordersFromSupplier()//מילוי המערך מתוך בסיס הנתונים
        {
            SqlCommand c = new SqlCommand();

            c.CommandText = "EXECUTE dbo.Get_All_Orders_From_Supplier";
            SQL_CON       SC  = new SQL_CON();
            SqlDataReader rdr = SC.execute_query(c);

            ordersFromSuppliers = new List <OrderFromSupplier>();

            while (rdr.Read())
            {
                PaymentMethod     pm  = (PaymentMethod)Enum.Parse(typeof(PaymentMethod), rdr.GetValue(4).ToString());
                OrderStatus       os  = (OrderStatus)Enum.Parse(typeof(OrderStatus), rdr.GetValue(5).ToString());
                OrderFromSupplier ofs = new OrderFromSupplier(int.Parse(rdr.GetValue(0).ToString()), DateTime.Parse(rdr.GetValue(1).ToString()), DateTime.Parse(rdr.GetValue(2).ToString()), double.Parse(rdr.GetValue(3).ToString()), pm, os, seekEmployee(int.Parse(rdr.GetValue(6).ToString())), seekSupplier(int.Parse(rdr.GetValue(7).ToString())), rdr.GetValue(8).ToString(), false);
                ordersFromSuppliers.Add(ofs);
            }
        }
Example #19
0
        //CRU FUNCTIONS:
        public void create_orderFromSupplier()
        {
            SqlCommand c = new SqlCommand();

            c.CommandText = "EXECUTE dbo.SP_Add_Orders_From_Supplier @Order_ID, @Order_Date, @Order_Due_Date, @Order_Total_Price, @Payment_Method, @Order_Status, @Employee_Makes, @Supllier_receives, @Description";//-------check Employee and supplier
            c.Parameters.AddWithValue("@Order_ID", this.orderID);
            c.Parameters.AddWithValue("@Order_Date", this.orderDate);
            c.Parameters.AddWithValue("@Order_Due_Date", this.orderDueDate);
            c.Parameters.AddWithValue("@Order_Total_Price", this.orderTotalPrice);
            c.Parameters.AddWithValue("@Payment_Method", this.paymentMethod.ToString());
            c.Parameters.AddWithValue("@Order_Status", this.orderStatus.ToString());
            c.Parameters.AddWithValue("@Employee_Makes", this.employeeMakes.get_employeeID());
            c.Parameters.AddWithValue("@Supllier_receives", this.supplier.get_supplierID());
            c.Parameters.AddWithValue("@Description", this.Description);
            SQL_CON SC = new SQL_CON();

            SC.execute_non_query(c);
        }
Example #20
0
        public static void init_Purchases()//מילוי המערך מתוך בסיס הנתונים
        {
            SqlCommand c = new SqlCommand();

            c.CommandText = "EXECUTE dbo.Get_All_Purchases";
            SQL_CON       SC  = new SQL_CON();
            SqlDataReader rdr = SC.execute_query(c);

            purchases = new List <Purchase>();

            while (rdr.Read())
            {
                PaymentMethod pm = (PaymentMethod)Enum.Parse(typeof(PaymentMethod), rdr.GetValue(5).ToString());
                PromoCodes    pc = seekPromoCode(rdr.GetValue(6).ToString());
                Purchase      pu = new Purchase(int.Parse(rdr.GetValue(0).ToString()), double.Parse(rdr.GetValue(1).ToString()), seekEmployee(int.Parse(rdr.GetValue(2).ToString())), seekCustomer(int.Parse(rdr.GetValue(3).ToString())), DateTime.Parse(rdr.GetValue(4).ToString()), pm, pc, false);
                purchases.Add(pu);
            }
        }
Example #21
0
        public void createCustomer()
        {
            SqlCommand c = new SqlCommand();

            c.CommandText = "EXECUTE dbo.SP_Add_Customer @Customer_ID, @Customer_FirstName, @Customer_LastName, @Customer_Gender, @Customer_Phone, @Customer_Email, @Customer_Birth_Date, @Customer_Address, @Customer_Member_Club";
            c.Parameters.AddWithValue("@Customer_ID", this.customerID);
            c.Parameters.AddWithValue("@Customer_FirstName", this.customerFirstName);
            c.Parameters.AddWithValue("@Customer_LastName", this.customerLastName);
            c.Parameters.AddWithValue("@Customer_Gender", this.customerGender.ToString());
            c.Parameters.AddWithValue("@Customer_Phone", this.customerPhone);
            c.Parameters.AddWithValue("@Customer_Email", this.customerEmail);
            c.Parameters.AddWithValue("@Customer_Birth_Date", this.customerBirthDate);
            c.Parameters.AddWithValue("@Customer_Address", this.customerAddress);
            c.Parameters.AddWithValue("@Customer_Member_Club", this.customerMemberClub);

            SQL_CON SC = new SQL_CON();

            SC.execute_non_query(c);
        }
Example #22
0
        public void update_product()
        {
            SqlCommand c = new SqlCommand();

            c.CommandText = "EXECUTE dbo.SP_Update_Product @Product_ID, @Product_Name, @Product_Supplier, @Product_Supplier_Price,@Product_Sale_Price , @Product_Category, @Product_Description, @Product_Quantity, @Product_Lower_Bound, @Closet_Num, @Shelf_Num";
            c.Parameters.AddWithValue("@Product_ID", this.productID);
            c.Parameters.AddWithValue("@Product_Name", this.productName);
            c.Parameters.AddWithValue("@Product_Supplier", this.productSupplier.get_supplierID());
            c.Parameters.AddWithValue("@Product_Supplier_Price", this.productSupplierPrice);
            c.Parameters.AddWithValue("@Product_Sale_Price", this.productSalePrice);
            c.Parameters.AddWithValue("@Product_Category", this.productCategory.ToString());
            c.Parameters.AddWithValue("@Product_Description", this.productDescription);
            c.Parameters.AddWithValue("@Product_Quantity", this.productQuantity);
            c.Parameters.AddWithValue("@Product_Lower_Bound", this.productLowerBound);
            c.Parameters.AddWithValue("@Closet_Num", this.closetNum);
            c.Parameters.AddWithValue("@Shelf_Num", this.shelfNum);
            SQL_CON SC = new SQL_CON();

            SC.execute_non_query(c);
        }