private void rbn_fabricType_CheckedChanged(object sender, EventArgs e) { try { AccountantDBaccess AD = new AccountantDBaccess(); String st = "Sent To Accountant"; grid_product.DataSource = AD.getFabricType(st); p_type.Visible = false; txt_ItemType.Visible = false; p_Ftype.Text = "Fabric Type"; } catch (SqlException) { MetroMessageBox.Show(this, "\n\nConnecton Failed", "Fail", MessageBoxButtons.OK, MessageBoxIcon.Error); } catch (FormatException) { MetroMessageBox.Show(this, "\n\nInvalid Format", "Fail", MessageBoxButtons.OK, MessageBoxIcon.Error); } catch (OutOfMemoryException) { MetroMessageBox.Show(this, "\n\nInsuffisent memory", "Fail", MessageBoxButtons.OK, MessageBoxIcon.Error); } catch (Exception) { MetroMessageBox.Show(this, "\n\nERROR", "Fail", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
private void btn_Conupdate_Click(object sender, EventArgs e) { try { if (grid_product.SelectedRows.Count > 0) { if (rbn_brand.Checked) { AccountantDBaccess AD = new AccountantDBaccess(); Brand B = new Brand(); B.brandId = grid_product.CurrentRow.Cells["brandId"].Value.ToString(); int Status = AD.updateBrandPrice(B); if (Status == 1) { MetroMessageBox.Show(this, "\n\nUpdate confirmed succesfully", "Success", MessageBoxButtons.OK, MessageBoxIcon.Information); } else { MetroMessageBox.Show(this, "\n\nConfirmation Fail", "Fail", MessageBoxButtons.OK, MessageBoxIcon.Error); } String st = "Sent To Accountant"; grid_product.DataSource = AD.getBrand(st); // grid_product.DataSource = AD.getSentAccountantProduct(); } if (rbn_design.Checked) { AccountantDBaccess AD = new AccountantDBaccess(); Design D = new Design(); D.DesignId = grid_product.CurrentRow.Cells["DesignId"].Value.ToString(); int Status = AD.updateDesignPrice(D); if (Status == 1) { MetroMessageBox.Show(this, "\n\nUpdate confirmed succesfully", "Success", MessageBoxButtons.OK, MessageBoxIcon.Information); } else { MetroMessageBox.Show(this, "\n\nConfirmation Fail", "Fail", MessageBoxButtons.OK, MessageBoxIcon.Error); } String st = "Sent To Accountant"; grid_product.DataSource = AD.getDesign(st); } if (rbn_fabricType.Checked) { AccountantDBaccess AD = new AccountantDBaccess(); FabricType F = new FabricType(); F.fabricId = grid_product.CurrentRow.Cells["fabricId"].Value.ToString(); int Status = AD.updatefabricPrice(F); if (Status == 1) { MetroMessageBox.Show(this, "\n\nUpdate confirmed succesfully", "Success", MessageBoxButtons.OK, MessageBoxIcon.Information); } else { MetroMessageBox.Show(this, "\n\nConfirmation Fail", "Fail", MessageBoxButtons.OK, MessageBoxIcon.Error); } String st = "Sent To Accountant"; grid_product.DataSource = AD.getFabricType(st); } if (rbn_size.Checked) { AccountantDBaccess AD = new AccountantDBaccess(); ProductSize P = new ProductSize(); P.PSizeId = grid_product.CurrentRow.Cells["PSizeId"].Value.ToString(); int Status = AD.updateSizePrice(P); if (Status == 1) { MetroMessageBox.Show(this, "\n\nUpdate confirmed succesfully", "Success", MessageBoxButtons.OK, MessageBoxIcon.Information); } else { MetroMessageBox.Show(this, "\n\nConfirmation Fail", "Fail", MessageBoxButtons.OK, MessageBoxIcon.Error); } String st = "Sent To Accountant"; grid_product.DataSource = AD.getProductSize(st); } if (rbn_item.Checked) { AccountantDBaccess AD = new AccountantDBaccess(); Item I = new Item(); I.ItemID = grid_product.CurrentRow.Cells["Item_id"].Value.ToString(); int Status = AD.updateItemPrice(I); if (Status == 1) { MetroMessageBox.Show(this, "\n\nUpdate confirmed succesfully", "Success", MessageBoxButtons.OK, MessageBoxIcon.Information); } else { MetroMessageBox.Show(this, "\n\nConfirmation Fail", "Fail", MessageBoxButtons.OK, MessageBoxIcon.Error); } grid_product.DataSource = AD.getSentAccountantProduct(); } txt_ItemType.Text = ""; txt_Ftype.Text = ""; txt_SalesPrice.Text = ""; } else { MetroMessageBox.Show(this, "\n\nPlease select item from datagrid", "Fail", MessageBoxButtons.OK, MessageBoxIcon.Error); } } catch (SqlException) { MetroMessageBox.Show(this, "\n\nConnecton Failed", "Fail", MessageBoxButtons.OK, MessageBoxIcon.Error); } catch (FormatException) { MetroMessageBox.Show(this, "\n\nInvalid Format", "Fail", MessageBoxButtons.OK, MessageBoxIcon.Error); } catch (OutOfMemoryException) { MetroMessageBox.Show(this, "\n\nInsuffisent memory", "Fail", MessageBoxButtons.OK, MessageBoxIcon.Error); } catch (Exception) { MetroMessageBox.Show(this, "\n\nERROR", "Fail", MessageBoxButtons.OK, MessageBoxIcon.Error); } }