Example #1
0
 /// <summary>
 /// Edit function
 /// </summary>
 public void EditFunction()
 {
     try
     {
         StandardRateInfo infoStandardRate = new StandardRateInfo();
         StandardRateSP   spStandardRate   = new StandardRateSP();
         infoStandardRate.StandardRateId = decStandardRate;
         infoStandardRate.ApplicableFrom = Convert.ToDateTime(txtFromDate.Text.ToString());
         infoStandardRate.ApplicableTo   = Convert.ToDateTime(txtToDate.Text.ToString());
         infoStandardRate.ProductId      = decProduct;
         infoStandardRate.UnitId         = decUnitId;
         infoStandardRate.BatchId        = Convert.ToDecimal(cmbBatch.SelectedValue);
         infoStandardRate.Rate           = Convert.ToDecimal(txtRate.Text.ToString());
         infoStandardRate.Extra1         = string.Empty;
         infoStandardRate.Extra2         = string.Empty;
         if (spStandardRate.StandardrateCheckExistence(decStandardRateId, Convert.ToDateTime(txtFromDate.Text.ToString()), Convert.ToDateTime(txtToDate.Text.ToString()), decProduct, infoStandardRate.BatchId) == false)
         {
             spStandardRate.StandardRateEdit(infoStandardRate);
             Messages.UpdatedMessage();
             GridFill(decProduct);
             Clear();
         }
         else
         {
             Messages.InformationMessage("Standard rate already exist for selected product and dates");
         }
     }
     catch (Exception ex)
     {
         formMDI.infoError.ErrorString = "SRP6" + ex.Message;
     }
 }
Example #2
0
 /// <summary>
 /// gridfill function for search and update
 /// </summary>
 /// <param name="decProductId"></param>
 public void GridFill(decimal decProductId)
 {
     try
     {
         StandardRateSP spStandardRate   = new StandardRateSP();
         DataTable      dtblStandardRate = new DataTable();
         dtblStandardRate           = spStandardRate.StandardRateGridFill(decProductId);
         dgvStandardRate.DataSource = dtblStandardRate;
     }
     catch (Exception ex)
     {
         formMDI.infoError.ErrorString = "SRP3" + ex.Message;
     }
 }
Example #3
0
 /// <summary>
 /// Delete function
 /// </summary>
 public void DeleteFunction()
 {
     try
     {
         StandardRateSP spStandardRate = new StandardRateSP();
         spStandardRate.StandardRateDelete(decStandardRate);
         Messages.DeletedMessage();
         decimal decProductId = Convert.ToDecimal(dgvStandardRate.CurrentRow.Cells["dgvtxtProductId"].Value);
         GridFill(decProductId);
         Clear();
     }
     catch (Exception ex)
     {
         formMDI.infoError.ErrorString = "SRP8" + ex.Message;
     }
 }
Example #4
0
 /// <summary>
 /// fill Items into the purticular controls for Update or delete
 /// </summary>
 public void FillControls()
 {
     try
     {
         StandardRateInfo infoStandardRate = new StandardRateInfo();
         StandardRateSP   spStandardRate   = new StandardRateSP();
         infoStandardRate  = spStandardRate.StandardRateView(decStandardRate);
         dtpFromDate.Value = Convert.ToDateTime(infoStandardRate.ApplicableFrom.ToString());
         dtpToDate.Value   = Convert.ToDateTime(infoStandardRate.ApplicableTo.ToString());
         dtpFromDate.Text  = infoStandardRate.ApplicableFrom.ToString();
         dtpToDate.Text    = infoStandardRate.ApplicableTo.ToString();
         txtRate.Text      = infoStandardRate.Rate.ToString();
         decProduct        = infoStandardRate.ProductId;
         decUnitId         = infoStandardRate.UnitId;
         ProductSP   spProduct   = new ProductSP();
         ProductInfo infoProduct = new ProductInfo();
         infoProduct         = spProduct.ProductViewForStandardRate(decProductId);
         txtProductCode.Text = infoProduct.ProductCode;
         txtProductName.Text = infoProduct.ProductName;
         decStandardRateId   = infoStandardRate.StandardRateId;
         UnitInfo infoUnit = new UnitInfo();
         UnitSP   spUnit   = new UnitSP();
         infoUnit                = spUnit.UnitView(decUnit);
         txtUnitName.Text        = infoUnit.UnitName;
         txtProductName.ReadOnly = true;
         txtProductCode.ReadOnly = true;
         txtUnitName.ReadOnly    = true;
         BatchInfo infoBatch = new BatchInfo();
         BatchSP   spBatch   = new BatchSP();
         decBatchId             = infoStandardRate.BatchId;
         infoBatch              = spBatch.BatchView(decBatchId);
         cmbBatch.SelectedValue = infoBatch.BatchId;
     }
     catch (Exception ex)
     {
         formMDI.infoError.ErrorString = "SRP5" + ex.Message;
     }
 }