/// <summary> /// Function to edit Product table /// </summary> public void ProductEditFill() { try { ProductSP spProduct = new ProductSP(); ProductInfo infoProduct = new ProductInfo(); UnitConvertionSP spUnitConvertion = new UnitConvertionSP(); UnitConvertionInfo infoUnitConvertion = new UnitConvertionInfo(); BatchSP spBatch = new BatchSP(); infoProduct.ProductName = txtName.Text.Trim(); infoProduct.ProductCode = txtProductCode.Text.Trim(); if (txtPurchaseRate.Text.Trim() == string.Empty) { infoProduct.PurchaseRate = 0; } else { infoProduct.PurchaseRate = Convert.ToDecimal(txtPurchaseRate.Text.Trim()); } if (txtSalesRate.Text.Trim() == string.Empty) { infoProduct.SalesRate = 0; } else { infoProduct.SalesRate = Convert.ToDecimal(txtSalesRate.Text.Trim()); } if (txtMrp.Text.Trim() == string.Empty) { infoProduct.Mrp = 0; } else { infoProduct.Mrp = Convert.ToDecimal(txtMrp.Text); } infoProduct.MaximumStock = Convert.ToDecimal(txtMaximumStock.Text.Trim()); infoProduct.MinimumStock = Convert.ToDecimal(txtMinimumStock.Text.Trim()); infoProduct.ReorderLevel = Convert.ToDecimal(txtReorderLevel.Text.Trim()); infoProduct.Extra1 = string.Empty; infoProduct.Extra2 = string.Empty; infoProduct.ExtraDate = DateTime.Now; infoProduct.TaxId = Convert.ToDecimal(cmbTax.SelectedValue); infoProduct.UnitId = Convert.ToDecimal(cmbUnit.SelectedValue); infoProduct.GroupId = Convert.ToDecimal(cmbGroup.SelectedValue); infoProduct.Narration = txtNarration.Text; infoProduct.ProductId = decProductIdForEdit; infoUnitConvertion.ProductId = decProductIdForEdit; infoUnitConvertion.UnitId = Convert.ToDecimal(cmbUnit.SelectedValue); if (cmbTax.SelectedIndex == 0) { infoProduct.TaxapplicableOn = string.Empty; } else { infoProduct.TaxapplicableOn = Convert.ToString(cmbTaxApplicableOn.SelectedItem); } if (cmbBrand.SelectedIndex != -1) { infoProduct.BrandId = Convert.ToDecimal(cmbBrand.SelectedValue); } else { infoProduct.BrandId = 1; } if (cmbSize.SelectedIndex != -1) { infoProduct.SizeId = Convert.ToDecimal(cmbSize.SelectedValue); } else { infoProduct.SizeId = 1; } if (cmbModalNo.SelectedIndex != -1) { infoProduct.ModelNoId = Convert.ToDecimal(cmbModalNo.SelectedValue); } else { infoProduct.ModelNoId = 1; } if (cmbDefaultGodown.SelectedIndex != -1) { infoProduct.GodownId = Convert.ToDecimal(cmbDefaultGodown.SelectedValue); } else { infoProduct.GodownId = 1; } if (cmbDefaultRack.SelectedIndex != -1) { infoProduct.RackId = Convert.ToDecimal(cmbDefaultRack.SelectedValue); } else { infoProduct.RackId = 1; } if (cmbAllowBatch.SelectedIndex == 0) { infoProduct.IsallowBatch = false; spBatch.PartNoUpdate(decProductIdForEdit, txtPartNo.Text.Trim()); } else { infoProduct.IsallowBatch = true; } if (cmbBom.SelectedIndex == 0) { infoProduct.IsBom = false; } else { if (isSaveBomCheck || isBomFromRegister) { infoProduct.IsBom = true; } else { infoProduct.IsBom = false; } } if (cmbMultipleUnit.SelectedIndex == 0) { infoProduct.Ismultipleunit = false; } else { if ((isMulUnitFromRgister || isSaveMulUnitCheck)) { infoProduct.Ismultipleunit = true; } else { infoProduct.Ismultipleunit = false; } } if (cbxActive.Checked) { infoProduct.IsActive = true; } else { infoProduct.IsActive = false; } if (cbxReminder.Checked) { infoProduct.IsshowRemember = true; } else { infoProduct.IsshowRemember = false; } if (cmbOpeningStock.SelectedIndex == 0) { infoProduct.Isopeningstock = false; } else { infoProduct.Isopeningstock = true; } if (PublicVariables.isMessageEdit) { if (Messages.UpdateMessage()) { isUpdated = spProduct.ProductEdit(infoProduct); spUnitConvertion.UnitConverstionEditWhenProductUpdating(infoUnitConvertion); } } else { isUpdated = spProduct.ProductEdit(infoProduct); spUnitConvertion.UnitConverstionEditWhenProductUpdating(infoUnitConvertion); } } catch (Exception ex) { MessageBox.Show("PC:25" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information); } }