Beispiel #1
0
        public ActionResult SAreaDT3()
        {
            global::farmarproject2.Models.farmarEntities1 farmar = new Models.farmarEntities1();
            var List2 = farmar.products.Select(x => x).ToList();

            var List1 = List2.Select(x => new Serviceitem
            {
                productid   = x.productid,
                productname = x.productname,
                unitprice   = x.unitprice,
                unitstock   = x.unitstock,
                //description = $"{x.description.Substring(0,15)}.....",
                picture    = x.productid,
                category   = x.category,
                user_email = x.user_email,
                EmailA     = x.productid
            }).ToList <Serviceitem>();

            foreach (var x in List1)
            {
                var i = List2.Where(o => o.productid == x.productid).SingleOrDefault();
                if (i.description.Length < 16)
                {
                    x.description = i.description;
                }
                else
                {
                    x.description = $"{i.description.Substring(0, 15)}.....";
                }
            }
            return(Json(new { data = List1 }, JsonRequestBehavior.AllowGet));
        }
Beispiel #2
0
        public ActionResult OrderEditView(int id = 0)
        {
            if (id == 0)
            {
                return(View("Index"));
            }
            global::farmarproject2.Models.farmarEntities1 farmar = new Models.farmarEntities1();
            Serviceorder user = farmar.orders.Where(o => o.order_id == id).Select(o => new Serviceorder
            {
                order_id = o.order_id,
                status   = o.status,
                buy_id   = o.buy_id,
                flag     = true
            }).SingleOrDefault();

            var T = farmar.order_detail.Where(o => o.order_id == id).ToList();

            foreach (var x in T)
            {
                var produ = farmar.products.Where(o => o.productid == x.productid).SingleOrDefault();
                if (produ.unitstock < x.quiantity)
                {
                    user.flag = false;
                }
            }

            return(View(user));
        }
Beispiel #3
0
        public ActionResult Itemphoto(int id)
        {
            global::farmarproject2.Models.farmarEntities1 farmar = new Models.farmarEntities1();
            var x = farmar.products.Find(id).picture;

            return(File(x, "image/jpeg"));
        }
Beispiel #4
0
        public ActionResult SAreaDT4()
        {
            global::farmarproject2.Models.farmarEntities1 farmar = new Models.farmarEntities1();
            var List2 = farmar.orders.Select(x => x).ToList();


            var List1 = List2.Select(x => new Serviceordetail
            {
                order_id    = x.order_id,
                buy_Name    = x.buy_id,
                sell_id     = x.sell_id,
                total_price = farmar.order_detail.Where(o => o.order_id == x.order_id).Select(p => p.total_price).Sum(),
                status      = x.status,
                date        = x.date,
                EmailA      = x.order_id
            }).ToList <Serviceordetail>();

            foreach (var x in List1)
            {
                var T = farmar.order_detail.Where(o => o.order_id == x.order_id).ToList();
                foreach (var y in T)
                {
                    x.detail += $"<tr><td>商品名稱:{y.productname}</td><td>數量:{y.quiantity}</td><td>金額:{y.total_price}</td></tr>";
                }
            }
            return(Json(new { data = List1 }, JsonRequestBehavior.AllowGet));
        }
Beispiel #5
0
        public ActionResult ResetPsView(string id = "")
        {
            if (id == "")
            {
                return(View("Index"));
            }
            global::farmarproject2.Models.farmarEntities1 farmar = new Models.farmarEntities1();
            AspNetUser user = farmar.AspNetUsers.Where(o => o.Id == id).SingleOrDefault();

            return(View(user));
        }
Beispiel #6
0
        public ActionResult DeleteItemView(int id = 0)
        {
            if (id == 0)
            {
                return(View("Index"));
            }
            global::farmarproject2.Models.farmarEntities1 farmar = new Models.farmarEntities1();
            product user = farmar.products.Where(o => o.productid == id).SingleOrDefault();

            return(View(user));
        }
Beispiel #7
0
        public ActionResult SAreaDT2()
        {
            global::farmarproject2.Models.farmarEntities1 farmar = new Models.farmarEntities1();
            var List2 = farmar.AspNetUsers.Select(x => x).ToList();

            var List1 = List2.Select(x => new Serviceuser
            {
                Email       = x.Email,
                FamName     = x.FamName,
                PhoneNumber = x.PhoneNumber,
                UserIg      = x.UserIg,
                EmailA      = x.Id
            }).ToList <Serviceuser>();

            return(Json(new { data = List1 }, JsonRequestBehavior.AllowGet));
        }
Beispiel #8
0
        //GET
        public ActionResult SAreaDT1()
        {
            global::farmarproject2.Models.farmarEntities1 farmar = new Models.farmarEntities1();
            var List2 = farmar.ServiceLogins.Select(x => x).ToList();

            var List1 = List2.Select(x => new ServiceLogin2
            {
                userID    = x.userID,
                State     = x.State,
                Type      = x.Type,
                LoginTime = x.LoginTime.ToString(),
                ContentA  = x.ContentA
            }).ToList <ServiceLogin2>();

            return(Json(new { data = List1 }, JsonRequestBehavior.AllowGet));
        }