/// <summary> /// save function /// </summary> public void SaveFunction() { decimal decBatchId = 0; try { StandardRateInfo infoStandardRate = new StandardRateInfo(); StandardRateSP spStandardRate = new StandardRateSP(); infoStandardRate.ApplicableFrom = Convert.ToDateTime(txtFromDate.Text.ToString()); infoStandardRate.ApplicableTo = Convert.ToDateTime(txtToDate.Text.ToString()); infoStandardRate.ProductId = decProduct; infoStandardRate.UnitId = decUnitId; decBatchId = Convert.ToDecimal(cmbBatch.SelectedValue.ToString()); infoStandardRate.BatchId = decBatchId; infoStandardRate.Rate = Convert.ToDecimal(txtRate.Text.ToString()); infoStandardRate.Extra1 = string.Empty; infoStandardRate.Extra2 = string.Empty; if (spStandardRate.StandardrateCheckExistence(0, Convert.ToDateTime(txtFromDate.Text.ToString()), Convert.ToDateTime(txtToDate.Text.ToString()), decProduct, decBatchId) == false) { spStandardRate.StandardRateAddParticularfields(infoStandardRate); Messages.SavedMessage(); GridFill(decProduct); Clear(); } else { Messages.InformationMessage("Standard rate already exist for selected product,Batch and dates"); Clear(); } } catch (Exception ex) { MessageBox.Show("SRP4:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information); } }
/// <summary> /// Function to insert values to StandardRate Table and return the Curresponding row's Id /// </summary> /// <param name="standardrateinfo"></param> /// <returns></returns> public decimal StandardRateAddParticularfields(StandardRateInfo standardrateinfo) { decimal decStandardRateId = 0; try { decStandardRateId = spStandaredRate.StandardRateAddParticularfields(standardrateinfo); } catch (Exception ex) { MessageBox.Show("AL6:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information); } return(decStandardRateId); }