/// <summary> /// Function to fill product Details while return from Product creation when creating new Product /// </summary> /// <param name="decProductId"></param> public void ReturnFromProductCreation(decimal decProductId) { try { if (decProductId != 0) { this.Enabled = true; ProductInfo infoProduct = new ProductInfo(); ProductCreationBll BllProductCreation = new ProductCreationBll(); infoProduct = BllProductCreation.productViewByProductId(decProductId); isValueChange = true; dgvPurchaseOrder.CurrentRow.Cells["dgvtxtProductCode"].Value = infoProduct.ProductCode; dgvPurchaseOrder.CurrentRow.Cells["dgvtxtProductName"].Value = infoProduct.ProductName; dgvPurchaseOrder.CurrentRow.Cells["dgvtxtRate"].Value = infoProduct.PurchaseRate; UnitComboFill(decProductId, dgvPurchaseOrder.CurrentRow.Index, dgvPurchaseOrder.CurrentRow.Cells["dgvcmbUnit"].ColumnIndex); dgvPurchaseOrder.CurrentRow.Cells["dgvcmbUnit"].Value = infoProduct.UnitId; UnitConvertionBll bllUnitConvertion = new UnitConvertionBll(); listunitconversionViewAll = bllUnitConvertion.UnitConversionIdAndConRateViewallByProductId(infoProduct.ProductCode); foreach (DataRow drUnitByProduct in listunitconversionViewAll[0].Rows) { if (dgvPurchaseOrder.CurrentRow.Cells["dgvcmbUnit"].Value.ToString() == drUnitByProduct.ItemArray[0].ToString()) { dgvPurchaseOrder.CurrentRow.Cells["dgvtxtUnitConversionId"].Value = drUnitByProduct.ItemArray[2].ToString(); dgvPurchaseOrder.CurrentRow.Cells["dgvtxtUnitConversionRate"].Value = drUnitByProduct.ItemArray[3].ToString(); } } decCurrentConversionRate = Convert.ToDecimal(dgvPurchaseOrder.CurrentRow.Cells["dgvtxtUnitConversionRate"].Value.ToString()); decCurrentRate = Convert.ToDecimal(dgvPurchaseOrder.CurrentRow.Cells["dgvtxtRate"].Value.ToString()); NewAmountCalculation("dgvtxtQty", dgvPurchaseOrder.CurrentRow.Index); CalculateTotalAmount(); } } catch (Exception ex) { MessageBox.Show("PO59:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information); } }
/// <summary> /// Function to use the setting the product default values /// </summary> /// <param name="index"></param> /// <param name="decProductId"></param> public void AssignProductDefaultValues(int index, decimal decProductId) { List<DataTable> listObj = new List<DataTable>(); try { ProductInfo infoproduct = new ProductInfo(); ProductCreationBll BllProductCreation = new ProductCreationBll(); infoproduct = BllProductCreation.productViewByProductId(decProductId); dgvProduct.Rows[index].Cells["dgvtxtProductName"].Value = infoproduct.ProductName; dgvProduct.Rows[index].Cells["dgvtxtProductCode"].Value = infoproduct.ProductCode; listObj = transactionGeneralFillObj.UnitViewAllByProductId(dgvProduct, decProductId.ToString(), index); } catch (Exception ex) { MessageBox.Show("RI:15" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information); } }