public add_proc()
        {
            this.InitializeComponent();
            c1       = new DBconnection();
            branddt  = c1.Select("select * from Brand");
            socketdt = c1.Select("select * from Socket");
            vendordt = c1.Select("select * from Vendor");

            type_box.Text = "Processor";

            for (int i = 0; i < branddt.Rows.Count; i++)
            {
                brand_combobox.Items.Add(branddt.Rows[i]["BrandName"]);
            }

            for (int i = 0; i < socketdt.Rows.Count; i++)
            {
                socket_combobox.Items.Add(socketdt.Rows[i]["SocketName"]);
            }

            for (int i = 0; i < vendordt.Rows.Count; i++)
            {
                vendor_combobox.Items.Add(vendordt.Rows[i]["VendorName"]);
            }
        }
Пример #2
0
        public void set_itemname()
        {
            DBconnection c1 = new DBconnection();


            if (!is_build)
            {
                DataTable d1 = c1.Select("select * from Products where ProductID = " + itemid);

                foreach (DataRow row in d1.Rows)
                {
                    if (itemid == row["ProductID"].ToString())
                    {
                        itemname = row["ProductName"].ToString();
                        break;
                    }
                }
            }
            else
            {
                DataTable d1 = c1.Select("select * from Builds where BuildID = " + buildid);


                foreach (DataRow row in d1.Rows)
                {
                    if (buildid == row["BuildID"].ToString())
                    {
                        itemname = row["BuildDescription"].ToString();
                        break;
                    }
                }
            }
        }
Пример #3
0
        private void mobo_box_reloaded()
        {
            mobo_box.Items.Clear();
            mobo_tb.Clear();
            mobo_tb = c1.Select("select * from Motherboard m1, Products p2 where m1.ProductID = p2.ProductID and SocketID = '" + socket + "'");

            for (int i = 0; i < mobo_tb.Rows.Count; i++)
            {
                mobo_box.Items.Add(mobo_tb.Rows[i]["ProductName"]);
            }
        }
Пример #4
0
 public view_build()
 {
     this.InitializeComponent();
     c1 = new DBconnection();
     d1 = c1.Select("select * from Builds");
     current_session.FillDataGrid(d1, builds_grid);
 }
 public orderhistory()
 {
     this.InitializeComponent();
     c1     = new DBconnection();
     ord_tb = c1.Select("select o.OrderID, o.CustomerID, o.OrderDate, sum(oi.UnitPrice) as [Total Price] from Orders o, OrderItem oi where o.OrderID = oi.OrderID and CustomerID = " + current_session.customer_id + " group by o.OrderID, o.CustomerID, o.OrderDate");
     current_session.FillDataGrid(ord_tb, order_histgrid);
 }
 public registerform()
 {
     this.InitializeComponent();
     c2            = new DBconnection();
     d2            = c2.Select("select * from City");
     checks_passed = true;
     emailbox.Text = current_register.current_email;
 }
Пример #7
0
        public upd_proc()
        {
            this.InitializeComponent();
            c1      = new DBconnection();
            prod_dt = new DataTable();

            brand_dt  = c1.Select("select * from Brand");
            socket_dt = c1.Select("select * from Socket");

            for (int i = 0; i < brand_dt.Rows.Count; i++)
            {
                brandbox.Items.Add(brand_dt.Rows[i]["BrandName"]);
            }

            for (int i = 0; i < socket_dt.Rows.Count; i++)
            {
                socketbox.Items.Add(socket_dt.Rows[i]["SocketName"]);
            }
        }
