Exemple #1
0
        public ActionResult Index(string id)
        {
            var AllGalleryFoldersData = _orderService.SelectOrderableProducts().ToList();

            List<OrderableProducts> lstOrderableProductsInfo = new List<OrderableProducts>();

            for (int i = 0; i < 5; i++)
            {
                OrderableProducts objOrderableProducts = new OrderableProducts();
                objOrderableProducts.Row_Id = i;
                objOrderableProducts.WebName = "Photography " + i.ToString();
                lstOrderableProductsInfo.Add(objOrderableProducts);
            }

            var lstOrderableProd = lstOrderableProductsInfo.Select(p => new
            {
                Row_Id = p.Row_Id,
                productDes = p.WebName

            });

            using (var OrderMangtDB = new OrderMgntEntities())
            {
                var currentUser = UserManager.Current();
                int calendarUserId;
                if (currentUser != null && currentUser.UserType == 1)
                {
                    IList<OrderViewModel> order = _orderService.GetAll();
                    foreach (var item in order)
                    {
                        item.PropertyName = item.Property_Id != null ? getPropertyNameById((int)item.Property_Id) : "";
                        item.CompanyName = item.Property_Id != null ? getCompanyNameByPropertyId((int)item.Property_Id) : "";
                    }
                    return PartialView("Controls/Order/_OrderList", order);
                }
                else
                {
                    var calendarUser = OrderMangtDB.CalendarUsers.ToList().Where(x => x.UserId.Equals(currentUser.Row_Id)).FirstOrDefault();
                    calendarUserId = (int)calendarUser.CalendarId;
                    var orderIdList = OrderMangtDB.EventTrackings.ToList().Where(x => x.CalendarId.Equals(calendarUserId)).Select(x => x.OrderId).ToArray();
                    var orders = OrderMangtDB.Orders.ToList().Where(x => orderIdList.Contains(x.OrderId));
                    var orderlstModel = Mapper.Map<IEnumerable<Order>, List<OrderViewModel>>(orders);
                    foreach (var item in orderlstModel)
                    {
                        item.PropertyName = item.Property_Id != null ? getPropertyNameById((int)item.Property_Id) : "";
                        item.CompanyName = item.Property_Id != null ? getCompanyNameByPropertyId((int)item.Property_Id) : "";

                        //  item.RequiredDate.Value = item.RequiredDate.Value != null ? item.RequiredDate: "";//Convert.ToDateTime(item.RequiredDate) : "";
                        if (item.RequiredDate.Value != null)
                        {
                            item.RequiredDate = item.RequiredDate;
                        }
                    }

                    return PartialView("Controls/Order/_OrderList", orderlstModel);
                }
            }
        }
Exemple #2
0
        public JsonResult GetOrderableProductsDataJson(string groupid = "1")
        {
            // _orderService

            var AllGalleryFoldersData = _orderService.SelectOrderableProducts().ToList();

            List<OrderableProducts> lstOrderableProductsInfo = new List<OrderableProducts>();

                for (int i = 0; i < 5; i++)
                {
                    OrderableProducts objOrderableProducts = new OrderableProducts();
                    objOrderableProducts.Row_Id = i;
                    objOrderableProducts.WebName = "Photography " + i.ToString();
                    lstOrderableProductsInfo.Add(objOrderableProducts);
                }

                var lstOrderableProd = lstOrderableProductsInfo.Select(p => new
                {
                    Row_Id = p.Row_Id,
                    productDes = p.WebName

                });

            //var TagList = AllGalleryFoldersData.ToList().Where(m => m.ROW_ID == Convert.ToInt16(groupid)).Select(i => new { i.ROW_ID, i.TAGS, i.FOLDER });

            //List<TagInfo> TagInfo = new List<TagInfo>();

            //foreach (var item in TagList)
            //{
            //    string strTag = item.TAGS;
            //    List<TagInfo> lstTagInfo = new List<TagInfo>();
            //    if (!string.IsNullOrEmpty(strTag))
            //    {
            //        string[] strTagArray = strTag.Split(';');

            //        foreach (string obj in strTagArray)
            //        {
            //            TagInfo objtagInfo = new TagInfo();
            //            objtagInfo.Row_Id = item.ROW_ID;
            //            objtagInfo.Folder = item.FOLDER;
            //            objtagInfo.TagName = obj;
            //            lstTagInfo.Add(objtagInfo);
            //        }
            //    }
            //    TagInfo = lstTagInfo;
            //}

                return Json(lstOrderableProd, JsonRequestBehavior.AllowGet);
        }