private void ImportFileData(DataTable dt) { try { Updation update = new Updation(); foreach (DataRow row in dt.Rows) { DataTable dtProductId = retrieve.GetId("usp_GetProductID", row[0].ToString()); //stocks in update.UpdateIncreaseAvailableStocks(Convert.ToInt32(dtProductId.Rows[0][0].ToString()), Convert.ToDecimal(row[2]), Convert.ToDateTime(row[1])); //stocks out update.UpdateDecreaseAvailableStocks(Convert.ToInt32(dtProductId.Rows[0][0].ToString()), Convert.ToDecimal(row[3]), Convert.ToDateTime(row[1])); //stock onhold update.UpdateIncreaseInOnHoldStocks(Convert.ToInt32(dtProductId.Rows[0][0].ToString()), Convert.ToDecimal(row[4]), Convert.ToDateTime(row[1])); //resolve onhold update.UpdateResolveInOnHoldStocks(Convert.ToInt32(dtProductId.Rows[0][0].ToString()), Convert.ToDecimal(row[5]), Convert.ToDateTime(row[1])); //stock rejected update.UpdateIncreaseRejectedStocks(Convert.ToInt32(dtProductId.Rows[0][0].ToString()), Convert.ToDecimal(row[6]), Convert.ToDateTime(row[1])); //resolve rejected update.UpdateIResolveRejectedStocks(Convert.ToInt32(dtProductId.Rows[0][0].ToString()), Convert.ToDecimal(row[7]), Convert.ToDateTime(row[1])); //stock reworked update.UpdateIncreaseInReworkedStocks(Convert.ToInt32(dtProductId.Rows[0][0].ToString()), Convert.ToDecimal(row[8]), Convert.ToDateTime(row[1])); //resolve reworked update.UpdateResolveInReworkedStocks(Convert.ToInt32(dtProductId.Rows[0][0].ToString()), Convert.ToDecimal(row[9]), Convert.ToDateTime(row[1])); } MainClass.ShowMessage("Stocks Updated Successfully. ", "Success", "Success"); } catch (Exception exp) { MainClass.ShowMessage(exp.Message, "Error", "Error"); } }
public override void buttonSave_Click(object sender, EventArgs e) { if (dataGridViewPOLines.Rows.Count > 0) { Updation Update = new Updation(); using (TransactionScope tc = new TransactionScope()) { int PoLines = 0; foreach (DataGridViewRow row in dataGridViewPOLines.Rows) { Update.UpdatePODetails(POId, Convert.ToInt32(row.Cells["ProductIdGv"].Value), Convert.ToDecimal(row.Cells["ProductTotalPrice"].Value), Convert.ToDecimal(row.Cells["ProductQuantityGv"].Value), Convert.ToInt32(row.Cells["LineNo"].Value)); PoLines += 1; } if (PoLines > 0) { Update.UpdatePOPrice(POId, Convert.ToDecimal(labelGrandTotalValue.Text)); MainClass.ShowMessage("Purchase Order Updated Successfully.", "Success", "Success"); } else { MainClass.ShowMessage("Unable to Update Purchase Order.", "Error", "Error"); } tc.Complete(); } } }
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"); } }
private void buttonAddToStocks_Click(object sender, EventArgs e) { if (comboBoxSelectProduct.SelectedIndex == -1) { labelProductDateError.Visible = true; } else { labelProductDateError.Visible = false; } if (textBoxQuantity.Text == "") { labelQuantityError.Visible = true; } else { labelQuantityError.Visible = false; } if (labelProductDateError.Visible || labelQuantityError.Visible) { MainClass.ShowMessage("Fields with * are mandatory", "Error", "Error"); //Error is the type of message. } else { Updation update = new Updation(); update.UpdateIncreaseRejectedStocks(Convert.ToInt32(comboBoxSelectProduct.SelectedValue.ToString()), Convert.ToDecimal(textBoxQuantity.Text), dateTimePickerEntryDate.Value); ShowDataInGrid(); //foreach (DataGridViewRow rows in dataGridViewProduct.Rows) //{ // if(Convert.ToDecimal(rows.Cells["ProductMinValGv"].Value)< Convert.ToDecimal(rows.Cells["AvailableStocks"].Value)) // { // rows.Cells["AvailableStocks"].Style.BackColor = Color.LightGreen; // rows.Cells["AvailableStocks"].Style.ForeColor = Color.Black; // } // else // { // rows.Cells["AvailableStocks"].Style.BackColor = Color.IndianRed; // rows.Cells["AvailableStocks"].Style.ForeColor = Color.Black; // } //} MainClass.ShowMessage("Stocks added sucessfully", "Success", "Success"); textBoxQuantity.Clear(); } }
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(); } } }
private void Load() { Updation update = new Updation(); update.UpdateStockDailyStatus(); timer2.Start(); StockNotification = retrieve.StocksStatusNotification(); if (StockNotification == 1) { labelNotifcationStatus.Text = "Stocks are at Minimum level."; comboBoxProducts.Visible = true; linkLabelMin.Visible = true; retrieve.GetListsComboStocks("Usp_ProductsWithMinValuesofStocks", comboBoxProducts, "ProductName", "ID"); } // labelUser.Text = Retrievel.User_Name; }
private void buttonResolveRejecteStock_Click(object sender, EventArgs e) { if (comboBoxSelectProduct.SelectedIndex == -1) { labelProductDateError.Visible = true; } else { labelProductDateError.Visible = false; } if (textBoxQuantity.Text == "") { labelQuantityError.Visible = true; } else { labelQuantityError.Visible = false; } if (labelProductDateError.Visible || labelQuantityError.Visible) { MainClass.ShowMessage("Fields with * are mandatory", "Error", "Error"); //Error is the type of message. } else { Updation update = new Updation(); int row = update.UpdateIResolveRejectedStocks(Convert.ToInt32(comboBoxSelectProduct.SelectedValue.ToString()), Convert.ToDecimal(textBoxQuantity.Text), dateTimePickerEntryDate.Value); if (row > 0) { ShowDataInGrid(); MainClass.ShowMessage("Stocks added sucessfully", "Success", "Success"); textBoxQuantity.Clear(); } else { MainClass.ShowMessage("Please Add Rejected Stocks first.", "Error", "Error"); } } }
public override void buttonSave_Click(object sender, EventArgs e) { if (textBoxProductName.Text == "") { labelProductNameError.Visible = true; } else { labelProductNameError.Visible = false; } if (textBoxProductCode.Text == "") { labelProductCodeError.Visible = true; } else { labelProductCodeError.Visible = false; } if (textBoxPrice.Text == "") { labelPurchasePriceError.Visible = true; } else { labelPurchasePriceError.Visible = false; } if (textBoxUnit.Text == "") { labelUnitError.Visible = true; } else { labelUnitError.Visible = false; } if (textBoxMinimumValue.Text == "") { labelMinValueError.Visible = true; } else { labelMinValueError.Visible = false; } if (textBoxSalesPrice.Text == "") { labelSalePriceError.Visible = true; } else { labelSalePriceError.Visible = false; } if (comboBoxCategory.SelectedIndex == -1) { labelCategoryError.Visible = true; } else { labelCategoryError.Visible = false; } if (labelProductNameError.Visible || labelProductCodeError.Visible || labelPurchasePriceError.Visible || labelUnitError.Visible || labelMinValueError.Visible || labelCategoryError.Visible || labelSalePriceError.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.SaveProductDetails(textBoxProductName.Text, textBoxProductCode.Text, Convert.ToDecimal(textBoxPrice.Text), textBoxUnit.Text, Convert.ToDecimal(textBoxMinimumValue.Text), Convert.ToInt32(comboBoxCategory.SelectedValue), Convert.ToDecimal(textBoxSalesPrice.Text), true); retrieve.ShowProducts(dataGridViewProduct, ProductIdGv, ProductNameGv, ProductCodeGv, ProductPriceGv, ProductUnitGv, ProductMinValGv, ProductCatNameGv, ProductCatIdGv, SalesPriceGv); //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.UpdateProductDetails(textBoxProductName.Text, textBoxProductCode.Text, Convert.ToDecimal(textBoxPrice.Text), textBoxUnit.Text, Convert.ToDecimal(textBoxMinimumValue.Text), CategoryId, ProductId, Convert.ToDecimal(textBoxSalesPrice.Text)); retrieve.ShowProducts(dataGridViewProduct, ProductIdGv, ProductNameGv, ProductCodeGv, ProductPriceGv, ProductUnitGv, ProductMinValGv, ProductCatNameGv, ProductCatIdGv, SalesPriceGv); // MainClass.Disable_Reset(panelRightSlider); } } } }
private void buttonAddToStocks_Click(object sender, EventArgs e) { if (comboBoxSelectProduct.SelectedIndex == -1) { labelProductDateError.Visible = true; } else { labelProductDateError.Visible = false; } if (string.IsNullOrEmpty(textBoxQuantity.Text)) { labelQuantityError.Visible = true; } else { labelQuantityError.Visible = false; } if (string.IsNullOrEmpty(dateTimePickerEntryDate.Text)) { labelEntryDateError.Visible = true; } else { labelEntryDateError.Visible = false; } if (labelProductDateError.Visible || labelQuantityError.Visible || labelEntryDateError.Visible) { MainClass.ShowMessage("Fields with * are mandatory", "Error", "Error"); //Error is the type of message. } else { Updation update = new Updation(); update.UpdateIncreaseAvailableStocks(Convert.ToInt32(comboBoxSelectProduct.SelectedValue.ToString()), Convert.ToDecimal(textBoxQuantity.Text), dateTimePickerEntryDate.Value); retrieve.ShowStock(dataGridViewProduct, ProductIdGv, ProductNameGv, ProductCodeGv, ProductUnitGv, ProductMinValGv, AvailableStocks, ReworkedStock, RejectedStock, OnholdStock); foreach (DataGridViewRow rows in dataGridViewProduct.Rows) { if (Convert.ToDecimal(rows.Cells["ProductMinValGv"].Value) < Convert.ToDecimal(rows.Cells["AvailableStocks"].Value)) { rows.Cells["ProductNameGv"].Style.BackColor = Color.LightGreen; rows.Cells["ProductNameGv"].Style.ForeColor = Color.Black; rows.Cells["AvailableStocks"].Style.BackColor = Color.LightGreen; rows.Cells["AvailableStocks"].Style.ForeColor = Color.Black; } else { rows.Cells["ProductNameGv"].Style.BackColor = Color.IndianRed; rows.Cells["ProductNameGv"].Style.ForeColor = Color.Black; rows.Cells["AvailableStocks"].Style.BackColor = Color.IndianRed; rows.Cells["AvailableStocks"].Style.ForeColor = Color.Black; } } MainClass.ShowMessage("Stocks added sucessfully", "Success", "Success"); textBoxQuantity.Clear(); } }
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); } } } }