コード例 #1
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);
            }
        }
コード例 #2
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);
            }
        }
コード例 #3
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);
            }
        }
コード例 #4
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);
            }
        }
コード例 #5
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);
            }
        }
コード例 #6
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);
            }
        }
コード例 #7
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);
            }
        }
コード例 #8
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);
            }
        }
コード例 #9
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);
            }
        }
コード例 #10
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);
            }
        }
コード例 #11
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);
            }
        }