Пример #8
0
        private void search_btn_Click(object sender, RoutedEventArgs e)
        {
            if (categ_box.SelectedIndex != -1)
            {
                d1 = c1.Select("select ProductID, TypeName as 'Product Type', BrandName, ProductName as 'Product Name', isAvailable as 'Available', UnitPrice as 'Price'"
                               + " from Products, ProductType, Brand "
                               + "where Products.TypeID = ProductType.TypeID and Products.BrandID = Brand.BrandID and TypeName = '" + categ_box.SelectedItem.ToString() + "'");


                current_session.FillDataGrid(d1, search_grid);
            }
            else
            {
                string x = prod_namebox.Text;
                d1 = c1.Select("select ProductID, TypeName as 'Product Type', BrandName, ProductName as 'Product Name', isAvailable as 'Available', UnitPrice as 'Price'"
                               + " from Products, ProductType, Brand "
                               + "where Products.TypeID = ProductType.TypeID and Products.BrandID = Brand.BrandID and ProductName like '%" + x + "%'");

                current_session.FillDataGrid(d1, search_grid);
            }
        }
Пример #9
0
        public static void set_customer_details() //assuming customer id is set
        {
            DBconnection x1           = new DBconnection();
            DataTable    cust_details = x1.Select("select * from Customer where CustomerID = " + customer_id);

            foreach (DataRow row in cust_details.Rows)
            {
                customer_name   = row["CustomerName"].ToString();
                customer_addr   = row["CustomerAddress"].ToString();
                customer_cityid = row["CityID"].ToString();
                contact         = row["Contact"].ToString();
            }
        }
Пример #10
0
        public create_build()
        {
            this.InitializeComponent();
            c1         = new DBconnection();
            mobo_tb    = new DataTable();
            chassis_tb = new DataTable();

            ffactor    = ""; socket = "";
            curr_price = 0;

            proc_tb = c1.Select("select * from Processor p1, Products p2 where p1.ProductID = p2.ProductID");

            mobo_tb = c1.Select("select * from Motherboard m1, Products p2 where m1.ProductID = p2.ProductID");

            gpu_tb = c1.Select("select * from GPU g1, Products p2 where g1.ProductID = p2.ProductID");

            memory_tb = c1.Select("select * from Memory m2, Products p2 where m2.ProductID = p2.ProductID");

            storage_tb = c1.Select("select * from Storage s2, Products p2 where s2.ProductID = p2.ProductID");

            psu_tb = c1.Select("select * from PSU s2, Products p2 where s2.ProductID = p2.ProductID");


            //chassis_tb = c1.Select("select * from Chassis ch1, Products p2 where ch1.ProductID = p2.ProductID");



            for (int i = 0; i < proc_tb.Rows.Count; i++)
            {
                proc_box.Items.Add(proc_tb.Rows[i]["ProductName"]);
            }

            for (int i = 0; i < mobo_tb.Rows.Count; i++)
            {
                mobo_box.Items.Add(mobo_tb.Rows[i]["ProductName"]);
            }

            for (int i = 0; i < gpu_tb.Rows.Count; i++)
            {
                gpu_box.Items.Add(gpu_tb.Rows[i]["ProductName"]);
            }

            for (int i = 0; i < psu_tb.Rows.Count; i++)
            {
                psu_box.Items.Add(psu_tb.Rows[i]["ProductName"]);
            }

            for (int i = 0; i < memory_tb.Rows.Count; i++)
            {
                memory_box.Items.Add(memory_tb.Rows[i]["ProductName"]);
            }

            for (int i = 0; i < storage_tb.Rows.Count; i++)
            {
                storage_box.Items.Add(storage_tb.Rows[i]["ProductName"]);
            }
        }
        public view_all_prod()
        {
            this.InitializeComponent();
            c1 = new DBconnection();
            d1 = c1.Select("select * from Products");

            foreach (DataColumn col in d1.Columns)
            {
                System.Diagnostics.Debug.WriteLine((col.ToString()));
            }

            current_session.FillDataGrid(d1, prod_datagrid);

            //prod_datagrid.CanUserAddRows = false;
        }
        private void search_bttn_Click(object sender, RoutedEventArgs e)
        {
            d1 = c1.Select("select * from Products where ProductID = " + ID_box.Text);
            string price_old = "";

            foreach (DataRow row in d1.Rows)
            {
                if (ID_box.Text == row["ProductID"].ToString())
                {
                    price_old = row["UnitPrice"].ToString();
                    break;
                }
            }

            curr_priceBox.Text = price_old;
        }
