/// <summary>
 /// fill Items into the purticular controls for Update or delete
 /// </summary>
 public void FillControls()
 {
     try
     {
         StandardRateInfo infoStandardRate = new StandardRateInfo();
         standardRateBll BllStandaredRate = new standardRateBll();
         infoStandardRate = BllStandaredRate.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;
         ProductCreationBll BllProductCreation = new ProductCreationBll();
         ProductInfo infoProduct = new ProductInfo();
         infoProduct = BllProductCreation.ProductViewForStandardRate(decProductId);
         txtProductCode.Text = infoProduct.ProductCode;
         txtProductName.Text = infoProduct.ProductName;
         decStandardRateId = infoStandardRate.StandardRateId;
         UnitInfo infoUnit = new UnitInfo();
         UnitBll bllUnit = new UnitBll();
         infoUnit = bllUnit.UnitView(decUnit);
         txtUnitName.Text = infoUnit.UnitName;
         txtProductName.ReadOnly = true;
         txtProductCode.ReadOnly = true;
         txtUnitName.ReadOnly = true;
         BatchInfo infoBatch = new BatchInfo();
         BatchBll BllBatch = new BatchBll();
         decBatchId = infoStandardRate.BatchId;
         infoBatch = BllBatch.BatchView(decBatchId);
         cmbBatch.SelectedValue = infoBatch.BatchId;
     }
     catch (Exception ex)
     {
         MessageBox.Show("SRP5:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
 }
 /// <summary>
 /// Function to fill the fields while user double click on the datagridview
 /// </summary>
 public void FillControls()
 {
     try
     {
         PriceListInfo infoPricelist = new PriceListInfo();
         PriceListBll BllPriceList = new PriceListBll();
         infoPricelist.PricelistId = decpriceListId;
         infoPricelist = BllPriceList.PriceListView(decpriceListId);
         txtRate.Text = infoPricelist.Rate.ToString();
         ProductInfo infoProduct = new ProductInfo();
         ProductCreationBll BllProductCreation = new ProductCreationBll();
         infoProduct = BllProductCreation.PriceListPopUpView(decProductId);
         txtProductCode.Text = infoProduct.ProductCode;
         txtProductName.Text = infoProduct.ProductName;
         BatchInfo infobatch = new BatchInfo();
        // BatchSP spBatch = new BatchSP();
         BatchBll BllBatch = new BatchBll();
         infobatch = BllBatch.BatchView(decBatchId);
         cmbBatch.SelectedValue = infobatch.BatchId;
         UnitInfo infoUnit = new UnitInfo();
         UnitBll bllUnit = new UnitBll();
         infoUnit = bllUnit.UnitView(decUnitId);
         txtUnitName.Text = infoUnit.UnitName;
         PricingLevelInfo infoPricingLevel = new PricingLevelInfo();
         PricingLevelBll BllPricingLevel = new PricingLevelBll();
         infoPricingLevel = BllPricingLevel.PricingLevelView(decPriceLevelId);
         txtPricingLevel.Text = infoPricingLevel.PricinglevelName;
         txtProductName.ReadOnly = true;
         txtProductCode.ReadOnly = true;
         txtUnitName.ReadOnly = true;
         txtPricingLevel.ReadOnly = true;
     }
     catch (Exception ex)
     {
         MessageBox.Show("PLP9:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
 }
Esempio n. 3
0
 /// <summary>
 /// Function to add the products to grid
 /// </summary>
 public void AddToGrid()
 {
     BatchBll BllBatch = new BatchBll();
     GodownBll BllGodown = new GodownBll();
     try
     {
         SettingsBll BllSettings = new SettingsBll();
         if (txtProductCode.Text.Trim() == null && txtProductCode.Text.Trim() == string.Empty)
         {
             Messages.InformationMessage("Enter product code");
             txtProductCode.Focus();
         }
         else if (cmbItem.SelectedIndex == -1 && cmbItem.SelectedValue == null)
         {
             Messages.InformationMessage("Select a product");
             cmbItem.Focus();
         }
         else if (Convert.ToDecimal(txtQuantity.Text.Trim()) <= 0 || txtQuantity.Text.Trim() == string.Empty)
         {
             Messages.InformationMessage("Enter quantity");
             txtQuantity.Focus();
         }
         else if (cmbUnit.SelectedValue == null)
         {
             Messages.InformationMessage("Select a unit");
             cmbUnit.Focus();
         }
         else if (BllSettings.SettingsStatusCheck("AllowZeroValueEntry") == "No" && decimal.Parse(txtRate.Text.Trim()) <= 0 || txtRate.Text.Trim() == string.Empty)
         {
             Messages.InformationMessage("Enter rate");
             txtRate.Focus();
         }
         else
         {
             int inCurrentRowIndex = new int();
             bool isExecutef = false;
             if (rowIdToEdit == 0)
             {
                 dgvPointOfSales.Rows.Add();
                 inCurrentRowIndex = dgvPointOfSales.Rows.Count - 1;
                 isExecutef = true;
             }
             else
             {
                 for (int i = 0; i < dgvPointOfSales.Rows.Count; ++i)
                 {
                     if (dgvPointOfSales.Rows[i].Cells["rowId"].Value.ToString() == rowIdToEdit.ToString())
                     {
                         isExecutef = true;
                         inCurrentRowIndex = i;
                         break;
                     }
                 }
             }
             if (!isExecutef)
             {
                 dgvPointOfSales.Rows.Add();
                 inCurrentRowIndex = dgvPointOfSales.Rows.Count - 1;
             }
             ProductInfo infoProduct = new ProductInfo();
             BatchInfo infoBatch = new BatchInfo();
             RackInfo infoRack = new RackInfo();
             ProductCreationBll BllProductCreation = new ProductCreationBll();
             UnitConvertionInfo InfoUnitConvertion = new UnitConvertionInfo();
             infoProduct = BllProductCreation.ProductView(decProductId);
             decimal dcProductBatch = BllBatch.BatchIdViewByProductId(decProductId);
             InfoUnitConvertion = new UnitConvertionBll().UnitViewAllByProductId(decProductId);
             infoBatch = BllBatch.BatchView(dcProductBatch);
             decimal dcGodownId = infoProduct.GodownId;
             GodownInfo infoGodown = new GodownInfo();
             infoGodown = BllGodown.GodownView(dcGodownId);
             decimal dcRackId = infoProduct.RackId;
             infoRack = new RackBll().RackView(dcRackId);
             dgvPointOfSales.Rows[inCurrentRowIndex].Cells["dgvtxtProductCode"].Value = txtProductCode.Text;
             dgvPointOfSales.Rows[inCurrentRowIndex].Cells["dgvtxtProductName"].Value = cmbItem.Text;
             dgvPointOfSales.Rows[inCurrentRowIndex].Cells["dgvtxtQuantity"].Value = txtQuantity.Text;
             dgvPointOfSales.Rows[inCurrentRowIndex].Cells["dgvtxtUnit"].Value = cmbUnit.Text;
             dgvPointOfSales.Rows[inCurrentRowIndex].Cells["dgvtxtRate"].Value = txtRate.Text;
             dgvPointOfSales.Rows[inCurrentRowIndex].Cells["dgvtxtGrossValue"].Value = txtGrossValue.Text;
             dgvPointOfSales.Rows[inCurrentRowIndex].Cells["dgvtxtTaxPercentage"].Value = cmbTax.Text;
             dgvPointOfSales.Rows[inCurrentRowIndex].Cells["dgvtxtTaxAmount"].Value = txtTaxAmount.Text;
             dgvPointOfSales.Rows[inCurrentRowIndex].Cells["dgvtxtNetAmount"].Value = txtNetAmount.Text;
             dgvPointOfSales.Rows[inCurrentRowIndex].Cells["dgvtxtDiscount"].Value = txtDiscountAmount.Text;
             dgvPointOfSales.Rows[inCurrentRowIndex].Cells["dgvtxtTotalAmount"].Value = txtAmount.Text;
             dgvPointOfSales.Rows[inCurrentRowIndex].Cells["dgvtxttaxid"].Value = Convert.ToDecimal(cmbTax.SelectedValue);
             dgvPointOfSales.Rows[inCurrentRowIndex].Cells["dgvtxtProductId"].Value = infoProduct.ProductId;
             dgvPointOfSales.Rows[inCurrentRowIndex].Cells["dgvtxtBatchId"].Value = dcProductBatch;
             dgvPointOfSales.Rows[inCurrentRowIndex].Cells["dgvtxtRackId"].Value = infoProduct.RackId;
             dgvPointOfSales.Rows[inCurrentRowIndex].Cells["dgvtxtGodownId"].Value = infoProduct.GodownId;
             dgvPointOfSales.Rows[inCurrentRowIndex].Cells["dgvtxtUnitId"].Value = Convert.ToDecimal(cmbUnit.SelectedValue);
             dgvPointOfSales.Rows[inCurrentRowIndex].Cells["dgvtxtunitconversionId"].Value = InfoUnitConvertion.UnitconvertionId;
             dgvPointOfSales.Rows[inCurrentRowIndex].Cells["dgvtxtBarcode"].Value = txtBarcode.Text;
             dgvPointOfSales.Rows[inCurrentRowIndex].Cells["dgvtxtBatchno"].Value = infoBatch.BatchNo;
             dgvPointOfSales.Rows[inCurrentRowIndex].Cells["dgvtxtGodownName"].Value = infoGodown.GodownName;
             dgvPointOfSales.Rows[inCurrentRowIndex].Cells["dgvtxtRackName"].Value = infoRack.RackName;
             TotalAmountCalculation();
             ClearGroupbox();
             dgvPointOfSales.CurrentCell = dgvPointOfSales[0, dgvPointOfSales.Rows.Count - 1];
             txtBarcode.Focus();
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show("POS:34" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
 }
 /// <summary>
 /// Function to set values to controls when click in grid
 /// </summary>
 public void FillControls()
 {
     try
     {
         BatchInfo infoBatch = new BatchInfo();
         BatchBll BllBatch = new BatchBll();
         infoBatch = BllBatch.BatchView(decId);
         txtBatchName.Text = infoBatch.BatchNo;
         cmbProduct.SelectedValue = infoBatch.ProductId.ToString();
         txtExpiryDate.Text = infoBatch.ExpiryDate.ToString("dd-MMM-yyyy");
         txtMfgDate.Text = infoBatch.ManufacturingDate.ToString("dd-MMM-yyyy");
         txtNarration.Text = infoBatch.narration;
         decBatchId = infoBatch.BatchId;
     }
     catch (Exception ex)
     {
         MessageBox.Show("B8:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
 }