/// <summary> /// Function to save the new pricelist for the product /// </summary> public void SaveFunction() { try { PriceListSP spPriceList = new PriceListSP(); PriceListInfo infoPriceList = new PriceListInfo(); infoPriceList.ProductId = decProductMain; infoPriceList.PricinglevelId = decPricingLevelMain; infoPriceList.UnitId = decUnitId; infoPriceList.BatchId = Convert.ToDecimal(cmbBatch.SelectedValue.ToString()); infoPriceList.Rate = Convert.ToDecimal(txtRate.Text); infoPriceList.Extra1 = string.Empty; infoPriceList.Extra2 = string.Empty; if (spPriceList.PriceListCheckExistence(0, decPricingLevelMain, Convert.ToDecimal(cmbBatch.SelectedValue.ToString()), decProductMain) == true) { spPriceList.PriceListAdd(infoPriceList); Messages.SavedMessage(); Clear(); } else { Messages.InformationMessage("Price List already exist for selected product and batches"); Clear(); } } catch (Exception ex) { MessageBox.Show("PLP2" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information); } }
/// <summary> /// Function to PriceList CheckExistence /// </summary> /// <param name="decpricelistId"></param> /// <param name="decpricinglevelId"></param> /// <param name="decbatchId"></param> /// <param name="decProductId"></param> /// <returns></returns> public bool PriceListCheckExistence(decimal decpricelistId, decimal decpricinglevelId, decimal decbatchId, decimal decProductId) { bool isExist = false; try { isExist = spPriceList.PriceListCheckExistence(decpricelistId, decpricinglevelId, decbatchId, decProductId); } catch (Exception ex) { MessageBox.Show("AL20:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information); } return(isExist); }