//Methods public void showItemInformation() { int flag = 0; string itemNumber = Request.QueryString["itemCode"]; //Show Item Informaiton ItemBO b = bl.getItemByItemNumberBL(itemNumber);//check lblItemCode.Text = b.ItemNumber; lblItemDescription.Text = b.Description; lblBin.Text = b.Bin; lblUOM.Text = b.UnitOfMeasure; lblInStock.Text = b.InStockQty.ToString(); //Show Supplier Information ItemSupplierJoinBO sObj = new ItemSupplierJoinBO(); foreach (ItemSupplierJoinBO s in bl.getItemInformation(itemNumber)) { flag++; if (flag == 1) { lblSupplier1.Text = s.SupplierName; } else if (flag == 2) { lblSupplier2.Text = s.SupplierName; } else if (flag == 3) { lblSupplier3.Text = s.SupplierName; } } }
//Get all the supplier information public List <ItemSupplierJoinBO> getStockCardInformation(string itemNumber) { var qry = (from i in context.Items join si in context.Supplier_Item on i.ItemID equals si.ItemID join s in context.Suppliers on si.SupplierID equals s.SupplierID where i.ItemNumber.Equals(itemNumber) //Need to change or not select new { i.ItemNumber, i.Description, i.Bin, i.UnitOfMeasure, s.SupplierName }).ToList(); List <ItemSupplierJoinBO> lst = new List <ItemSupplierJoinBO>(); foreach (var q in qry) { ItemSupplierJoinBO obj = new ItemSupplierJoinBO(); obj.ItemCode = q.ItemNumber; obj.Description = q.Description; obj.Bin = q.Bin; obj.Uom = q.UnitOfMeasure; obj.SupplierName = q.SupplierName; lst.Add(obj); } return(lst); }
//Get the suppliers lists public List <ItemSupplierJoinBO> getSupplierListByItemNumber(string itemNumber) { var qry = (from i in context.Items join si in context.Supplier_Item on i.ItemID equals si.ItemID join s in context.Suppliers on si.SupplierID equals s.SupplierID where i.ItemNumber == itemNumber select new { i.ItemNumber, i.Description, i.Bin, i.UnitOfMeasure, s.SupplierName, s.SupplierID }).Distinct().ToList(); List <ItemSupplierJoinBO> lst = new List <ItemSupplierJoinBO>(); foreach (var q in qry) { ItemSupplierJoinBO obj = new ItemSupplierJoinBO(); obj.ItemCode = q.ItemNumber; obj.Description = q.Description; obj.Bin = q.Bin; obj.Uom = q.UnitOfMeasure; obj.SupplierName = q.SupplierName; obj.SupplierID = q.SupplierID; lst.Add(obj); } return(lst); }