private void button_Click(object sender, EventArgs e) { Guna.UI2.WinForms.Guna2TileButton button = (Guna.UI2.WinForms.Guna2TileButton)sender; int business_type_id = Convert.ToInt32(button.Name); string business_type = button.Text; supplier = new classes.Inventory_Supplier(); supplier.business_type_id = business_type_id; supplier_table = supplier.select_supplier_table(); dgvSupplier.DataSource = supplier_table; dgvSupplier.AutoGenerateColumns = false; if (dgvSupplier.Columns.Contains("action") && dgvSupplier.Columns["action"].Visible) { } else { DataGridViewButtonColumn col_button = new DataGridViewButtonColumn(); { col_button.Name = "action"; col_button.HeaderText = "ACTION"; col_button.Text = "UPDATE"; col_button.UseColumnTextForButtonValue = true; this.dgvSupplier.Columns.Add(col_button); } } }
public void display_supplier() { flpSupplier.Controls.Clear(); inventory_supplier = new classes.Inventory_Supplier(); DataTable dt = (txtSearch.Text == "Search" || string.IsNullOrEmpty(txtSearch.Text)) ? inventory_supplier.select_supplier() : inventory_supplier.select_supplier(txtSearch.Text); if (dt.Rows.Count > 0) { foreach (DataRow row in dt.Rows) { button = new Guna.UI2.WinForms.Guna2TileButton(); button.Name = row["id"].ToString(); button.Text = row["supplier_name"].ToString(); button.Image = (row["logo"] == null) ? null : Image.FromStream(new MemoryStream((Byte[])row["logo"])); button.HoverState.Image = (row["logo"] == null) ? null : Image.FromStream(new MemoryStream((Byte[])row["logo"])); button.ImageSize = new Size(30, 30); button.BorderColor = Color.FromArgb(47, 97, 72); button.BorderRadius = 5; button.BorderStyle = System.Drawing.Drawing2D.DashStyle.Solid; button.BorderThickness = 1; button.Font = new Font("Century Gothic", 9, FontStyle.Regular); button.ForeColor = Color.Black; button.BackColor = Color.White; button.FillColor = Color.White; button.Size = new Size(100, 113); button.Click += new EventHandler(this.button_Click); flpSupplier.Controls.Add(button); } } }
public void display_selected_supplier() { txtCurrentSupplier.Text = supplier_name; supplier = new classes.Inventory_Supplier(); cbSupplier.DataSource = supplier.select_inventory_supplier_except_this(supplier_id); cbSupplier.DisplayMember = "supplier_name"; cbSupplier.ValueMember = "id"; cbSupplier.SelectedIndex = 0; }
private void update_supplier() { supplier = new classes.Inventory_Supplier(); if (supplier.update_inventory_supplier(inventory_id, Convert.ToInt32(cbSupplier.SelectedValue))) { MessageBox.Show("Supplier has been updated!", "Update Supplier", MessageBoxButtons.OK, MessageBoxIcon.Question); frmViewItem.instance.display_selected_inventory(inventory_id); this.Close(); } }
private void btnSave_Click(object sender, EventArgs e) { //MessageBox.Show(request_from); if (txtSupplierID.Text == "Registration/Supplier ID" || string.IsNullOrEmpty(txtSupplierID.Text)) { MessageBox.Show("Please indicate the Supplier ID", "Add Supplier", MessageBoxButtons.OK, MessageBoxIcon.Error); txtSupplierID.Text = ""; txtSupplierID.Focus(); return; } else { if (txtSupplierName.Text == "Business Name" || string.IsNullOrEmpty(txtSupplierName.Text)) { MessageBox.Show("Please indicate the Business Name", "Add Supplier", MessageBoxButtons.OK, MessageBoxIcon.Error); txtSupplierName.Text = ""; txtSupplierName.Focus(); return; } else { if (txtAddress.Text == "Business Address" || string.IsNullOrEmpty(txtAddress.Text)) { MessageBox.Show("Please indicate the Business Address", "Add Supplier", MessageBoxButtons.OK, MessageBoxIcon.Error); txtAddress.Text = ""; txtAddress.Focus(); return; } else { supplier = new classes.Inventory_Supplier(); supplier.business_type_id = business_type_id; supplier.registration_id = txtSupplierID.Text; supplier.supplier_name = txtSupplierName.Text; supplier.address = txtAddress.Text; supplier.contact_number = (txtContactNumber.Text == "Business Contact Number (Optional)" || string.IsNullOrEmpty(txtContactNumber.Text)) ? string.Empty : txtContactNumber.Text; supplier.email = (txtEmail.Text == "Business Email (Optional)" || string.IsNullOrEmpty(txtEmail.Text)) ? string.Empty : txtEmail.Text; supplier.tin = (txtTin.Text == "TIN Number (Optional)" || string.IsNullOrEmpty(txtTin.Text)) ? string.Empty : txtTin.Text; supplier.logo = classes.Configuration.ConvertScreenCaptureToByte(pbPreview.Image); if (supplier.create_supplier()) { if (request_from == "Add Item") { Final.includes.uc.frmDashboard.admin.inv.add_item.ucSelectSupplier.instance.display_supplier(); MessageBox.Show(txtSupplierName.Text + " has been added", "Add Supplier", MessageBoxButtons.OK, MessageBoxIcon.Information); Form fc = Application.OpenForms["frmSelectBusinessType"]; if (fc != null) { fc.Close(); } this.Close(); } } else { return; } } } } }