/// <summary> /// grid cell double click event for editing purpose /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void dgvUnitSearch_CellDoubleClick(object sender, DataGridViewCellEventArgs e) { try { if (dgvUnitSearch.CurrentRow != null) { if (dgvUnitSearch.Rows.Count > 0 && e.ColumnIndex > -1) { if (dgvUnitSearch.CurrentRow.Cells["dgvtxtUnitId"].Value != null) { if (dgvUnitSearch.CurrentRow.Cells["dgvtxtUnitId"].Value.ToString() != string.Empty) { if (Convert.ToDecimal(dgvUnitSearch.CurrentRow.Cells["dgvtxtUnitId"].Value) != 1) { UnitSP spUnit = new UnitSP(); UnitInfo infoUnit = new UnitInfo(); decUnitid = decimal.Parse(dgvUnitSearch.CurrentRow.Cells["dgvtxtUnitId"].Value.ToString()); infoUnit = spUnit.UnitView(decUnitid); txtFormalName.Text = infoUnit.formalName; txtDecimalPlaces.Text = infoUnit.noOfDecimalplaces.ToString(); txtNarration.Text = infoUnit.Narration; txtUnitSearch.Text = string.Empty; txtUnitname.Text = infoUnit.UnitName; strUnitName = infoUnit.UnitName; btnSave.Text = "Update"; txtUnitname.Focus(); btnDelete.Enabled = true; } else { Messages.InformationMessage("Default unit cannot update or delete"); Clear(); } } } } } } catch (Exception ex) { MessageBox.Show("U14:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information); } }
/// <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) { 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(); PriceListSP spPricelist = new PriceListSP(); infoPricelist.PricelistId = decpriceListId; infoPricelist = spPricelist.PriceListView(decpriceListId); txtRate.Text = infoPricelist.Rate.ToString(); ProductInfo infoProduct = new ProductInfo(); ProductSP spProduct = new ProductSP(); infoProduct = spProduct.PriceListPopUpView(decProductId); txtProductCode.Text = infoProduct.ProductCode; txtProductName.Text = infoProduct.ProductName; BatchInfo infobatch = new BatchInfo(); BatchSP spBatch = new BatchSP(); infobatch = spBatch.BatchView(decBatchId); cmbBatch.SelectedValue = infobatch.BatchId; UnitInfo infoUnit = new UnitInfo(); UnitSP spUnit = new UnitSP(); infoUnit = spUnit.UnitView(decUnitId); txtUnitName.Text = infoUnit.UnitName; PricingLevelInfo infoPricingLevel = new PricingLevelInfo(); PricingLevelSP spPricingLevel = new PricingLevelSP(); infoPricingLevel = spPricingLevel.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); } }