コード例 #1
0
 /// <summary>
 /// Function to save batch
 /// </summary>
 public void BatchWithBarCode()
 {
     BatchBll BllBatch = new BatchBll();
     BatchInfo infoBatch = new BatchInfo();
     Int32 inBarcode = BllBatch.AutomaticBarcodeGeneration();
     infoBatch.BatchNo = "NA";
     infoBatch.ExpiryDate = DateTime.Now;
     infoBatch.ManufacturingDate = DateTime.Now;
     infoBatch.partNo = txtPartNo.Text.Trim();
     if (btnSave.Text == "Update")
     {
         infoBatch.ProductId = decProductIdForEdit;
     }
     else
     {
         infoBatch.ProductId = decSaveProduct;
     }
     infoBatch.narration = string.Empty;
     infoBatch.ExtraDate = DateTime.Now;
     infoBatch.barcode = Convert.ToString(inBarcode);
     infoBatch.Extra1 = string.Empty;
     infoBatch.Extra2 = string.Empty;
     inBatchIdWithPartNoNA = BllBatch.BatchAddWithBarCode(infoBatch);
 }
コード例 #2
0
 /// <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);
     }
 }