public static int addStockConversion(StockConversion stockConversion) { try { int result = 0; result = stockConversionProvider.addStockConversion(stockConversion); return(result); } catch (Exception ae) { throw ae; } }
public static int addStockConversion(StockConversion stockConversion) { try { List <KeyValuePair <string, object> > parameter = new List <KeyValuePair <string, object> >(); parameter.Add(new KeyValuePair <string, object>("@stockConversionId", stockConversion.stockConversionId)); parameter.Add(new KeyValuePair <string, object>("@stockConversionIvoiceId", stockConversion.stockConversionIvoiceId)); parameter.Add(new KeyValuePair <string, object>("@stockconversionDate", stockConversion.stockconversionDate)); parameter.Add(new KeyValuePair <string, object>("@stockFromID", stockConversion.stockFromID)); parameter.Add(new KeyValuePair <string, object>("@fromQty", stockConversion.fromQty)); parameter.Add(new KeyValuePair <string, object>("@stockToId", stockConversion.stockToId)); parameter.Add(new KeyValuePair <string, object>("@toQty", stockConversion.toQty)); parameter.Add(new KeyValuePair <string, object>("@financialYearID", stockConversion.financialYearID)); parameter.Add(new KeyValuePair <string, object>("@isDelete", stockConversion.isDelete)); SqlHandler sqlH = new SqlHandler(); int result = sqlH.ExecuteNonQueryI("[dbo].[Usp_addUpdateStockConversion]", parameter); return(result); } catch (Exception ae) { throw ae; } }
private void btnSave_Click(object sender, EventArgs e) { try{ if (txtItemName.Text.Trim() == string.Empty) { if (Utility.Langn == "English") { MessageBox.Show("Please Add item name."); } else { MessageBox.Show("कृपया वस्तूचे नाव भरा."); } txtItemName.Focus(); return; } if (txtQuantity.Text.Trim() == string.Empty) { if (Utility.Langn == "English") { MessageBox.Show("Please add Quantity"); } else { MessageBox.Show("कृपया वस्तूचे नग भरा."); } txtItemName.Focus(); return; } if (txtToStock.Text.Trim() == string.Empty) { if (Utility.Langn == "English") { MessageBox.Show("Please Add To Stock."); } else { MessageBox.Show("कृपया वस्तूचे नाव भरा."); } txtToStock.Focus(); return; } if (txtToQuantity.Text.Trim() == string.Empty) { if (Utility.Langn == "English") { MessageBox.Show("Please add item quantity"); } else { MessageBox.Show("कृपया वस्तूचे नग भरा."); } txtToQuantity.Focus(); return; } else { StockConversion stoConversion = new StockConversion(); if (isDelete == true) { stoConversion.stockConversionId = stockconversionId; } else { stoConversion.stockConversionId = 0; } stoConversion.stockConversionIvoiceId = txtInvoiceNo.Text.Trim(); stoConversion.stockconversionDate = Convert.ToDateTime(dtpChallenDate.Value.ToLongDateString()); stoConversion.stockFromID = stockFromID; stoConversion.stockToId = stockToId; stoConversion.fromQty = Utility.ParseValue(txtQuantity.Text.Trim()); stoConversion.toQty = Utility.ParseValue(txtToQuantity.Text.Trim()); stoConversion.financialYearID = Utility.FinancilaYearId; int result = stockConversionController.addStockConversion(stoConversion); if (result > 0) { if (isDelete == true) { if (Utility.Langn == "English") { MessageBox.Show("This record deleted successfully ... !", "Save", MessageBoxButtons.OK, MessageBoxIcon.Information); } else { MessageBox.Show("सदर नोंद यशस्वीरित्या डिलीट केले गेले आहे ... !", "Save", MessageBoxButtons.OK, MessageBoxIcon.Information); } } else { if (Utility.Langn == "English") { MessageBox.Show("This Record saved successfully..!", "Save", MessageBoxButtons.OK, MessageBoxIcon.Information); } else { MessageBox.Show("सदर नोंद यशस्वीरित्या साठवले गेले आहे..!", "Save", MessageBoxButtons.OK, MessageBoxIcon.Information); } } btnnew_Click(sender, e); } } } catch (Exception ae) { if (Utility.Langn == "English") { MessageBox.Show("While Saving this record error occurs"); } else { MessageBox.Show("सदर रेकोर्ड साठवण्यास त्रुटी येत आहे"); } } }