private void GetCurrentStock() { BO.DMS_AreaStock currentStock = new BO.DMS_AreaStock(); int productID = Convert.ToInt32(ddlProduct.SelectedValue); currentStock = _IDMS_AreaStock.GetCurrentStockByProductID(productID); txtCsCtn.Text = Convert.ToString(currentStock.CtnOrPkt); txtCsPcs.Text = Convert.ToString(currentStock.Pcs); txtCsQty.Text = Convert.ToString(currentStock.Qty); txtTsCtnPkt.Text = txtCsCtn.Text; txtTsPcs.Text = txtCsPcs.Text; txtTsQty.Text = txtCsQty.Text; }
public IList <BO.DMS_AreaStock> GetProductWiseStock() { try { SqlConnection con = CreateCon(); SqlDataAdapter da = new SqlDataAdapter(); da.SelectCommand = new SqlCommand(); da.SelectCommand.CommandText = "[POS_SP_GET_ProductWiseMDS_Area_Stock]"; da.SelectCommand.CommandType = CommandType.StoredProcedure; da.SelectCommand.Connection = con; if (con.State == ConnectionState.Closed) { con.Open(); } DataSet ds = new DataSet(); da.Fill(ds); if (con.State == ConnectionState.Open) { con.Close(); } DataTable dt = ds.Tables[0]; List <POS.BO.DMS_AreaStock> objStockList = new List <POS.BO.DMS_AreaStock>(); POS.BO.DMS_AreaStock obj = null; int index = 1; foreach (DataRow row in dt.Rows) { obj = new BO.DMS_AreaStock(); obj.Sln = index++; //obj.AsID = Convert.ToInt32(row["ID"]); obj.ProductName = row["ProductName"].ToString(); obj.ProductCode = row["ProductCode"].ToString(); obj.PackSize = row["PackSizeName"].ToString(); obj.PP = Convert.ToDecimal(row["PP"]); obj.CtnOrPkt = Convert.ToInt32(row["CtnOrPktStock"]); obj.Pcs = Convert.ToInt32(row["PcsStock"]); obj.Qty = Convert.ToInt32(row["Balance"]); obj.StockDate = Convert.ToDateTime(row["StockDate"]); objStockList.Add(obj); } return(objStockList); } catch (Exception ex) { throw; } }
public BO.DMS_AreaStock GetCurrentStockByProductID(long ProductID) { try { SqlConnection con = CreateCon(); SqlDataAdapter da = new SqlDataAdapter(); da.SelectCommand = new SqlCommand(); da.SelectCommand.CommandText = "POS_SP_GetCurrentStockByProductID"; da.SelectCommand.CommandType = CommandType.StoredProcedure; da.SelectCommand.Connection = con; da.SelectCommand.Parameters.Add("@AreaID", SqlDbType.Int).Value = 1; da.SelectCommand.Parameters.Add("@ProductID", System.Data.SqlDbType.BigInt).Value = ProductID; if (con.State == ConnectionState.Closed) { con.Open(); } DataSet ds = new DataSet(); da.Fill(ds); if (con.State == ConnectionState.Open) { con.Close(); } DataTable dt = ds.Tables[0]; List <POS.BO.DMS_AreaStock> objProductPackSize = new List <POS.BO.DMS_AreaStock>(); POS.BO.DMS_AreaStock obj = null; int index = 1; foreach (DataRow row in dt.Rows) { obj = new BO.DMS_AreaStock(); obj.Sln = index++; obj.CtnOrPkt = Convert.ToInt32(row["CtnOrPktStock"]); obj.Qty = Convert.ToInt32(row["Balance"]); obj.Pcs = Convert.ToInt32(row["PcsStock"]); } return(obj); } catch (Exception) { throw; } }
private void btnSave_Click(object sender, EventArgs e) { try { BO.DMS_AreaStock ObjDMS_AreaStock = new BO.DMS_AreaStock(); ObjDMS_AreaStock.AreaID = 1; ObjDMS_AreaStock.ProductID = Convert.ToInt32(ddlProduct.SelectedValue); ObjDMS_AreaStock.Strip = Convert.ToInt32(txtStrip.Text); ObjDMS_AreaStock.PcsPerStrip = Convert.ToInt32(txtPcsPerStrip.Text); ObjDMS_AreaStock.CtnOrPkt = Convert.ToInt32(txtCtnPkt.Text); ObjDMS_AreaStock.Pcs = Convert.ToInt32(txtPcs.Text); ObjDMS_AreaStock.Qty = Convert.ToInt32(txtQty.Text); ObjDMS_AreaStock.StockTransantionDate = Convert.ToDateTime(TransactionDate.Value.ToString()); if (txtStrip.Text != "" || txtPcsPerStrip.Text != "") { if (_IDMS_AreaStock.Insert(ObjDMS_AreaStock) > 0) { MessageBox.Show("Succesfully Saved"); Reset(); GetCurrentStock(); } else { MessageBox.Show("Operation Failed"); } } else if (txtStrip.Text != "" && txtPcsPerStrip.Text != "") { MsgBox msgBow = new MsgBox(); msgBow.Show(); } } catch (Exception ex) { MsgBox msgBow = new MsgBox(); msgBow.Show(); } }