Пример #13
0
        private void search_btn_Click(object sender, RoutedEventArgs e)
        {
            prod_dt = c1.Select("select * from Products p inner join Processor p1 on p.ProductID = p1.ProductID inner join Vendor v on p.VendorID = v.VendorID inner join Brand on p.BrandID = Brand.BrandID inner join Socket S on p1.SocketID = S.SocketID");
            //

            foreach (DataRow row in prod_dt.Rows)
            {
                if (search_box.Text == row["ProductID"].ToString())
                {
                    namebox.Text           = row["ProductName"].ToString();
                    price_box.Text         = row["UnitPrice"].ToString();
                    type_box.Text          = "Processor";
                    clock_box.Text         = row["ClockSpeed"].ToString();
                    vendor_box.Text        = row["VendorName"].ToString();
                    brandbox.SelectedItem  = row["BrandName"].ToString();
                    socketbox.SelectedItem = row["SocketName"].ToString();
                }
            }
        }
        private void citycombobox_Loaded(object sender, RoutedEventArgs e)
        {
            DataTable d2 = new DataTable();

            d2 = c1.Select("select * from City");

            for (int i = 0; i < d2.Rows.Count; i++)
            {
                citycombobox.Items.Add(d2.Rows[i]["CityName"]);
            }

            string temp = "";

            for (int i = 0; i < d2.Rows.Count; i++)
            {
                if (current_session.customer_cityid == d2.Rows[i]["CityID"].ToString())
                {
                    temp = d2.Rows[i]["CityName"].ToString();
                    break;
                }
            }

            citycombobox.SelectedItem = temp;
        }
Пример #15
0
 public product_search()
 {
     this.InitializeComponent();
     c1 = new DBconnection();
     d2 = c1.Select("select * from ProductType");
 }
        private void signbttn_Click(object sender, RoutedEventArgs e)
        {
            DataTable login_table = c1.Select("select * from AppUser");

            if (newuserflag)
            {
                current_register.currentpass   = passbox.Password;
                current_register.current_email = emailbox.Text;
                this.Frame.Navigate(typeof(registerform));
                return;
            }


            foreach (DataRow row in login_table.Rows)
            {
                if (emailbox.Text == row["userid"].ToString() && passbox.Password.Equals(row["userpassword"].ToString()))
                {
                    userid = emailbox.Text;
                    System.Diagnostics.Debug.WriteLine(userid);


                    current_session.emailid      = emailbox.Text;
                    current_session.current_pass = passbox.Password;
                    current_session.customer_id  = row["CustomerID"].ToString();
                    current_session.set_customer_details();


                    if (row["isAdmin"].ToString() == "True")
                    {
                        this.Frame.Navigate(typeof(admin_dash));
                        return;
                    }
                    else
                    {
                        this.Frame.Navigate(typeof(user_dash));
                        return;
                    }
                }
                else
                {
                    System.Diagnostics.Debug.WriteLine("unmatched");
                }
            }



            /*
             * if (newuserflag && adminflag)
             * {
             *
             *  // Create the message dialog and set its content
             *  //var messageDialog = new MessageDialog("user cannot be both new user and admin");
             *
             *      // Show the message dialog
             *      //await messageDialog.ShowAsync();
             *
             * }
             *
             * else if (newuserflag)
             * {
             *  this.Frame.Navigate(typeof(registerform));
             * }
             * else if(adminflag)
             * {
             *  this.Frame.Navigate(typeof(admin_dash));
             * }
             *
             * else
             * {
             *  this.Frame.Navigate(typeof(user_dash));
             * }
             */
        }