public void ProductBatchEdit(ProductBatchInfo productbatchinfo) { try { if (sqlcon.State == ConnectionState.Closed) { sqlcon.Open(); } SqlCommand sccmd = new SqlCommand("ProductBatchEdit", sqlcon); sccmd.CommandType = CommandType.StoredProcedure; SqlParameter sprmparam = new SqlParameter(); sprmparam = sccmd.Parameters.Add("@productBatchId", SqlDbType.Decimal); sprmparam.Value = productbatchinfo.ProductBatchId; sprmparam = sccmd.Parameters.Add("@productId", SqlDbType.Decimal); sprmparam.Value = productbatchinfo.ProductId; sprmparam = sccmd.Parameters.Add("@batchId", SqlDbType.Decimal); sprmparam.Value = productbatchinfo.BatchId; sprmparam = sccmd.Parameters.Add("@partNo", SqlDbType.VarChar); sprmparam.Value = productbatchinfo.PartNo; sprmparam = sccmd.Parameters.Add("@barcode", SqlDbType.VarChar); sprmparam.Value = productbatchinfo.Barcode; sprmparam = sccmd.Parameters.Add("@extra1", SqlDbType.VarChar); sprmparam.Value = productbatchinfo.Extra1; sprmparam = sccmd.Parameters.Add("@extra2", SqlDbType.VarChar); sprmparam.Value = productbatchinfo.Extra2; sprmparam = sccmd.Parameters.Add("@extraDate", SqlDbType.DateTime); sprmparam.Value = productbatchinfo.ExtraDate; sccmd.ExecuteNonQuery(); } catch (Exception ex) { MessageBox.Show(ex.ToString()); } finally { sqlcon.Close(); } }
public ProductBatchInfo ProductBatchView(decimal productBatchId) { ProductBatchInfo productbatchinfo = new ProductBatchInfo(); SqlDataReader sdrreader = null; try { if (sqlcon.State == ConnectionState.Closed) { sqlcon.Open(); } SqlCommand sccmd = new SqlCommand("ProductBatchView", sqlcon); sccmd.CommandType = CommandType.StoredProcedure; SqlParameter sprmparam = new SqlParameter(); sprmparam = sccmd.Parameters.Add("@productBatchId", SqlDbType.Decimal); sprmparam.Value = productBatchId; sdrreader = sccmd.ExecuteReader(); while (sdrreader.Read()) { productbatchinfo.ProductBatchId = decimal.Parse(sdrreader[0].ToString()); productbatchinfo.ProductId = decimal.Parse(sdrreader[1].ToString()); productbatchinfo.BatchId = decimal.Parse(sdrreader[2].ToString()); productbatchinfo.PartNo = sdrreader[3].ToString(); productbatchinfo.Barcode = sdrreader[4].ToString(); productbatchinfo.Extra1 = sdrreader[5].ToString(); productbatchinfo.Extra2 = sdrreader[6].ToString(); productbatchinfo.ExtraDate = DateTime.Parse(sdrreader[7].ToString()); } } catch (Exception ex) { MessageBox.Show(ex.ToString()); } finally { sdrreader.Close(); sqlcon.Close(); } return(productbatchinfo); }
/// <summary> /// Function for fill productBatch table /// </summary> public void ProductBatchTableFill() { ProductBatchSP spProductBatch = new ProductBatchSP(); ProductBatchInfo infoProductBatch = new ProductBatchInfo(); if (true) { infoProductBatch.BatchId = 0; } infoProductBatch.Extra1 = string.Empty; infoProductBatch.Extra2 = string.Empty; infoProductBatch.ExtraDate = DateTime.Now; infoProductBatch.PartNo = string.Empty; infoProductBatch.ProductId = decSaveProduct; spProductBatch.ProductBatchAdd(infoProductBatch); }
public ProductBatchInfo ProductBatchView(decimal productBatchId ) { ProductBatchInfo productbatchinfo =new ProductBatchInfo(); SqlDataReader sdrreader =null; try { if (sqlcon.State == ConnectionState.Closed) { sqlcon.Open(); } SqlCommand sccmd = new SqlCommand("ProductBatchView", sqlcon); sccmd.CommandType = CommandType.StoredProcedure; SqlParameter sprmparam = new SqlParameter(); sprmparam = sccmd.Parameters.Add("@productBatchId", SqlDbType.Decimal); sprmparam.Value = productBatchId; sdrreader = sccmd.ExecuteReader(); while (sdrreader.Read()) { productbatchinfo.ProductBatchId=decimal.Parse(sdrreader[0].ToString()); productbatchinfo.ProductId=decimal.Parse(sdrreader[1].ToString()); productbatchinfo.BatchId=decimal.Parse(sdrreader[2].ToString()); productbatchinfo.PartNo= sdrreader[3].ToString(); productbatchinfo.Barcode= sdrreader[4].ToString(); productbatchinfo.Extra1= sdrreader[5].ToString(); productbatchinfo.Extra2= sdrreader[6].ToString(); productbatchinfo.ExtraDate=DateTime.Parse(sdrreader[7].ToString()); } } catch (Exception ex) { MessageBox.Show(ex.ToString()); } finally { sdrreader.Close(); sqlcon.Close(); } return productbatchinfo; }
/// <summary> /// Here get the Barcode ViewBy ProductCode /// </summary> /// <param name="strproductCode"></param> /// <returns></returns> public ProductBatchInfo BarcodeViewByProductCode(string strproductCode) { ProductBatchInfo infoProductBatch = new ProductBatchInfo(); SqlDataReader sdrreader = null; try { if (sqlcon.State == ConnectionState.Closed) { sqlcon.Open(); } SqlCommand sccmd = new SqlCommand("BarcodeViewByProductCode", sqlcon); sccmd.CommandType = CommandType.StoredProcedure; SqlParameter sprmparam = new SqlParameter(); sprmparam = sccmd.Parameters.Add("@productCode", SqlDbType.VarChar); sprmparam.Value = strproductCode; sdrreader = sccmd.ExecuteReader(); while (sdrreader.Read()) { infoProductBatch.Barcode = sdrreader["barcode"].ToString(); infoProductBatch.BatchId = Convert.ToDecimal(sdrreader["batchId"].ToString()); infoProductBatch.ProductId = Convert.ToDecimal(sdrreader["productId"].ToString()); } } catch (Exception ex) { MessageBox.Show(ex.ToString()); } finally { sdrreader.Close(); sqlcon.Close(); } return infoProductBatch; }
/// <summary> /// Function to fil Controls based on the ProductName /// </summary> /// <param name="decProductId"></param> public void FillControlsByProductName(decimal decProductId) { try { PriceListInfo InfoPriceList = new PriceListInfo(); ProductInfo infoProduct = new ProductInfo(); ProductSP spProduct = new ProductSP(); PriceListSP spPriceList = new PriceListSP(); ProductBatchInfo infoProductBatch = new ProductBatchInfo(); infoProduct = new ProductSP().ProductView(decProductId); txtProductCode.Text = infoProduct.ProductCode; infoProductBatch = spProduct.BarcodeViewByProductCode(txtProductCode.Text); decProductId = infoProductBatch.ProductId; decBatchId = infoProductBatch.BatchId; InfoPriceList = spPriceList.PriceListViewByBatchIdORProduct(decBatchId); batchcombofill(); txtBarcode.Text = infoProductBatch.Barcode; cmbItem.Text = infoProduct.ProductName; cmbGodown.SelectedValue = infoProduct.GodownId; cmbRack.SelectedValue = infoProduct.RackId; UnitComboFill(); UnitInfo infoUnit = new UnitInfo(); infoUnit = new UnitSP().unitVieWForStandardRate(decProductId); cmbUnit.SelectedValue = infoUnit.UnitId; if (InfoPriceList.PricinglevelId != 0) { cmbPricingLevel.SelectedValue = InfoPriceList.PricinglevelId; } else { cmbPricingLevel.SelectedIndex = 0; } ComboTaxFill(); cmbTax.SelectedValue = infoProduct.TaxId; if (txtProductCode.Text.Trim() != string.Empty && cmbItem.SelectedIndex != -1) { decimal decNodecplaces = PublicVariables._inNoOfDecimalPlaces; decimal dcRate = new ProductSP().ProductRateForSales(decProductId, Convert.ToDateTime(txtDate.Text), decBatchId, decNodecplaces); txtRate.Text = dcRate.ToString(); try { if (decimal.Parse(txtQuantity.Text) == 0) txtQuantity.Text = "1"; } catch { txtQuantity.Text = "1"; } txtQuantity.Focus(); } TaxAmountCalculation(); isAfterFillControls = true; } catch (Exception ex) { MessageBox.Show("POS:27" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information); } }