/// <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> /// Here get the Barcode ViewBy ProductCode /// </summary> /// <param name="strproductCode"></param> /// <returns></returns> public ProductBatchInfo BarcodeViewByProductCode(string strproductCode) { ProductBatchInfo infoProductBatch = new ProductBatchInfo(); try { infoProductBatch = spProduct.BarcodeViewByProductCode(strproductCode); } catch (Exception ex) { MessageBox.Show("PC20:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information); } return infoProductBatch; }
public void ProductBatchAdd(ProductBatchInfo productbatchinfo) { try { if (sqlcon.State == ConnectionState.Closed) { sqlcon.Open(); } SqlCommand sccmd = new SqlCommand("ProductBatchAdd", sqlcon); sccmd.CommandType = CommandType.StoredProcedure; SqlParameter sprmparam = new SqlParameter(); 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; }