/// <summary>
        /// Function to get details based on parameter
        /// </summary>
        /// <param name="dcProductid"></param>
        /// <returns></returns>
        public UnitConvertionInfo UnitViewAllByProductId(decimal dcProductid)
        {
            UnitConvertionInfo UnitConvertionInfo = new UnitConvertionInfo();
            SqlDataReader      sdrreader          = null;

            try
            {
                if (sqlcon.State == ConnectionState.Closed)
                {
                    sqlcon.Open();
                }
                SqlCommand sccmd = new SqlCommand("UnitViewAllByProductId", sqlcon);
                sccmd.CommandType = CommandType.StoredProcedure;
                SqlParameter sprmparam = new SqlParameter();
                sprmparam       = sccmd.Parameters.Add("@productId", SqlDbType.Decimal);
                sprmparam.Value = dcProductid;
                sdrreader       = sccmd.ExecuteReader();
                while (sdrreader.Read())
                {
                    UnitConvertionInfo.UnitconvertionId = decimal.Parse(sdrreader["unitconversionId"].ToString());
                    UnitConvertionInfo.UnitId           = decimal.Parse(sdrreader["unitId"].ToString());
                    UnitConvertionInfo.ConversionRate   = decimal.Parse(sdrreader["conversionRate"].ToString());
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.ToString());
            }
            finally
            {
                sdrreader.Close();
                sqlcon.Close();
            }
            return(UnitConvertionInfo);
        }
 /// <summary>
 /// Function to get details based on parameter
 /// </summary>
 /// <param name="unitConvertionInfo"></param>
 public void UnitConverstionEditWhenProductUpdating(UnitConvertionInfo unitConvertionInfo)
 {
     try
     {
         if (sqlcon.State == ConnectionState.Closed)
         {
             sqlcon.Open();
         }
         SqlCommand sccmd = new SqlCommand("UnitConverstionEditWhenProductUpdating", sqlcon);
         sccmd.CommandType = CommandType.StoredProcedure;
         SqlParameter sprmparam = new SqlParameter();
         sprmparam       = sccmd.Parameters.Add("@productId", SqlDbType.Decimal);
         sprmparam.Value = unitConvertionInfo.ProductId;
         sprmparam       = sccmd.Parameters.Add("@unitId", SqlDbType.Decimal);
         sprmparam.Value = unitConvertionInfo.UnitId;
         sccmd.ExecuteNonQuery();
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.ToString());
     }
     finally
     {
         sqlcon.Close();
     }
 }
 public void UnitConvertionEdit(UnitConvertionInfo unitconvertioninfo)
 {
     try
     {
         spUnitConvertion.UnitConvertionEdit(unitconvertioninfo);
     }
     catch (Exception ex)
     {
         MessageBox.Show("ROI2:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
 }
        public UnitConvertionInfo UnitViewAllByProductId(decimal dcProductid)
        {
            UnitConvertionInfo infUnitConvertion = new UnitConvertionInfo();

            try
            {
                infUnitConvertion = spUnitConvertion.UnitViewAllByProductId(dcProductid);
            }
            catch (Exception ex)
            {
                MessageBox.Show("ROI2:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
            return(infUnitConvertion);
        }
        /// <summary>
        /// Function to get particular values from UnitConversion table based on the parameter
        /// </summary>
        /// <param name="unitconvertionId"></param>
        /// <returns></returns>
        public UnitConvertionInfo UnitConvertionView(decimal unitconvertionId)
        {
            UnitConvertionInfo unitconvertioninfo = new UnitConvertionInfo();
            SqlDataReader      sdrreader          = null;

            try
            {
                if (sqlcon.State == ConnectionState.Closed)
                {
                    sqlcon.Open();
                }
                SqlCommand sccmd = new SqlCommand("UnitConvertionView", sqlcon);
                sccmd.CommandType = CommandType.StoredProcedure;
                SqlParameter sprmparam = new SqlParameter();
                sprmparam       = sccmd.Parameters.Add("@unitconvertionId", SqlDbType.Decimal);
                sprmparam.Value = unitconvertionId;
                sdrreader       = sccmd.ExecuteReader();
                while (sdrreader.Read())
                {
                    unitconvertioninfo.UnitconvertionId = decimal.Parse(sdrreader[0].ToString());
                    unitconvertioninfo.ProductId        = decimal.Parse(sdrreader[1].ToString());
                    unitconvertioninfo.UnitId           = decimal.Parse(sdrreader[2].ToString());
                    unitconvertioninfo.ConversionRate   = decimal.Parse(sdrreader[3].ToString());
                    unitconvertioninfo.ExtraDate        = DateTime.Parse(sdrreader[4].ToString());
                    unitconvertioninfo.Extra1           = sdrreader[5].ToString();
                    unitconvertioninfo.Extra2           = sdrreader[6].ToString();
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.ToString());
            }
            finally
            {
                sdrreader.Close();
                sqlcon.Close();
            }
            return(unitconvertioninfo);
        }
 /// <summary>
 /// Function to get all the values from UnitConversion table
 /// </summary>
 /// <param name="unitconvertioninfo"></param>
 public void UnitConvertionEdit(UnitConvertionInfo unitconvertioninfo)
 {
     try
     {
         if (sqlcon.State == ConnectionState.Closed)
         {
             sqlcon.Open();
         }
         SqlCommand sccmd = new SqlCommand("UnitConvertionEdit", sqlcon);
         sccmd.CommandType = CommandType.StoredProcedure;
         SqlParameter sprmparam = new SqlParameter();
         sprmparam       = sccmd.Parameters.Add("@unitconvertionId", SqlDbType.Decimal);
         sprmparam.Value = unitconvertioninfo.UnitconvertionId;
         sprmparam       = sccmd.Parameters.Add("@productId", SqlDbType.Decimal);
         sprmparam.Value = unitconvertioninfo.ProductId;
         sprmparam       = sccmd.Parameters.Add("@unitId", SqlDbType.Decimal);
         sprmparam.Value = unitconvertioninfo.UnitId;
         sprmparam       = sccmd.Parameters.Add("@conversionRate", SqlDbType.Decimal);
         sprmparam.Value = unitconvertioninfo.ConversionRate;
         sprmparam       = sccmd.Parameters.Add("@extraDate", SqlDbType.DateTime);
         sprmparam.Value = unitconvertioninfo.ExtraDate;
         sprmparam       = sccmd.Parameters.Add("@extra1", SqlDbType.VarChar);
         sprmparam.Value = unitconvertioninfo.Extra1;
         sprmparam       = sccmd.Parameters.Add("@extra2", SqlDbType.VarChar);
         sprmparam.Value = unitconvertioninfo.Extra2;
         sccmd.ExecuteNonQuery();
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.ToString());
     }
     finally
     {
         sqlcon.Close();
     }
 }
示例#7
0
 /// <summary>
 /// Function to add the products to grid
 /// </summary>
 public void AddToGrid()
 {
     BatchBll BllBatch = new BatchBll();
     GodownBll BllGodown = new GodownBll();
     try
     {
         SettingsBll BllSettings = new SettingsBll();
         if (txtProductCode.Text.Trim() == null && txtProductCode.Text.Trim() == string.Empty)
         {
             Messages.InformationMessage("Enter product code");
             txtProductCode.Focus();
         }
         else if (cmbItem.SelectedIndex == -1 && cmbItem.SelectedValue == null)
         {
             Messages.InformationMessage("Select a product");
             cmbItem.Focus();
         }
         else if (Convert.ToDecimal(txtQuantity.Text.Trim()) <= 0 || txtQuantity.Text.Trim() == string.Empty)
         {
             Messages.InformationMessage("Enter quantity");
             txtQuantity.Focus();
         }
         else if (cmbUnit.SelectedValue == null)
         {
             Messages.InformationMessage("Select a unit");
             cmbUnit.Focus();
         }
         else if (BllSettings.SettingsStatusCheck("AllowZeroValueEntry") == "No" && decimal.Parse(txtRate.Text.Trim()) <= 0 || txtRate.Text.Trim() == string.Empty)
         {
             Messages.InformationMessage("Enter rate");
             txtRate.Focus();
         }
         else
         {
             int inCurrentRowIndex = new int();
             bool isExecutef = false;
             if (rowIdToEdit == 0)
             {
                 dgvPointOfSales.Rows.Add();
                 inCurrentRowIndex = dgvPointOfSales.Rows.Count - 1;
                 isExecutef = true;
             }
             else
             {
                 for (int i = 0; i < dgvPointOfSales.Rows.Count; ++i)
                 {
                     if (dgvPointOfSales.Rows[i].Cells["rowId"].Value.ToString() == rowIdToEdit.ToString())
                     {
                         isExecutef = true;
                         inCurrentRowIndex = i;
                         break;
                     }
                 }
             }
             if (!isExecutef)
             {
                 dgvPointOfSales.Rows.Add();
                 inCurrentRowIndex = dgvPointOfSales.Rows.Count - 1;
             }
             ProductInfo infoProduct = new ProductInfo();
             BatchInfo infoBatch = new BatchInfo();
             RackInfo infoRack = new RackInfo();
             ProductCreationBll BllProductCreation = new ProductCreationBll();
             UnitConvertionInfo InfoUnitConvertion = new UnitConvertionInfo();
             infoProduct = BllProductCreation.ProductView(decProductId);
             decimal dcProductBatch = BllBatch.BatchIdViewByProductId(decProductId);
             InfoUnitConvertion = new UnitConvertionBll().UnitViewAllByProductId(decProductId);
             infoBatch = BllBatch.BatchView(dcProductBatch);
             decimal dcGodownId = infoProduct.GodownId;
             GodownInfo infoGodown = new GodownInfo();
             infoGodown = BllGodown.GodownView(dcGodownId);
             decimal dcRackId = infoProduct.RackId;
             infoRack = new RackBll().RackView(dcRackId);
             dgvPointOfSales.Rows[inCurrentRowIndex].Cells["dgvtxtProductCode"].Value = txtProductCode.Text;
             dgvPointOfSales.Rows[inCurrentRowIndex].Cells["dgvtxtProductName"].Value = cmbItem.Text;
             dgvPointOfSales.Rows[inCurrentRowIndex].Cells["dgvtxtQuantity"].Value = txtQuantity.Text;
             dgvPointOfSales.Rows[inCurrentRowIndex].Cells["dgvtxtUnit"].Value = cmbUnit.Text;
             dgvPointOfSales.Rows[inCurrentRowIndex].Cells["dgvtxtRate"].Value = txtRate.Text;
             dgvPointOfSales.Rows[inCurrentRowIndex].Cells["dgvtxtGrossValue"].Value = txtGrossValue.Text;
             dgvPointOfSales.Rows[inCurrentRowIndex].Cells["dgvtxtTaxPercentage"].Value = cmbTax.Text;
             dgvPointOfSales.Rows[inCurrentRowIndex].Cells["dgvtxtTaxAmount"].Value = txtTaxAmount.Text;
             dgvPointOfSales.Rows[inCurrentRowIndex].Cells["dgvtxtNetAmount"].Value = txtNetAmount.Text;
             dgvPointOfSales.Rows[inCurrentRowIndex].Cells["dgvtxtDiscount"].Value = txtDiscountAmount.Text;
             dgvPointOfSales.Rows[inCurrentRowIndex].Cells["dgvtxtTotalAmount"].Value = txtAmount.Text;
             dgvPointOfSales.Rows[inCurrentRowIndex].Cells["dgvtxttaxid"].Value = Convert.ToDecimal(cmbTax.SelectedValue);
             dgvPointOfSales.Rows[inCurrentRowIndex].Cells["dgvtxtProductId"].Value = infoProduct.ProductId;
             dgvPointOfSales.Rows[inCurrentRowIndex].Cells["dgvtxtBatchId"].Value = dcProductBatch;
             dgvPointOfSales.Rows[inCurrentRowIndex].Cells["dgvtxtRackId"].Value = infoProduct.RackId;
             dgvPointOfSales.Rows[inCurrentRowIndex].Cells["dgvtxtGodownId"].Value = infoProduct.GodownId;
             dgvPointOfSales.Rows[inCurrentRowIndex].Cells["dgvtxtUnitId"].Value = Convert.ToDecimal(cmbUnit.SelectedValue);
             dgvPointOfSales.Rows[inCurrentRowIndex].Cells["dgvtxtunitconversionId"].Value = InfoUnitConvertion.UnitconvertionId;
             dgvPointOfSales.Rows[inCurrentRowIndex].Cells["dgvtxtBarcode"].Value = txtBarcode.Text;
             dgvPointOfSales.Rows[inCurrentRowIndex].Cells["dgvtxtBatchno"].Value = infoBatch.BatchNo;
             dgvPointOfSales.Rows[inCurrentRowIndex].Cells["dgvtxtGodownName"].Value = infoGodown.GodownName;
             dgvPointOfSales.Rows[inCurrentRowIndex].Cells["dgvtxtRackName"].Value = infoRack.RackName;
             TotalAmountCalculation();
             ClearGroupbox();
             dgvPointOfSales.CurrentCell = dgvPointOfSales[0, dgvPointOfSales.Rows.Count - 1];
             txtBarcode.Focus();
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show("POS:34" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
 }
 /// <summary>
 /// Function to add multiple unit details to tbl_UnitConversion table
 /// </summary>
 public void UnitConvertionTableFill()
 {
     try
     {
         UnitConvertionBll bllUnitConvertion = new UnitConvertionBll();
         UnitConvertionInfo infoUnitConversion = new UnitConvertionInfo();
         decimal decProductId = decSaveProduct;
         if (btnSave.Text == "Update")
         {
             decProductId = decProductIdForEdit;
         }
         else
         {
             decProductId = decSaveProduct;
         }
         for (int i = 0; i < dtblMulUnit.Rows.Count; i++)
         {
             decimal decConversionRate = Convert.ToDecimal(dtblMulUnit.Rows[i]["CnvertionRate"]);
             if (decConversionRate != 0)
             {
                 infoUnitConversion.ConversionRate = Convert.ToDecimal(dtblMulUnit.Rows[i]["CnvertionRate"]);
                 infoUnitConversion.UnitId = Convert.ToDecimal(dtblMulUnit.Rows[i]["dgvtxtUnitId"]);
                 infoUnitConversion.Quantities = Convert.ToString(dtblMulUnit.Rows[i]["quantities"]);
                 infoUnitConversion.Extra1 = dtblMulUnit.Rows[i]["extra1"].ToString();
                 infoUnitConversion.Extra2 = dtblMulUnit.Rows[i]["extra2"].ToString();
                 infoUnitConversion.ExtraDate = Convert.ToDateTime(dtblMulUnit.Rows[i]["extraDate"]);
                 infoUnitConversion.ProductId = decProductId;
                 bllUnitConvertion.UnitConvertionAdd(infoUnitConversion);
             }
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show("PC:27" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
 }
 /// <summary>
 /// Function to update multiple unit details to tbl_UnitConversion table
 /// </summary>
 public void UnitConvertionEditTableFill()
 {
     UnitConvertionBll bllUnitConvertion = new UnitConvertionBll();
     try
     {
         UnitConvertionInfo infoUnitConversion = new UnitConvertionInfo();
         for (int i = 0; i < dtblFromMulUnitForUpdate.Rows.Count; i++)
         {
             if (Convert.ToDecimal(dtblFromMulUnitForUpdate.Rows[i]["unitconvertionId"]) != 0)
             {
                 infoUnitConversion.ConversionRate = Convert.ToDecimal(dtblFromMulUnitForUpdate.Rows[i]["CnvertionRate"]);
                 infoUnitConversion.UnitId = Convert.ToDecimal(dtblFromMulUnitForUpdate.Rows[i]["dgvtxtUnitId"]);
                 infoUnitConversion.Extra1 = dtblFromMulUnitForUpdate.Rows[i]["extra1"].ToString();
                 infoUnitConversion.Extra2 = dtblFromMulUnitForUpdate.Rows[i]["extra2"].ToString();
                 infoUnitConversion.ExtraDate = Convert.ToDateTime(dtblFromMulUnitForUpdate.Rows[i]["extraDate"]);
                 infoUnitConversion.UnitconvertionId = Convert.ToDecimal(dtblFromMulUnitForUpdate.Rows[i]["unitconvertionId"]);
                 infoUnitConversion.ProductId = decProductIdForEdit;
                 bllUnitConvertion.UnitConvertionEdit(infoUnitConversion);
             }
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show("PC:28" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
 }
 /// <summary>
 /// Function to save data to product table
 /// </summary>
 public void ProductTableFill()
 {
     try
     {
         ProductCreationBll BllProductCreation = new ProductCreationBll();
         ProductInfo infoProduct = new ProductInfo();
         UnitConvertionBll spUnitConvertion = new UnitConvertionBll();
         UnitConvertionInfo infoUnitConvertion = new UnitConvertionInfo();
         infoProduct.ProductName = txtName.Text.Trim();
         infoProduct.ProductCode = txtProductCode.Text.Trim();
         if (txtPurchaseRate.Text != string.Empty)
         {
             infoProduct.PurchaseRate = Convert.ToDecimal(txtPurchaseRate.Text.Trim());
         }
         else
         {
             infoProduct.PurchaseRate = 0;
         }
         if (txtSalesRate.Text != string.Empty)
         {
             infoProduct.SalesRate = Convert.ToDecimal(txtSalesRate.Text.Trim());
         }
         else
         {
             infoProduct.SalesRate = 0;
         }
         if (txtMrp.Text != string.Empty)
         {
             infoProduct.Mrp = Convert.ToDecimal(txtMrp.Text.Trim());
         }
         else
         {
             infoProduct.Mrp = 0;
         }
         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 = PublicVariables._dtCurrentDate;
         infoProduct.TaxId = Convert.ToDecimal(cmbTax.SelectedValue);
         infoProduct.UnitId = Convert.ToDecimal(cmbUnit.SelectedValue);
         infoProduct.GroupId = Convert.ToDecimal(cmbGroup.SelectedValue);
         infoProduct.Narration = txtNarration.Text;
         infoUnitConvertion.UnitId = Convert.ToDecimal(cmbUnit.SelectedValue);
         infoUnitConvertion.ConversionRate = 1;
         infoUnitConvertion.Quantities = string.Empty;
         infoUnitConvertion.Extra1 = string.Empty;
         infoUnitConvertion.Extra2 = string.Empty;
         infoUnitConvertion.ExtraDate = DateTime.Now;
         if (cmbTax.SelectedIndex == 0)
         {
             infoProduct.TaxapplicableOn = "Rate";
         }
         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;
         }
         else
         {
             infoProduct.IsallowBatch = true;
         }
         if (cmbBom.SelectedIndex == 0)
         {
             infoProduct.IsBom = false;
         }
         else
         {
             if (isSaveBomCheck)
             {
                 infoProduct.IsBom = true;
             }
             else
             {
                 infoProduct.IsBom = false;
             }
         }
         if (cmbOpeningStock.SelectedIndex == 0)
         {
             infoProduct.Isopeningstock = false;
         }
         else
         {
             infoProduct.Isopeningstock = true;
             infoProduct.PurchaseRate = Convert.ToDecimal(dgvProductCreation.Rows[0].Cells["dgvtxtrate"].Value);
         }
         if (cmbMultipleUnit.SelectedIndex == 0)
         {
             infoProduct.Ismultipleunit = false;
         }
         else
         {
             if (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;
         }
         decSaveProduct = BllProductCreation.ProductAdd(infoProduct);
         infoUnitConvertion.ProductId = decSaveProduct;
         spUnitConvertion.UnitConvertionAdd(infoUnitConvertion);
     }
     catch (Exception ex)
     {
         MessageBox.Show("PC:24" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
 }
 /// <summary>
 /// Function to edit Product table
 /// </summary>
 public void ProductEditFill()
 {
     try
     {
         ProductCreationBll BllProductCreation = new ProductCreationBll();
         ProductInfo infoProduct = new ProductInfo();
         UnitConvertionBll BLLUnitConvertion = new UnitConvertionBll();
         UnitConvertionInfo infoUnitConvertion = new UnitConvertionInfo();
         BatchBll BllBatch = new BatchBll();
         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 = PublicVariables._dtCurrentDate;
         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;
             BllBatch.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 = BllProductCreation.ProductEdit(infoProduct);
                 BLLUnitConvertion.UnitConverstionEditWhenProductUpdating(infoUnitConvertion);
             }
         }
         else
         {
             isUpdated = BllProductCreation.ProductEdit(infoProduct);
             BLLUnitConvertion.UnitConverstionEditWhenProductUpdating(infoUnitConvertion);
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show("PC:25" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
 }
 /// <summary>
 /// Function for new row added for multiple unit
 /// </summary>
 public void NewRowAddedForMulUnit()
 {
     try
     {
         UnitConvertionBll bllUnitConvertion = new UnitConvertionBll();
         UnitConvertionInfo infoUnitConversion = new UnitConvertionInfo();
         for (int inI = 0; inI < dtblFromMulUnitForUpdate.Rows.Count; inI++)
         {
             if (Convert.ToDecimal(dtblFromMulUnitForUpdate.Rows[inI]["unitconvertionId"]) == 0)
             {
                 infoUnitConversion.ConversionRate = Convert.ToDecimal(dtblFromMulUnitForUpdate.Rows[inI]["CnvertionRate"]);
                 infoUnitConversion.UnitId = Convert.ToDecimal(dtblFromMulUnitForUpdate.Rows[inI]["dgvtxtUnitId"]);
                 infoUnitConversion.Quantities = Convert.ToString(dtblFromMulUnitForUpdate.Rows[inI]["quantities"]);
                 infoUnitConversion.Extra1 = dtblFromMulUnitForUpdate.Rows[inI]["extra1"].ToString();
                 infoUnitConversion.Extra2 = dtblFromMulUnitForUpdate.Rows[inI]["extra2"].ToString();
                 infoUnitConversion.ExtraDate = Convert.ToDateTime(dtblFromMulUnitForUpdate.Rows[inI]["extraDate"]);
                 infoUnitConversion.ProductId = decProductIdForEdit;
                 bllUnitConvertion.UnitConvertionAdd(infoUnitConversion);
             }
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show("PC:79" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
 }
 /// <summary>
 /// Function to save
 /// </summary>
 public void SaveFunction()
 {
     try
     {
         int inRowCount = dgvMultipleProductCreation.RowCount;
         BatchBll BllBatch = new BatchBll();
         BatchInfo infoBatch = new BatchInfo();
         ProductCreationBll BllProductCreation = new ProductCreationBll();
         ProductInfo infoProduct = new ProductInfo();
         UnitConvertionBll bllUnitConvertion = new UnitConvertionBll();
         UnitConvertionInfo infoUnitConvertion = new UnitConvertionInfo();
         for (int i = 0; i < inRowCount - 1; i++)
         {
             infoProduct.GroupId = Convert.ToDecimal(cmbProductGroup.SelectedValue.ToString());
             infoProduct.UnitId = Convert.ToDecimal(cmbUnit.SelectedValue.ToString());
             infoProduct.TaxId = Convert.ToDecimal(cmbTax.SelectedValue.ToString());
             if (cmbGoDown.SelectedIndex != -1)
             {
                 infoProduct.GodownId = Convert.ToDecimal(cmbGoDown.SelectedValue.ToString());
             }
             else
             {
                 infoProduct.GodownId = 0;
             }
             if (cmbRack.SelectedIndex != -1)
             {
                 infoProduct.RackId = Convert.ToDecimal(cmbRack.SelectedValue.ToString());
             }
             else
             {
                 infoProduct.RackId = 0;
             }
             infoProduct.MinimumStock = 0;
             infoProduct.MaximumStock = 0;
             infoProduct.ReorderLevel = 0;
             infoProduct.IsallowBatch = false;
             infoProduct.Ismultipleunit = false;
             infoProduct.IsBom = false;
             infoProduct.Isopeningstock = false;
             infoProduct.IsActive = true;
             infoProduct.IsshowRemember = false;
             infoProduct.Narration = string.Empty;
             infoProduct.Extra1 = string.Empty;
             infoProduct.Extra2 = string.Empty;
             infoProduct.ExtraDate = PublicVariables._dtCurrentDate;
             infoProduct.PartNo = string.Empty;
             infoProduct.TaxapplicableOn = cmbTaxApplication.SelectedItem.ToString();
             infoProduct.ProductCode = dgvMultipleProductCreation.Rows[i].Cells["dgvtxtProductCode"].Value.ToString().Trim();
             infoProduct.ProductName = dgvMultipleProductCreation.Rows[i].Cells["dgvtxtProductName"].Value.ToString().Trim();
             if (dgvMultipleProductCreation.Rows[i].Cells["dgvcmbBrand"].Value != null)
             {
                 infoProduct.BrandId = Convert.ToDecimal(dgvMultipleProductCreation.Rows[i].Cells["dgvcmbBrand"].Value.ToString());
             }
             else
             {
                 infoProduct.BrandId = 1;
             }
             if (dgvMultipleProductCreation.Rows[i].Cells["dgvcmbModel"].Value != null)
             {
                 infoProduct.ModelNoId = Convert.ToDecimal(dgvMultipleProductCreation.Rows[i].Cells["dgvcmbModel"].Value.ToString());
             }
             else
             {
                 infoProduct.ModelNoId = 1;
             }
             if (dgvMultipleProductCreation.Rows[i].Cells["dgvcmbSize"].Value != null)
             {
                 infoProduct.SizeId = Convert.ToDecimal(dgvMultipleProductCreation.Rows[i].Cells["dgvcmbSize"].Value.ToString());
             }
             else
             {
                 infoProduct.SizeId = 1;
             }
             infoProduct.PurchaseRate = Convert.ToDecimal(dgvMultipleProductCreation.Rows[i].Cells["dgvtxtPurchaseRate"].Value.ToString());
             infoProduct.SalesRate = Convert.ToDecimal(dgvMultipleProductCreation.Rows[i].Cells["dgvtxtSalesRate"].Value.ToString());
             infoProduct.Mrp = Convert.ToDecimal(dgvMultipleProductCreation.Rows[i].Cells["dgvtxtMRP"].Value.ToString());
             decIdentity = BllProductCreation.ProductAdd(infoProduct);
             //...................................................................ADD UNIT TO UNIT CONVERSION TABLE...................................................................................//
             infoUnitConvertion.ProductId = decIdentity;
             infoUnitConvertion.UnitId = Convert.ToDecimal(cmbUnit.SelectedValue.ToString());
             infoUnitConvertion.ConversionRate = 1;
             infoUnitConvertion.ExtraDate = DateTime.Now;
             infoUnitConvertion.Quantities = string.Empty;
             infoUnitConvertion.Extra1 = string.Empty;
             infoUnitConvertion.Extra2 = string.Empty;
             bllUnitConvertion.UnitConvertionAdd(infoUnitConvertion);
             //...................................................................ADD BATCH TO BATCH TABLE...................................................................................//
             Int32 inBarcode = BllBatch.AutomaticBarcodeGeneration();
             infoBatch.BatchNo = "NA";
             infoBatch.ExpiryDate = DateTime.Now;
             infoBatch.ManufacturingDate = DateTime.Now;
             infoBatch.partNo = string.Empty;
             infoBatch.ProductId = decIdentity;
             infoBatch.narration = string.Empty;
             infoBatch.ExtraDate = DateTime.Now;
             infoBatch.barcode = Convert.ToString(inBarcode);
             infoBatch.Extra1 = string.Empty;
             infoBatch.Extra2 = string.Empty;
             BllBatch.BatchAddWithBarCode(infoBatch);
         }
         Messages.SavedMessage();
         Clear();
     }
     catch (Exception ex)
     {
         MessageBox.Show("MPC14:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
 }