private async void Customer_Home_Load(object sender, EventArgs e) { cat_list = await CCatagory.RetrieveCatagoryList(0); comboBox_Product_Search.Items.AddRange(cat_list.ToArray()); //comboBox_Product_Search.AutoCompleteSource = AutoCompleteSource.ListItems; // Cart Table Layout dataGridView_Cart.Columns.Add("product_name", "Product Name"); dataGridView_Cart.Columns["product_name"].ReadOnly = true; dataGridView_Cart.Columns.Add("seller_name", "Seller Name"); dataGridView_Cart.Columns["seller_name"].ReadOnly = true; dataGridView_Cart.Columns.Add("price", "Price"); dataGridView_Cart.Columns["price"].ReadOnly = true; dataGridView_Cart.Columns.Add("quantity", "Quantity"); dataGridView_Cart.Columns.Add("warranty", "Warranty"); dataGridView_Cart.Columns["warranty"].ReadOnly = true; // Invisible Containers inside Data Grid dataGridView_Cart.Columns.Add("extra_1", "extra_1"); dataGridView_Cart.Columns.Add("extra_2", "extra_2"); dataGridView_Cart.Columns.Add("extra_3", "extra_3"); dataGridView_Cart.Columns.Add("extra_4", "extra_4"); dataGridView_Cart.Columns["extra_1"].Visible = false; dataGridView_Cart.Columns["extra_2"].Visible = false; dataGridView_Cart.Columns["extra_3"].Visible = false; dataGridView_Cart.Columns["extra_4"].Visible = false; // Order Table Layout dataGridView_Orders.Columns.Add("order_id", "Order ID"); dataGridView_Orders.Columns.Add("product_name", "Product Name"); dataGridView_Orders.Columns.Add("price", "Price"); dataGridView_Orders.Columns.Add("quantity", "Quantity"); dataGridView_Orders.Columns.Add("address", "Address"); dataGridView_Orders.Columns.Add("started_at", "Start Date"); dataGridView_Orders.Columns.Add("eta", "ETA"); dataGridView_Orders.Columns.Add("order_status", "Status"); // Invisible Containers inside Data Grid dataGridView_Orders.Columns.Add("extra_1", "extra_1"); // order dataGridView_Orders.Columns.Add("extra_2", "extra_2"); // product dataGridView_Orders.Columns.Add("extra_3", "extra_3"); // seller_inventory dataGridView_Orders.Columns.Add("extra_4", "extra_4"); // location dataGridView_Orders.Columns["extra_1"].Visible = false; dataGridView_Orders.Columns["extra_2"].Visible = false; dataGridView_Orders.Columns["extra_3"].Visible = false; dataGridView_Orders.Columns["extra_4"].Visible = false; // Disable Form Auto Size Later Size temp = this.Size; this.AutoSize = false; this.Size = temp; }
private async void button_Product_Search_Click(object sender, EventArgs e) { if (comboBox_Product_Search.SelectedIndex < 0) { return; } String text = textBox_Product_Search.Text; CCatagory cat_obj = (CCatagory)comboBox_Product_Search.SelectedItem; List <CProduct> list = await CProduct.SearchProductList(cat_obj.id, text); dataGridView_Product.DataSource = new BindingSource(list, null); foreach (DataGridViewColumn x in dataGridView_Product.Columns) { if (x.Name.Equals("id")) { x.DisplayIndex = 0; x.HeaderText = "ID"; } else if (x.Name.Equals("name")) { x.DisplayIndex = 1; x.HeaderText = "Name"; } else if (x.Name.Equals("minprice")) { x.DisplayIndex = 2; x.HeaderText = "Price"; } else if (x.Name.Equals("sales")) { x.DisplayIndex = 3; x.HeaderText = "Sales"; } else if (x.Name.Equals("rating")) { x.DisplayIndex = 4; x.HeaderText = "Rating"; } else if (x.Name.Equals("quantity")) { x.DisplayIndex = 5; x.HeaderText = "Available"; } else { x.Visible = false; } } }
public async static Task <CCatagory> Retrieve(Int32 id) { CCatagory ret = null; try { String sql = "SELECT * FROM `catagory` WHERE `id` = @id LIMIT 1"; MySqlCommand cmd = new MySqlCommand(sql, Program.conn); cmd.Parameters.AddWithValue("@id", id); DbDataReader reader = await cmd.ExecuteReaderAsync(); cmd.Dispose(); if (!(await reader.ReadAsync())) { if (!reader.IsClosed) { reader.Close(); } CUtils.LastLogMsg = "Catagory with id '" + id + "' not found!"; return(ret); } ret = new CCatagory(id, reader.GetString(reader.GetOrdinal("name")), (await reader.IsDBNullAsync(reader.GetOrdinal("description"))) ? String.Empty : reader.GetString(reader.GetOrdinal("description")), (await reader.IsDBNullAsync(reader.GetOrdinal("parent_id"))) ? 0 : reader.GetInt32(reader.GetOrdinal("parent_id"))); if (!reader.IsClosed) { reader.Close(); } CUtils.LastLogMsg = null; } catch (Exception ex) { #if DEBUG Console.WriteLine(ex.Message + " " + ex.StackTrace); #endif CUtils.LastLogMsg = "Unahandled Exception!"; } return(ret); }
private async void Seller_Home_Product_Add_Load(object sender, EventArgs e) { // Fill Default Fields item = null; extField = new List <extFieldStruct>(); ButtonState = false; cat_list = await CCatagory.RetrieveCatagoryList(0); comboBox_Catagory.Items.AddRange(cat_list.ToArray()); location_list = await CLocation.RetrieveLocationList(); comboBox_Pincode.Items.AddRange(location_list.ToArray()); imgSize = pictureBox_Picture.Size; // Disable Form Auto Size Later Size temp = this.Size; this.AutoSize = false; this.Size = temp; // Enable Size Manager & Force Reset Size Seller_Home_Product_Add_SizeChanged_Custom(null, null); this.SizeChanged += new EventHandler(Seller_Home_Product_Add_SizeChanged_Custom); }
private async void Customer_Home_Product_Open_Load(object sender, EventArgs e) { // Fill Default Fields textBox_Name.Text = item.name; comboBox_Catagory.Items.Add(await CCatagory.Retrieve(item.catagory_id)); comboBox_Catagory.SelectedIndex = 0; richTextBox_Description.Text = item.description; progressBar_Rating.Value = (Int32)(item.rating * 100.0); location_list = await CLocation.RetrieveLocationList(); comboBox_Pincode.Items.AddRange(location_list.ToArray()); imgSize = item.image.Size; pictureBox_Picture.Image = item.image; // Fill Product Fields List <CProduct_Field> extlist = await CProduct_Field.RetrieveProductFieldList(item.id); foreach (CProduct_Field x in extlist) { tableLayoutPanel3.RowCount++; tableLayoutPanel3.RowStyles.Add(new RowStyle()); Label extLabel = new Label() { TabIndex = 0, Font = new Font("Microsoft Sans Serif", 9.75F, FontStyle.Regular, GraphicsUnit.Point, ((byte)(0))), Text = x.field_name, Size = new Size(16, 16), Dock = DockStyle.Fill }; TextBox extTextBox = new TextBox() { TabIndex = 1, Text = x.field_value, Size = new Size(16, 16), Dock = DockStyle.Fill, ReadOnly = true }; tableLayoutPanel3.Controls.Add(extLabel, 0, tableLayoutPanel3.RowCount - 1); tableLayoutPanel3.Controls.Add(extTextBox, 1, tableLayoutPanel3.RowCount - 1); } // Retrieve Sellers With Products List <CSeller_Inventory> list1 = await CSeller_Inventory.RetrieveSellerInventoryListByProduct(item.id); if (list1.Count < 1) { comboBox_Pincode.Enabled = false; button_Check.Enabled = false; textBox_Quantity.Enabled = false; button_AddToCart.Enabled = false; } dataGridView_SellerList.Columns.Add("seller_id", "Seller ID"); dataGridView_SellerList.Columns.Add("name", "Seller Name"); dataGridView_SellerList.Columns.Add("price", "Price"); dataGridView_SellerList.Columns.Add("quantity", "Available"); dataGridView_SellerList.Columns.Add("warranty", "Warranty"); dataGridView_SellerList.Columns.Add("shipping_time", "Shipping Time"); // Invisible Containers inside Data Grid dataGridView_SellerList.Columns.Add("extra_1", "extra_1"); dataGridView_SellerList.Columns.Add("extra_2", "extra_2"); dataGridView_SellerList.Columns["extra_1"].Visible = false; dataGridView_SellerList.Columns["extra_2"].Visible = false; for (Int16 i = 0; i < list1.Count; ++i) { CSeller_Inventory x = list1[i]; CUser_Seller y = await CUser_Seller.Retrieve(x.seller_id); dataGridView_SellerList.Rows.Add ( new object[] { x.seller_id, y.name, x.price, x.quantity, x.warranty, null, x, y, } ); } // Disable Form Auto Size Later Size temp = this.Size; this.AutoSize = false; this.Size = temp; // Enable Size Manager & Force Reset Size Customer_Home_Product_Open_SizeChanged_Custom(null, null); this.SizeChanged += new EventHandler(Customer_Home_Product_Open_SizeChanged_Custom); }
private async void Seller_Home_Product_Open_Load(object sender, EventArgs e) { // Fill Default Fields textBox_Name.Text = item.name; comboBox_Catagory.Items.Add(await CCatagory.Retrieve(item.catagory_id)); comboBox_Catagory.SelectedIndex = 0; richTextBox_Description.Text = item.description; progressBar_Rating.Value = (Int32)(item.rating * 100.0); location_list = await CLocation.RetrieveLocationList(); comboBox_Pincode.Items.AddRange(location_list.ToArray()); imgSize = item.image.Size; pictureBox_Picture.Image = item.image; // Fill Product Fields List <CProduct_Field> extlist = await CProduct_Field.RetrieveProductFieldList(item.id); foreach (CProduct_Field x in extlist) { tableLayoutPanel3.RowCount++; tableLayoutPanel3.RowStyles.Add(new RowStyle()); Label extLabel = new Label() { TabIndex = 0, Font = new Font("Microsoft Sans Serif", 9.75F, FontStyle.Regular, GraphicsUnit.Point, ((byte)(0))), Text = x.field_name, Size = new Size(16, 16), Dock = DockStyle.Fill }; TextBox extTextBox = new TextBox() { TabIndex = 1, Text = x.field_value, Size = new Size(16, 16), Dock = DockStyle.Fill, ReadOnly = true }; tableLayoutPanel3.Controls.Add(extLabel, 0, tableLayoutPanel3.RowCount - 1); tableLayoutPanel3.Controls.Add(extTextBox, 1, tableLayoutPanel3.RowCount - 1); } // Retrieve Inventory if Exists invitem = await CSeller_Inventory.Retrieve(CUser.cur_user.id, item.id); if (invitem != null) { textBox_Price.Text = invitem.price.ToString(); textBox_Price.ReadOnly = true; foreach (CLocation x in comboBox_Pincode.Items) { if (x.pincode == invitem.pincode) { comboBox_Pincode.SelectedItem = x; break; } } comboBox_Pincode.Enabled = false; textBox_Warranty.Text = invitem.warranty.ToString(); textBox_Warranty.ReadOnly = true; } // Disable Form Auto Size Later Size temp = this.Size; this.AutoSize = false; this.Size = temp; // Enable Size Manager & Force Reset Size Seller_Home_Product_Open_SizeChanged_Custom(null, null); this.SizeChanged += new EventHandler(Seller_Home_Product_Open_SizeChanged_Custom); }