public ActionResult EditFBOrder(Guid FBOrderid)
        {
            FBOrder fborder = fborderService.GetByID(FBOrderid);

            if (TryUpdateModel(fborder, new string[] { "Url", "Count", "Productid", "FBOrderStatus", "Categoryid", "Istest" }) && ModelState.IsValid)
            {
                if (fborder.FBOrderStatus == 2 || fborder.FBOrderStatus == 3)
                {
                    /*** 將完成名單的會員Docker關閉 ****/
                    IEnumerable <FBMembers> FBMembers = fbmembersService.Get().Where(a => a.Isdocker == 1);
                    foreach (FBMembers FBMember in FBMembers)
                    {
                        if (FBMember.FBOrderlist.Where(a => a.FBOrderid == FBOrderid) != null)
                        {
                            FBMember.Isdocker = 0;
                            fbmembersService.SpecificUpdate(FBMember, new string[] { "Isdocker" });
                        }
                    }
                    fbmembersService.SaveChanges();
                }
                fborderService.Update(fborder);
                fborderService.SaveChanges();
            }
            return(RedirectToAction("FBOrder"));
        }
示例#2
0
        public ActionResult FBMembers(int p = 1)
        {
            //var data = fbmembersService.GetNoDel().OrderByDescending(o => o.Createdate);
            var data = fbmembersService.Get().OrderByDescending(o => o.Createdate);

            ViewBag.pageNumber = p;
            ViewBag.FBMembers  = data.ToPagedList(pageNumber: p, pageSize: 100);
            //ViewBag.FBMembers = data;

            //ViewBag.Check = db.FBMembers.Include(x => x.FBMembersLoginlog.OrderByDescending(o => o.Createdate).FirstOrDefault().Status == 1).Count();
            ViewBag.Check = fbmembersService.Get().Include(a => a.FBMembersLoginlog).Where(a => a.FBMembersLoginlog.FirstOrDefault().Status == 1).Count();
            ViewBag.Times = fbmembersService.Get().Include(a => a.FBMembersLoginlog).Where(a => a.FBMembersLoginlog.FirstOrDefault().Status == 2).Count();
            /**** FB 產品選單 ***/
            FBProductDropDownList();
            /**** 預備人選 ****/
            ViewBag.ReservedNumber = fbmembersService.GetNoDel().Where(a => a.Isenable == 2).Count();
            return(View());
        }
示例#3
0
        public JsonResult AjaxCheckFBMembersNumber()
        {
            Guid CategoryId = Guid.Parse("9f268158-09b1-4176-9088-a4a4af63d389");
            IEnumerable <Product> ProductList = productService.Get().Where(a => a.Categoryid == CategoryId).OrderBy(o => o.Orders);

            List <ProductNumber> List = new List <ProductNumber>();

            foreach (Product Product in ProductList)
            {
                int Count     = fbmembersService.Get().Where(a => a.FBMembersLoginlog.FirstOrDefault().Status != 2).Where(p => p.Productid == Product.Productid).Count();
                int PrepCount = fbmembersService.GetNoDel().Where(i => i.Isenable == 2).Where(a => a.FBMembersLoginlog.FirstOrDefault().Status != 2).Where(p => p.Productid == Product.Productid).Count();
                int Death     = fbmembersService.Get().Where(a => a.FBMembersLoginlog.FirstOrDefault().Status == 2).Where(p => p.Productid == Product.Productid).Count();
                List.Add(
                    new ProductNumber()
                {
                    Productname       = Product.Productname,
                    Productcount      = Count,
                    Productprepcount  = PrepCount,
                    Productdeathcount = Death
                }
                    );
            }
            return(this.Json(List, JsonRequestBehavior.AllowGet));
        }