private void updatebtn_Click(object sender, RoutedEventArgs e) { void update_email() { if (!(emailbox.Text.Equals(current_session.emailid))) { c1.Inserts("update AppUser set userid = '" + emailbox.Text + "' where CustomerID = " + current_session.customer_id.ToString()); } } if (newpass_box.Text != "") { if (oldpass_box.Text == current_session.current_pass) { c1.Inserts("update AppUser set userpassword = '******' where CustomerID = " + current_session.customer_id.ToString()); } update_email(); } else { update_email(); } this.Frame.Navigate(typeof(user_dash)); return; }
private void chkoutbtn_Click(object sender, RoutedEventArgs e) { c1.Inserts("insert into Orders (CustomerID, OrderDate) values ('" + current_session.customer_id + "', getdate())"); foreach (var cartitem in Cart.cart_collection) { if (cartitem.is_build) { c1.Inserts("insert into OrderItem(BuildID, OrderID, UnitPrice, Quantity) values ('" + cartitem.buildid + "', (select max(OrderID) from Orders), (select UnitPrice from Builds where BuildID = '" + cartitem.buildid + "'), 1 )"); } else { c1.Inserts("insert into OrderItem(ProductID, OrderID, UnitPrice, Quantity) values ('" + cartitem.itemid + "', (select max(OrderID) from Orders), (select UnitPrice from Products where ProductID = '" + cartitem.itemid + "'), 1 )"); } } Cart.clear_cart(); ContentDialog success = new ContentDialog { Title = "Order Placed", Content = "Order Placed for " + current_session.customer_name, CloseButtonText = "Return to Cart" }; }
private void registerbtn_Click(object sender, RoutedEventArgs e) { System.Diagnostics.Debug.WriteLine(citycombobox.SelectedItem.ToString()); c2.Inserts( "insert into Customer (CityID, CustomerName, CustomerAddress, Contact)" + " values((select CityID from City where CityName like '" + citycombobox.SelectedItem.ToString() + "'), '" + namebox.Text + "', '" + addressbox.Text + "', '" + contactbox.Text + "')" ); c2.Inserts( "insert into AppUser (userid, userpassword, isAdmin, CustomerID) values ( '" + emailbox.Text + "', '" + current_register.currentpass + "', 0, (select max(CustomerID) from Customer) )" ); this.Frame.Navigate(typeof(MainPage)); return; }
private void upd_bttn_Click(object sender, RoutedEventArgs e) { c1.Inserts("update Products set UnitPrice = " + new_priceBox.Text + " where ProductID = " + ID_box.Text); this.Frame.Navigate(typeof(admin_dash)); return; }
private void addbtn_Click(object sender, RoutedEventArgs e) { c1.Inserts( "insert into Products (VendorID, TypeID, BrandID, ProductName, IsAvailable, UnitPrice)" + " values ((select VendorID from Vendor where VendorName like '" + vendor_combobox.SelectedItem.ToString() + "'), " + "2, (select BrandID from Brand where BrandName like '" + brand_combobox.SelectedItem.ToString() + "'), '" + namebox.Text + "', 1, " + pricebox.Text + ")" ); c1.Inserts( "insert into Processor values ((select max(ProductID) from Products), (select SocketID from Socket where SocketName like '" + socket_combobox.SelectedItem.ToString() + "')" + ", " + clock_box.Text + ")" ); ContentDialog successmsg = new ContentDialog { Title = "Product Added", Content = "Processor succesfully added.", CloseButtonText = "OK" }; }
private void create_btn_Click(object sender, RoutedEventArgs e) { string description; if (descrip_txtbox.Text == "") { description = proc_box.SelectedItem.ToString() + " " + mobo_box.SelectedItem.ToString(); } else { description = descrip_txtbox.Text; } if (memory_box.SelectedItem.ToString() != "" && proc_box.SelectedItem.ToString() != "" && mobo_box.SelectedItem.ToString() != "" && storage_box.SelectedItem.ToString() != "" && psu_box.SelectedItem.ToString() != "" && chassis_box.SelectedItem.ToString() != "" && gpu_box.SelectedItem.ToString() != "") { c1.Inserts("insert into Builds(unitprice,builddescription) values(" + curr_price.ToString() + ",'" + description + "')"); c1.Inserts("insert into build_item(productid,buildid) values((select productid from products where productname like '" + memory_box.SelectedItem.ToString() + "'),(select max(buildid) from builds))"); c1.Inserts("insert into build_item(productid,buildid) values((select productid from products where productname like '" + proc_box.SelectedItem.ToString() + "'),(select max(buildid) from builds))"); c1.Inserts("insert into build_item(productid,buildid) values((select productid from products where productname like '" + mobo_box.SelectedItem.ToString() + "'),(select max(buildid) from builds))"); c1.Inserts("insert into build_item(productid,buildid) values((select productid from products where productname like '" + storage_box.SelectedItem.ToString() + "'),(select max(buildid) from builds))"); c1.Inserts("insert into build_item(productid,buildid) values((select productid from products where productname like '" + psu_box.SelectedItem.ToString() + "'),(select max(buildid) from builds))"); c1.Inserts("insert into build_item(productid,buildid) values((select productid from products where productname like '" + chassis_box.SelectedItem.ToString() + "'),(select max(buildid) from builds))"); c1.Inserts("insert into build_item(productid,buildid) values((select productid from products where productname like '" + gpu_box.SelectedItem.ToString() + "'),(select max(buildid) from builds))"); this.Frame.Navigate(typeof(user_dash)); return; } else { ContentDialog errorDialog = new ContentDialog { Title = "Missing Fields", Content = "You must select each component to create a build", CloseButtonText = "Return to Build" }; } }