private void GetStockSnap() { Business.Inventory.Stock objStock = new Business.Inventory.Stock(); string name = (string.IsNullOrEmpty(txtName.Text.Trim())) ? string.Empty : txtName.Text.Trim(); gvStockSnap.DataSource = objStock.GetStockSnap(name); gvStockSnap.DataBind(); }
private List <StockDetailModel> GetStockDetails(string itemId, string itemType, string assetLocationId) { List <StockDetailModel> model = new List <StockDetailModel>(); Business.Inventory.Stock objStock = new Business.Inventory.Stock(); Business.Inventory.Inventory objInventory = new Business.Inventory.Inventory(); DataTable response = new DataTable(); if (Convert.ToInt32(assetLocationId) == (int)AssetLocation.Store) { response = objInventory.Inventory_StockLocationWiseQuantity(Convert.ToInt32(itemId), (ItemType)Enum.Parse(typeof(ItemType), itemType)); if (response != null && response.AsEnumerable().Any()) { foreach (DataRow dr in response.Rows) { model.Add(new Models.StockDetailModel { Quantity = string.Format("Quantity: {0}", dr["Quantity"].ToString()), Name = string.Format("Store: {0}", dr["StoreName"].ToString()), }); } } } else if ((Convert.ToInt32(assetLocationId) == (int)AssetLocation.FOC) || (Convert.ToInt32(assetLocationId) == (int)AssetLocation.Sale)) { int challanTypeId = 0; if ((AssetLocation)Enum.Parse(typeof(AssetLocation), assetLocationId) == AssetLocation.Sale) { challanTypeId = 1; } else { challanTypeId = 2; } response = objInventory.Inventory_SaleFocWiseQuantity(Convert.ToInt32(itemId), (ItemType)Enum.Parse(typeof(ItemType), itemType), challanTypeId); if (response != null && response.AsEnumerable().Any()) { foreach (DataRow dr in response.Rows) { model.Add(new Models.StockDetailModel { Quantity = string.Format("Quantity: {0}", dr["Quantity"].ToString()), Name = string.Format("Customer Name: {0}", dr["Customer"].ToString()), }); } } } return(model); }
private List <Models.StockSnapModel> GetStockSnaps(int employeeId, string itemName) { List <Models.StockSnapModel> model = new List <StockSnapModel>(); Business.Inventory.Stock objStock = new Business.Inventory.Stock(); string name = (string.IsNullOrEmpty(itemName.Trim())) ? string.Empty : itemName.Trim(); Business.HR.EmployeeMaster objEmployeeMaster = new Business.HR.EmployeeMaster(); Entity.HR.EmployeeMaster employeeMaster = new Entity.HR.EmployeeMaster(); DataTable dtEmployee = objEmployeeMaster.EmployeeMaster_ById(new Entity.HR.EmployeeMaster() { EmployeeMasterId = employeeId }); if (dtEmployee.AsEnumerable().Any()) { employeeMaster = objEmployeeMaster.AuthenticateUser(dtEmployee.Rows[0]["EmployeeCode"].ToString()); } if (employeeMaster != null) { string[] roles = employeeMaster.Roles.Split(','); if (roles.Contains(Entity.HR.Utility.STOCK_LOOKUP)) { DataTable response = objStock.GetStockSnap(itemName); if (response != null && response.AsEnumerable().Any()) { foreach (DataRow dr in response.Rows) { model.Add(new Models.StockSnapModel { AssetLocationId = dr["AssetLocationId"].ToString(), ItemId = dr["ItemId"].ToString(), ItemType = dr["ItemType"].ToString(), Location = string.Format("Location: {0}", dr["Location"].ToString()), Quantity = string.Format("Quantity: {0}", dr["Quantity"].ToString()), ItemName = (Convert.ToInt32(dr["ItemType"].ToString()) == (int)ItemType.Product) ? string.Format("Product Name: {0}", dr["ProductName"].ToString()) : string.Format("Spare Name: {0}", dr["SpareName"].ToString()), }); } } } else { } } return(model); }