/// <summary> /// edit function for PurchaseOrderDetails /// </summary> public void EditPurchaseOrderDetails() { PurchaseOrderBll BllPurchaseOrder = new PurchaseOrderBll(); PurchaseOrderDetailsInfo infoPurchaseOrderDetails = new PurchaseOrderDetailsInfo(); ProductCreationBll BllProductCreation = new ProductCreationBll(); try { ProductInfo infoProduct = new ProductInfo(); for (int inI = 0; inI < dgvPurchaseOrder.Rows.Count - 1; inI++) { if (Convert.ToDecimal(dgvPurchaseOrder.Rows[inI].Cells["dgvtxtPurchaseOrderDetailsId"].Value) == 0 || dgvPurchaseOrder.Rows[inI].Cells["dgvtxtPurchaseOrderDetailsId"].Value.ToString() == null || dgvPurchaseOrder.Rows[inI].Cells["dgvtxtPurchaseOrderDetailsId"].Value.ToString() == string.Empty) { infoPurchaseOrderDetails.PurchaseOrderMasterId = decPurchaseOrderMasterId; infoProduct = BllProductCreation.ProductViewByCode(dgvPurchaseOrder.Rows[inI].Cells["dgvtxtProductCode"].Value.ToString()); infoPurchaseOrderDetails.ProductId = infoProduct.ProductId; infoPurchaseOrderDetails.Qty = Convert.ToDecimal(dgvPurchaseOrder.Rows[inI].Cells["dgvtxtQty"].Value.ToString()); infoPurchaseOrderDetails.UnitId = Convert.ToDecimal(dgvPurchaseOrder.Rows[inI].Cells["dgvcmbUnit"].Value); infoPurchaseOrderDetails.UnitConversionId = Convert.ToDecimal(dgvPurchaseOrder.Rows[inI].Cells["dgvtxtUnitConversionId"].Value); infoPurchaseOrderDetails.Rate = Convert.ToDecimal(dgvPurchaseOrder.Rows[inI].Cells["dgvtxtRate"].Value.ToString()); infoPurchaseOrderDetails.Amount = Convert.ToDecimal(dgvPurchaseOrder.Rows[inI].Cells["dgvtxtAmount"].Value.ToString()); infoPurchaseOrderDetails.SlNo = Convert.ToInt32(dgvPurchaseOrder.Rows[inI].Cells["dgvtxtSlNo"].Value.ToString()); infoPurchaseOrderDetails.Extra1 = string.Empty; infoPurchaseOrderDetails.Extra2 = string.Empty; BllPurchaseOrder.PurchaseOrderDetailsAdd(infoPurchaseOrderDetails); } else { infoPurchaseOrderDetails.PurchaseOrderMasterId = decPurchaseOrderMasterId; infoPurchaseOrderDetails.PurchaseOrderDetailsId = Convert.ToDecimal(dgvPurchaseOrder.Rows[inI].Cells["dgvtxtPurchaseOrderDetailsId"].Value); infoProduct = BllProductCreation.ProductViewByCode(dgvPurchaseOrder.Rows[inI].Cells["dgvtxtProductCode"].Value.ToString()); infoPurchaseOrderDetails.ProductId = infoProduct.ProductId; infoPurchaseOrderDetails.Qty = Convert.ToDecimal(dgvPurchaseOrder.Rows[inI].Cells["dgvtxtQty"].Value.ToString()); infoPurchaseOrderDetails.UnitId = Convert.ToDecimal(dgvPurchaseOrder.Rows[inI].Cells["dgvcmbUnit"].Value.ToString()); infoPurchaseOrderDetails.UnitConversionId = Convert.ToDecimal(dgvPurchaseOrder.Rows[inI].Cells["dgvtxtUnitConversionId"].Value); infoPurchaseOrderDetails.Rate = Convert.ToDecimal(dgvPurchaseOrder.Rows[inI].Cells["dgvtxtRate"].Value.ToString()); infoPurchaseOrderDetails.Amount = Convert.ToDecimal(dgvPurchaseOrder.Rows[inI].Cells["dgvtxtAmount"].Value.ToString()); infoPurchaseOrderDetails.SlNo = Convert.ToInt32(dgvPurchaseOrder.Rows[inI].Cells["dgvtxtSlNo"].Value.ToString()); infoPurchaseOrderDetails.Extra1 = string.Empty; infoPurchaseOrderDetails.Extra2 = string.Empty; BllPurchaseOrder.PurchaseOrderDetailsEdit(infoPurchaseOrderDetails); } } } catch (Exception ex) { MessageBox.Show("PO33:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information); } }