public void productDetailsFill(string strProduct, int inRowIndex, string strFillMode) { try { ProductCreationBll BllProductCreation = new ProductCreationBll(); List<DataTable> listObj = new List<DataTable>(); if (strFillMode == "Barcode") { listObj = BllProductCreation.ProductDetailsCoreespondingToBarcode(strProduct); } else if (strFillMode == "ProductCode") { listObj = BllProductCreation.ProductDetailsCoreespondingToProductCode(strProduct); } else if (strFillMode == "ProductName") { listObj = BllProductCreation.ProductDetailsCoreespondingToProductName(strProduct); } if (listObj[0].Rows.Count != 0) { dgvPhysicalStock.Rows[inRowIndex].Cells["dgvtxtProductCode"].Value = listObj[0].Rows[0]["productCode"].ToString(); dgvPhysicalStock.Rows[inRowIndex].Cells["dgvtxtProductName"].Value = listObj[0].Rows[0]["productName"].ToString(); dgvPhysicalStock.Rows[inRowIndex].Cells["dgvcmbUnit"].Value = Convert.ToDecimal(listObj[0].Rows[0]["unitId"].ToString()); dgvPhysicalStock.Rows[inRowIndex].Cells["dgvcmbBatch"].Value = Convert.ToDecimal(listObj[0].Rows[0]["unitId"].ToString()); decimal decproductId = Convert.ToDecimal(listObj[0].Rows[0]["productId"].ToString()); BatchComboFill(decproductId, inRowIndex, Convert.ToInt32(dgvPhysicalStock.Rows[inRowIndex].Cells["dgvcmbBatch"].ColumnIndex)); dgvPhysicalStock.Rows[inRowIndex].Cells["dgvcmbBatch"].Value = Convert.ToDecimal(listObj[0].Rows[0]["batchId"].ToString()); dgvPhysicalStock.Rows[inRowIndex].Cells["dgvtxtRate"].Value = listObj[0].Rows[0]["purchaseRate"].ToString(); dgvPhysicalStock.Rows[inRowIndex].Cells["dgvcmbGodown"].Value = Convert.ToDecimal(listObj[0].Rows[0]["godownId"].ToString()); dgvPhysicalStock.Rows[inRowIndex].Cells["dgvcmbRack"].Value = Convert.ToDecimal(listObj[0].Rows[0]["rackId"].ToString()); dgvPhysicalStock.Rows[inRowIndex].Cells["dgvtxtQty"].Value = string.Empty; } else { dgvPhysicalStock.Rows[inRowIndex].Cells["dgvtxtProductName"].Value = string.Empty; dgvPhysicalStock.Rows[inRowIndex].Cells["dgvtxtRate"].Value = string.Empty; dgvPhysicalStock.Rows[inRowIndex].Cells["dgvtxtProductCode"].Value = string.Empty; dgvPhysicalStock.Rows[inRowIndex].Cells["dgvcmbUnit"].Value = string.Empty; dgvPhysicalStock.Rows[inRowIndex].Cells["dgvtxtBarcode"].Value = string.Empty; dgvPhysicalStock.Rows[inRowIndex].Cells["dgvcmbBatch"].Value = string.Empty; } } catch (Exception ex) { MessageBox.Show("PS:44" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information); } }
public void productDetailsFill(string strProduct, int inRowIndex, string strFillMode) { try { List<DataTable> listObj = new List<DataTable>(); ProductCreationBll BllProductCreation = new ProductCreationBll(); if (strFillMode == "Barcode") { listObj = BllProductCreation.ProductDetailsCoreespondingToBarcode(strProduct); } else if (strFillMode == "ProductCode") { listObj = BllProductCreation.ProductDetailsCoreespondingToProductCode(strProduct); } else if (strFillMode == "ProductName") { listObj = BllProductCreation.ProductDetailsCoreespondingToProductName(strProduct); } if (listObj[0].Rows.Count != 0) { dgvSalesOrder.Rows[inRowIndex].Cells["dgvtxtProductId"].Value = listObj[0].Rows[0]["productId"].ToString(); decimal decProductId = Convert.ToDecimal(dgvSalesOrder.Rows[inRowIndex].Cells["dgvtxtProductId"].Value.ToString()); dgvSalesOrder.Rows[inRowIndex].Cells["dgvtxtProductCode"].Value = listObj[0].Rows[0]["productCode"].ToString(); dgvSalesOrder.Rows[inRowIndex].Cells["dgvtxtProductName"].Value = listObj[0].Rows[0]["productName"].ToString(); UnitComboFill(Convert.ToDecimal(listObj[0].Rows[0]["productId"].ToString()), inRowIndex, dgvSalesOrder.Rows[inRowIndex].Cells["dgvcmbUnit"].ColumnIndex); dgvSalesOrder.Rows[inRowIndex].Cells["dgvcmbUnit"].Value = Convert.ToDecimal(listObj[0].Rows[0]["unitId"].ToString()); BatchComboFill(Convert.ToDecimal(listObj[0].Rows[0]["productId"].ToString()), inRowIndex, Convert.ToInt32(dgvSalesOrder.Rows[inRowIndex].Cells["dgvcmbBatch"].ColumnIndex)); dgvSalesOrder.Rows[inRowIndex].Cells["dgvcmbBatch"].Value = Convert.ToDecimal(listObj[0].Rows[0]["batchId"].ToString()); decimal decBatchId = Convert.ToDecimal(dgvSalesOrder.Rows[inRowIndex].Cells["dgvcmbBatch"].Value.ToString()); UnitConvertionBll bllUnitConvertion = new UnitConvertionBll(); List<DataTable> listUnitByProduct = new List<DataTable>(); listUnitByProduct = bllUnitConvertion.UnitConversionIdAndConRateViewallByProductId(dgvSalesOrder.Rows[inRowIndex].Cells["dgvtxtProductCode"].Value.ToString()); foreach (DataRow drUnitByProduct in listUnitByProduct[0].Rows) { if (dgvSalesOrder.Rows[inRowIndex].Cells["dgvcmbUnit"].Value.ToString() == drUnitByProduct.ItemArray[0].ToString()) { dgvSalesOrder.Rows[inRowIndex].Cells["dgvtxtUnitConversionId"].Value = Convert.ToDecimal(drUnitByProduct.ItemArray[2].ToString()); dgvSalesOrder.Rows[inRowIndex].Cells["dgvtxtConversionRate"].Value = Convert.ToDecimal(drUnitByProduct.ItemArray[3].ToString()); } } dgvSalesOrder.Rows[inRowIndex].Cells["dgvtxtRate"].Value = Math.Round(Convert.ToDecimal(listObj[0].Rows[0]["salesRate"].ToString()), PublicVariables._inNoOfDecimalPlaces); decCurrentConversionRate = Convert.ToDecimal(dgvSalesOrder.Rows[inRowIndex].Cells["dgvtxtConversionRate"].Value.ToString()); decCurrentRate = Convert.ToDecimal(dgvSalesOrder.Rows[inRowIndex].Cells["dgvtxtRate"].Value.ToString()); getProductRate(inRowIndex, decProductId, decBatchId); } else { dgvSalesOrder.Rows[inRowIndex].Cells["dgvtxtBarcode"].Value = string.Empty; dgvSalesOrder.Rows[inRowIndex].Cells["dgvtxtProductId"].Value = string.Empty; dgvSalesOrder.Rows[inRowIndex].Cells["dgvtxtProductCode"].Value = string.Empty; dgvSalesOrder.Rows[inRowIndex].Cells["dgvtxtProductName"].Value = string.Empty; dgvSalesOrder.Rows[inRowIndex].Cells["dgvcmbUnit"].Value = string.Empty; dgvSalesOrder.Rows[inRowIndex].Cells["dgvcmbBatch"].Value = string.Empty; dgvSalesOrder.Rows[inRowIndex].Cells["dgvtxtUnitConversionId"].Value = string.Empty; dgvSalesOrder.Rows[inRowIndex].Cells["dgvtxtConversionRate"].Value = string.Empty; dgvSalesOrder.Rows[inRowIndex].Cells["dgvtxtRate"].Value = string.Empty; dgvSalesOrder.Rows[inRowIndex].Cells["dgvtxtAmount"].Value = string.Empty; dgvSalesOrder.Rows[inRowIndex].Cells["dgvtxtQty"].Value = string.Empty; } } catch (Exception ex) { MessageBox.Show("SO : 100 " + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information); } }