public override void buttonSave_Click(object sender, EventArgs e) { if (textBoxCategoryName.Text == "") { labelCategoryNameError.Visible = true; } else { labelCategoryNameError.Visible = false; } if (comboBoxIsSales.SelectedIndex == -1) { labelIsSalesError.Visible = true; } else { labelIsSalesError.Visible = false; } if (labelCategoryNameError.Visible || labelIsSalesError.Visible) { MainClass.ShowMessage("Fields with * are mandatory", "Error", "Error"); //Error is the type of message. } else { if (comboBoxIsSales.SelectedIndex == 1) { stat = 0; } else if (comboBoxIsSales.SelectedIndex == 0) { stat = 1; } if (edit == 0) //Code for save operation { Insertion insert = new Insertion(); insert.SaveCategoryDetails(textBoxCategoryName.Text, stat); retrieve.ShowCategories(dataGridViewCat, catIdGV, CatGVName, CatGVStatus); MainClass.Disable_Reset(panelRightSlider); } else if (edit == 1) //code for update operaiton { DialogResult dr = MessageBox.Show("Are you sure, you want to update record.", "Warning", MessageBoxButtons.YesNo, MessageBoxIcon.Question); if (dr == DialogResult.Yes) { Updation update = new Updation(); update.UpdateCategoryDetails(textBoxCategoryName.Text, stat, CategoryId); retrieve.ShowCategories(dataGridViewCat, catIdGV, CatGVName, CatGVStatus); MainClass.Disable_Reset(panelRightSlider); } } } }
public override void buttonSave_Click(object sender, EventArgs e) { if (dataGridViewPOLines.Rows.Count > 0) { int quantityReceivedCheck = 0; foreach (DataGridViewRow row in dataGridViewPOLines.Rows) { if (row.Cells["QuantityReceivedDgv"].Value == null || row.Cells["QuantityReceivedDgv"].Value == string.Empty) { break; } quantityReceivedCheck += 1; } if (quantityReceivedCheck < dataGridViewPOLines.Rows.Count) { MainClass.ShowMessage("Please Enter received qunatity for all lines.", "Error", "Error"); } else { Updation Update = new Updation(); Insertion insert = new Insertion(); using (TransactionScope tc = new TransactionScope()) { ReceivingId = insert.SaveReceiving(POId, Convert.ToDecimal(labelGrandTotalValue.Text)); int recvLines = 0; foreach (DataGridViewRow row in dataGridViewPOLines.Rows) { recvLines += insert.SaveReceiveLine(ReceivingId, Convert.ToInt32(row.Cells["ProductIdGv"].Value), Convert.ToDecimal(row.Cells["ReceivedQuantityCostDgv"].Value), Convert.ToDecimal(row.Cells["QuantityReceivedDgv"].Value), Convert.ToInt32(row.Cells["LineNo"].Value)); } if (recvLines > 0) { Update.UpdatePOStatus(POId, 2); MainClass.ShowMessage("Receiving perfromed successfully.", "Success", "Success"); CreateReceivingPdfReport(ReceivingId, POId); } else { MainClass.ShowMessage("Unable to perform receiving.", "Error", "Error"); } tc.Complete(); } } } else { MainClass.ShowMessage("Please Select a Purchase Order to perform receiving.", "Error", "Error"); } }
public override void buttonSave_Click(object sender, EventArgs e) { if (dataGridViewSalesLines.Rows.Count > 0) { int SalesID = 0; Insertion insert = new Insertion(); using (TransactionScope tc = new TransactionScope()) { SalesID = insert.SaveSales(Convert.ToInt32(comboBoxCustomer.SelectedValue), Convert.ToDecimal(labelGrandTotalValue.Text), Retrievel.User_ID); int SalesLines = 0; foreach (DataGridViewRow row in dataGridViewSalesLines.Rows) { SalesLines += insert.SaveSalesLine(SalesID, Convert.ToInt32(row.Cells["ProductIdGv"].Value), Convert.ToDecimal(row.Cells["ProductTotalPrice"].Value), Convert.ToDecimal(row.Cells["ProductQuantityGv"].Value), row.Cells["Unit"].Value.ToString(), Convert.ToInt32(row.Cells[1].Value)); if (SalesLines > 0) //decrease the stock { Updation update = new Updation(); int rowsDec = update.UpdateDecreaseAvailableStocks(Convert.ToInt32(row.Cells["ProductIdGv"].Value), Convert.ToDecimal(row.Cells["ProductQuantityGv"].Value)); } } if (SalesLines > 0) { MainClass.ShowMessage("Sales Invoice Created Successfully.", "Success", "Success"); dataGridViewSalesLines.Rows.Clear(); textBoxSalesNumber.Text = retrieve.RetrunSalesNumber().ToString(); comboBoxCustomer.Text = ""; comboBoxSelectProduct.Text = ""; textBoxUnit.Clear(); textBoxQuantity.Clear(); textBoxProdCost.Clear(); textBoxTotalCost.Clear(); CreateSalesPdfReport(SalesID); labelGrandTotalValue.Text = "0.00"; } else { MainClass.ShowMessage("Unable to create Sales Invoice.", "Error", "Error"); } tc.Complete(); } } }
public override void buttonSave_Click(object sender, EventArgs e) { if (dataGridViewPOLines.Rows.Count > 0) { int PoId = 0; Insertion insert = new Insertion(); using (TransactionScope tc = new TransactionScope()) { PoId = insert.SavePO(Convert.ToInt32(comboBoxSupplier.SelectedValue), dateTimePickerExpectedDelDate.Value, Convert.ToDecimal(labelGrandTotalValue.Text), Retrievel.User_ID); int PoLines = 0; foreach (DataGridViewRow row in dataGridViewPOLines.Rows) { PoLines += insert.SavePoLine(PoId, Convert.ToInt32(row.Cells["ProductIdGv"].Value), Convert.ToDecimal(row.Cells["ProductTotalPrice"].Value), Convert.ToDecimal(row.Cells["ProductQuantityGv"].Value), Convert.ToInt32(row.Cells[1].Value), (row.Cells["Unit"].Value).ToString()); } if (PoLines > 0) { MainClass.ShowMessage("Purchase Order Created Successfully.", "Success", "Success"); dataGridViewPOLines.Rows.Clear(); textBoxPONumber.Text = retrieve.RetrunPoNumber().ToString(); comboBoxSupplier.Text = ""; comboBoxSelectProduct.Text = ""; textBoxUnit.Clear(); textBoxQuantity.Clear(); textBoxProdCost.Clear(); textBoxTotalCost.Clear(); CreatePOPdfReport(PoId); labelGrandTotalValue.Text = "0.00"; } else { MainClass.ShowMessage("Unable to create Purchase Order.", "Error", "Error"); } tc.Complete(); } } }
public override void buttonSave_Click(object sender, EventArgs e) { if (textBoxSupplierName.Text == "") { labelSupplierNameError.Visible = true; } else { labelSupplierNameError.Visible = false; } if (textBoxSupplierCode.Text == "") { labelSupplierCodeError.Visible = true; } else { labelSupplierCodeError.Visible = false; } if (textBoxSupplierContactNumber.Text == "") { labelSupplierContactError.Visible = true; } else { labelSupplierContactError.Visible = false; } if (textBoxSupplierEmail.Text == "") { labelSupplierEmailError.Visible = true; } else { labelSupplierEmailError.Visible = false; } if (textBoxAddress.Text == "") { labelAddressError.Visible = true; } else { labelAddressError.Visible = false; } if (textBoxSupplierCity.Text == "") { labelSupplierCityError.Visible = true; } else { labelSupplierCityError.Visible = false; } if (textBoxCountry.Text == "") { labelCountryError.Visible = true; } else { labelCountryError.Visible = false; } if (textBoxPayment.Text == "") { labelPaymentError.Visible = true; } else { labelPaymentError.Visible = false; } if (textBoxDeliveryMethod.Text == "") { labelDelMethodError.Visible = true; } else { labelDelMethodError.Visible = false; } if (textBoxDelLeadTime.Text == "") { labelDelLeadTimeError.Visible = true; } else { labelDelLeadTimeError.Visible = false; } if (labelSupplierNameError.Visible || labelSupplierCodeError.Visible || labelSupplierContactError.Visible || labelSupplierEmailError.Visible || labelAddressError.Visible || labelSupplierCityError.Visible || labelCountryError.Visible || labelDelMethodError.Visible || labelPaymentError.Visible || labelDelLeadTimeError.Visible) { MainClass.ShowMessage("Fields with * are mandatory", "Error", "Error"); //Error is the type of message. } else { if (edit == 0) //Code for save operation { Insertion insert = new Insertion(); insert.SaveSupplierDetails(textBoxSupplierName.Text, textBoxSupplierCode.Text, textBoxSupplierContactNumber.Text, textBoxSupplierEmail.Text, textBoxAddress.Text, textBoxSupplierCity.Text, textBoxCountry.Text, textBoxPayment.Text, textBoxDeliveryMethod.Text, textBoxDelLeadTime.Text, Convert.ToDecimal(textBoxDelLeadTime.Text)); retrieve.ShowSupplier(dataGridViewSupplier, SupplierIdGv, SupplierNameGv, SupplierCodeGv, SupplierContactNumberGv, SupplierEmailGv, SupplierAddresseGv, SupplierCityGv, SupplierCountryGv, SupplierPaymentMethodGv, SupplierDeliveryMethodGv, SupplierDeliveryLeadTimeIdGv); MainClass.Disable_Reset(panelRightSlider); } else if (edit == 1) //code for update operaiton { DialogResult dr = MessageBox.Show("Are you sure, you want to update record.", "Warning", MessageBoxButtons.YesNo, MessageBoxIcon.Question); if (dr == DialogResult.Yes) { Updation update = new Updation(); update.UpdateSupplierDetails(textBoxSupplierName.Text, textBoxSupplierCode.Text, textBoxSupplierContactNumber.Text, textBoxSupplierEmail.Text, textBoxAddress.Text, textBoxSupplierCity.Text, textBoxCountry.Text, textBoxPayment.Text, textBoxDeliveryMethod.Text, textBoxDelLeadTime.Text, Convert.ToDecimal(textBoxDelLeadTime.Text), SupplierId); retrieve.ShowSupplier(dataGridViewSupplier, SupplierIdGv, SupplierNameGv, SupplierCodeGv, SupplierContactNumberGv, SupplierEmailGv, SupplierAddresseGv, SupplierCityGv, SupplierCountryGv, SupplierPaymentMethodGv, SupplierDeliveryMethodGv, SupplierDeliveryLeadTimeIdGv); MainClass.Disable_Reset(panelRightSlider); } } } }
public override void buttonSave_Click(object sender, EventArgs e) { if (textBoxUserName.Text == "") { labelNameError.Visible = true; } else { labelNameError.Visible = false; } if (textBoxPasword.Text == "") { labelPasswordError.Visible = true; } else { labelPasswordError.Visible = false; } if (textBoxContact.Text == "") { labelContactNumberError.Visible = true; } else { labelContactNumberError.Visible = false; } if (textBoxEmail.Text == "") { labelEmailError.Visible = true; } else { labelEmailError.Visible = false; } if (comboBoxSelectRole.SelectedIndex == -1) { labelRoleError.Visible = true; } else { labelRoleError.Visible = false; } if (labelNameError.Visible || labelPasswordError.Visible || labelContactNumberError.Visible || labelEmailError.Visible || labelRoleError.Visible) { MainClass.ShowMessage("Fields with * are mandatory", "Error", "Error"); //Error is the type of message. } else { if (edit == 0) //Code for save operation { Insertion insert = new Insertion(); insert.SaveUserDetails(textBoxUserName.Text, textBoxPasword.Text, textBoxContact.Text, textBoxEmail.Text, Convert.ToInt32(comboBoxSelectRole.SelectedValue)); retrieve.ShowUsers(dataGridViewUsers, UserIdGV, UsernameGV, PasswordGV, ContactGv, EmailGV, Role, RoleId); MainClass.Disable_Reset(panelRightSlider); } else if (edit == 1) //code for update operaiton { DialogResult dr = MessageBox.Show("Are you sure, you want to update record.", "Warning", MessageBoxButtons.YesNo, MessageBoxIcon.Question); if (dr == DialogResult.Yes) { Updation update = new Updation(); update.UpdateUserDetails(textBoxUserName.Text, textBoxPasword.Text, textBoxContact.Text, textBoxEmail.Text, userId, Convert.ToInt32(comboBoxSelectRole.SelectedValue)); retrieve.ShowUsers(dataGridViewUsers, UserIdGV, UsernameGV, PasswordGV, ContactGv, EmailGV, Role, RoleId); MainClass.Disable_Reset(panelRightSlider); } } } }