/// <summary> /// constructor for copying ItemDetails ( Core Domain) values /// </summary> /// <param name="dataCount"></param> public SearchModel(ItemDetails dataCount) { this.Products = (from p in dataCount.Products select new ItemJsonModel { id =p.ProductKey, code = p.ProductItemCode, itemname = p.Product }).ToList(); this.Department=(from p in dataCount.Category select new DepartmentJsonModel { id=p.Level1Code, department=p.Level1Desc }).ToList(); }
public PriceOptSearchDataModel(ItemDetails item) { List<SelectListItem> items = new List<SelectListItem>(); items.Add(new SelectListItem { Text = "ZoneGroup", Value = null, Selected = true }); ZoneGroup = items; foreach (var p in item.ZoneGroup.GroupBy(o => new { o.Code, o.Name }) .Select(o => o.FirstOrDefault())) { ZoneGroup.Add(new SelectListItem() { Text = p.Name, Value = p.Name }); } List<SelectListItem> store = new List<SelectListItem>(); store.Add(new SelectListItem { Text = "Store", Value = null, Selected = true }); Store = store; foreach (var p in item.Store.GroupBy(o => new { o.StoreCode, o.Store }) .Select(o => o.FirstOrDefault())) { Store.Add(new SelectListItem() { Text = p.Store, Value = p.StoreCode }); } List<SelectListItem> product = new List<SelectListItem>(); product.Add(new SelectListItem { Text = "", Value = null, Selected = true }); Product = product; foreach (var p in item.Products.GroupBy(o => new { o.Product, o.ProductKey }) .Select(o => o.FirstOrDefault())) { Product.Add(new SelectListItem() { Text = p.Product, Value = p.ProductKey }); } }
public void GetItemDetails() { var result = new ItemDetails(); Database db = new Database(); string[,] str = new string[1, 2]; str[0, 0] = "@action"; str[0, 1] = "all"; string xmlResult = db.StoreprocedureExecuteQueryReturned("usp_GetDashboardCountDetails", str); var serializer = new XmlSerializer(typeof(ItemDetails)); if (!string.IsNullOrEmpty(xmlResult)) { using (var reader = new StringReader(xmlResult)) { result = (ItemDetails)serializer.Deserialize(reader); } } HttpContext.Current.Cache["ItemDetails"] = result; }
/// <summary> /// constructor for copying ItemDetails ( Core Domain) values /// </summary> /// <param name="dataCount"></param> public CountModel(ItemDetails dataCount) { this.Products = (from p in dataCount.Products select new ProductDetailsModel { ProductKey =p.ProductKey, ProductItemCode =p.ProductItemCode, Product=p.Product, Brand=p.Brand, Size =p.Size, UMO =p.UMO, Level1=p.Level1, Level2=p.Level2, Price=p.Price, Cost=p.Cost, Store=p.Store, ZoneGroup=p.ZoneGroup, StoreId=p.StoreId }).ToList(); this.Store = (from p in dataCount.Store select new StoreDetailsModel { Store=p.Store, StoreCode=p.StoreCode }).ToList(); //this.Category = (from p in dataCount.Category // select new CategoryModel // { // Level1Code = p.Level1Code, // Level1Desc=p.Level1Desc, // Level2Code=p.Level2Code, // Level2Desc=p.Level2Desc, // Level3Code=p.Level3Code, // Level3Desc=p.Level3Desc, // Level4Code=p.Level4Code, // Level4Desc=p.Level4Desc, // Level5Code=p.Level5Code, // Level5Desc=p.Level5Desc, // }).ToList(); this.UploadedOn = dataCount.UploadedOn; List<SelectListItem> prdct = new List<SelectListItem>(); prdct.Add(new SelectListItem { Text = "All Product", Value = null, Selected = true }); ProductsList = prdct; foreach (var p in dataCount.Products.GroupBy(o => new { o.ProductKey, o.Product }) .Select(o => o.FirstOrDefault())) { ProductsList.Add(new SelectListItem() { Text = p.Product, Value = p.ProductKey }); } List<SelectListItem> deprt = new List<SelectListItem>(); deprt.Add(new SelectListItem { Text = "All Department", Value = null, Selected = true }); DepartmentList = deprt; foreach (var p in dataCount.Department.GroupBy(o => new { o.Level1Code, o.Level1Desc }) .Select(o => o.FirstOrDefault())) { DepartmentList.Add(new SelectListItem() { Text = p.Level1Desc, Value = p.Level1Desc }); } List<SelectListItem> items = new List<SelectListItem>(); items.Add(new SelectListItem { Text = "All ZoneGroup", Value =null, Selected = true }); ZoneGroup = items; foreach (var p in dataCount.ZoneGroup.GroupBy(o => new { o.Code, o.Name}) .Select(o => o.FirstOrDefault())) { ZoneGroup.Add(new SelectListItem() { Text =p.Name, Value = p.Name }); } List<SelectListItem> category = new List<SelectListItem>(); category.Add(new SelectListItem { Text = "All Category", Value = null, Selected = true }); CategoryList = category; foreach (var p in dataCount.Category.GroupBy(o => new { o.Level2Code, o.Level2Desc }) .Select(o => o.FirstOrDefault())) { CategoryList.Add(new SelectListItem() { Text = p.Level2Desc, Value = p.Level2Desc }); } List<SelectListItem> store = new List<SelectListItem>(); store.Add(new SelectListItem { Text = "All Store", Value = null, Selected = true }); StoreList = store; foreach (var p in dataCount.Store.GroupBy(o => new { o.StoreCode, o.Store }) .Select(o => o.FirstOrDefault())) { StoreList.Add(new SelectListItem() { Text = p.Store, Value = p.Store }); } }