public ActionResult Add()
        {
            try
            {
                if (!CheckMemberlogin)
                {
                    return RedirectToAction("login", "admin");
                }
                else
                {
                    leftModel();
                    var model = new productViewModel()
                    {
                        productClass = proclassd.Get().ToList().OrderBy(a => a.sort)
                    };
                    return View(model);
                }

            }
            catch (Exception ex)
            {
                NlogWrite.Log(ex, 6);
                return RedirectToAction("login", "admin");
            }
        }
 public ActionResult Index()
 {
     var model = new productViewModel()
     {
         product = pd.Get().ToList().Where(a => a.isdel == 0),
         productClass = pcd.Get().ToList()
     };
     return View(model);
 }
        public ActionResult Detail(int m, int num, int kind)
        {
            var model = new productViewModel()
            {
                productClass = pcd.Get().ToList(),
                product_detail = pd.Get().ToList().Where(a => a.isdel == 0),
                product = pd.Get().ToList().Where(a => a.isdel == 0 && a.num == num),
                productSize = psized.Get().ToList().Where(a => a.pid == num && a.isdel == 0),
                productColor = pcolord.Get().ToList().Where(a => a.pid == num && a.isdel == 0),
                m = m,
                productnum = num,
                kind = kind
            };

            return View(model);
        }
 public ActionResult Add()
 {
     if (!CheckMemberlogin)
     {
         return RedirectToAction("login", "admin");
     }
     else
     {
         leftModel();
         var model = new productViewModel()
         {
             product = pd.Get().Where(a => a.isdel == 0).ToList()
         };
         return View(model);
     }
 }
 public ActionResult Add()
 {
     if (!CheckMemberlogin)
     {
         return RedirectToAction("login", "admin");
     }
     else
     {
         leftModel();
         var model = new productViewModel()
         {
             product_type = ptd.Get().ToList().OrderByDescending(a => a.num),
             product = pd.Get().ToList().Where(a => a.isdel == 0),
             productClass = pcd.Get().ToList().Where(a=>a.isdel == 0)
         };
         return View(model);
     }
 }
        public ActionResult Search(string keyval = "")
        {
            ViewBag.keyval = keyval;
            ViewBag.isSearch = false;
            int page = (Request.QueryString["page"] != null) ? Convert.ToInt32(Request.QueryString["page"]) : 1;
            double pagesize = 6, count = 0;
            int pagesort = (page - 1) * Convert.ToInt32(pagesize);
            IEnumerable<product> productdata = null;
            if (keyval != "")
            {
                Session["keywordforSearch"] = keyval;
            }
            else
            {
                if (Session["keywordforSearch"] == null)
                {
                    Session["keywordforSearch"] = keyval;
                }
            }
            if (Session["keywordforSearch"].ToString() != "")
            {
                count = Convert.ToDouble(productd.Get().ToList()
                    .Where(a => a.isdel == 0 && (
                        //   a.pname.Contains(Session["keywordforSearch"].ToString())
                        //|| a.pname.Contains(Session["keywordforSearch"].ToString().ToLower())
                        //|| a.pname.Contains(Session["keywordforSearch"].ToString().ToUpper())
                        //|| a.word.Contains(Session["keywordforSearch"].ToString())
                        //|| a.word.Contains(Session["keywordforSearch"].ToString().ToLower())
                        //|| a.word.Contains(Session["keywordforSearch"].ToString().ToUpper())
                           a.Model.Contains(Session["keywordforSearch"].ToString())
                        || a.Model.Contains(Session["keywordforSearch"].ToString().ToLower())
                        || a.Model.Contains(Session["keywordforSearch"].ToString().ToUpper())
                        || a.OENO.Contains(Session["keywordforSearch"].ToString())
                        || a.OENO.Contains(Session["keywordforSearch"].ToString().ToLower())
                        || a.OENO.Contains(Session["keywordforSearch"].ToString().ToUpper())
                        || a.kindname.Contains(Session["keywordforSearch"].ToString())
                        || a.kindname.Contains(Session["keywordforSearch"].ToString().ToLower())
                        || a.kindname.Contains(Session["keywordforSearch"].ToString().ToUpper())
                        )).Count());
                productdata = productd.Get().ToList().Where(
                    a => a.isdel == 0 && (
                        //   a.pname.Contains(Session["keywordforSearch"].ToString())
                        //|| a.pname.Contains(Session["keywordforSearch"].ToString().ToLower())
                        //|| a.pname.Contains(Session["keywordforSearch"].ToString().ToUpper())
                        //|| a.word.Contains(Session["keywordforSearch"].ToString())
                        //|| a.word.Contains(Session["keywordforSearch"].ToString().ToLower())
                        //|| a.word.Contains(Session["keywordforSearch"].ToString().ToUpper())
                           a.Model.Contains(Session["keywordforSearch"].ToString())
                        || a.Model.Contains(Session["keywordforSearch"].ToString().ToLower())
                        || a.Model.Contains(Session["keywordforSearch"].ToString().ToUpper())
                        || a.OENO.Contains(Session["keywordforSearch"].ToString())
                        || a.OENO.Contains(Session["keywordforSearch"].ToString().ToLower())
                        || a.OENO.Contains(Session["keywordforSearch"].ToString().ToUpper())
                        || a.kindname.Contains(Session["keywordforSearch"].ToString())
                        || a.kindname.Contains(Session["keywordforSearch"].ToString().ToLower())
                        || a.kindname.Contains(Session["keywordforSearch"].ToString().ToUpper())
                        ));

                ViewBag.count = count;
                ViewBag.isSearch = true;
            }
            else
            {
                count = Convert.ToDouble(productd.Get().ToList().Where(a => a.isdel == 0).Count());
                productdata = productd.Get().ToList().Where(a => a.isdel == 0);
                ViewBag.count = count;
                ViewBag.isSearch = false;
            }

            var model = new productViewModel()
            {
                product = productdata.OrderBy(a => a.sort).Skip(pagesort).Take(Convert.ToInt32(pagesize)),
                productClass = proclassd.Get().ToList(),
                page = page,
                pages = Convert.ToInt32(Math.Ceiling(count / pagesize))
            };
            return View(model);
        }
        public ActionResult inquiry()
        {
            var model = new productViewModel()
            {
                product = productd.Get().ToList().Where(a => a.isdel == 0).OrderBy(a => a.sort),
                productClass = proclassd.Get().ToList(),
                contact = cond.Get().ToList()
            };

            return View(model);
        }
        public ActionResult Detail(int num, int kind)
        {
            //加入最近瀏覽
            if (Request.Cookies["tracking_" + num.ToString()] != null)
            {

            }
            else
            {
                HttpCookie cookie = new HttpCookie("tracking_" + num.ToString());
                cookie.Values.Add("num", num.ToString());
                //cookie.Values.Add("wdate", DateTime.Now.ToShortDateString());
                cookie.Expires = DateTime.Now.AddDays(1);
                Response.Cookies.Add(cookie);
            }

            var model = new productViewModel()
            {
                allproduct = pd.Get().ToList().Where(a => a.isdel == 0),
                //product_type = ptd.Get().ToList().Where(a => a.isdel == 0 && a.pid == kind),
                //product_type_item = ptid.Get().ToList().Where(a => a.isdel == 0),
                product = pd.Get().ToList().Where(a => a.num == num && a.isdel == 0).OrderBy(a => a.sort),
                productClass = pcd.Get().ToList().Where(a => a.isdel == 0)
            };
            return View(model);
        }
 public ActionResult Edit(int num)
 {
     if (!CheckMemberlogin)
     {
         return RedirectToAction("login", "admin");
     }
     else
     {
         leftModel();
         var model = new productViewModel()
         {
             product_type = ptd.Get().ToList().Where(a => a.num == num),
             product = pd.Get().ToList().Where(a => a.isdel == 0),
             productClass = pcd.Get().ToList().Where(a=>a.isdel == 0),
             product_type_item = ptid.Get().ToList().Where(a => a.isdel == 0 && a.ptid == num)
         };
         return View(model);
     }
 }
        public ActionResult Read(int page = 1, string find1 = "")
        {
            if (!CheckMemberlogin)
            {
                return RedirectToAction("login", "admin");
            }
            else
            {
                leftModel();
                ViewBag.searchResult = 0;
                ViewBag.search = 0;
                ViewBag.gowhere = Url.Action("Read", "adminProduct");
                //if (find1 != "")
                //{
                //    ViewBag.searchResult = 1;
                //    ViewBag.searchText = find1;
                //}
                var currentpage = page < 1 ? 1 : page;
                var pagesize = 10;
                var pro = ptd.Get().ToList().Where(a => a.isdel == 0);
                var model = new productViewModel()
                {
                    product_type_pagelist = pro.ToPagedList(currentpage, pagesize),
                    product = pd.Get().ToList().Where(a => a.isdel == 0),
                    productClass = pcd.Get().ToList().Where(a => a.isdel == 0)
                    //productClass = proclassd.Get().ToList()
                };

                return View(model);
            }
        }
Exemplo n.º 11
0
        public ActionResult pro_info(int num)
        {
            var model = new productViewModel()
            {
                allproduct = pd.Get().ToList().Where(a => a.isdel == 0),
                product = pd.Get().ToList().Where(a => a.isdel == 0).OrderBy(a => a.sort),
                productClass = pcd.Get().ToList().Where(a => a.isdel == 0 && a.num == num).OrderBy(a => a.sort)

            };

            return View(model);
        }
Exemplo n.º 12
0
        public ActionResult list(int? kind)
        {
            productViewModel model = null;

            int page = (Request.QueryString["page"] != null) ? Convert.ToInt32(Request.QueryString["page"]) : 1;
            double pagesize = 900, count = 0;
            int pagesort = (page - 1) * Convert.ToInt32(pagesize);

            if (kind != null)
            {
                count = Convert.ToDouble(pd.Get().ToList().Where(a => a.kind == kind && a.isdel == 0).Count());
                model = new productViewModel()
                {
                    product = pd.Get().ToList().Where(a => a.kind == kind && a.isdel == 0).OrderBy(a => a.sort).Skip(pagesort).Take(Convert.ToInt32(pagesize)),
                    productClass = pcd.Get().ToList().OrderBy(a => a.sort),
                    page = page,
                    pages = Convert.ToInt32(Math.Ceiling(count / pagesize))

                };
            }
            else
            {
                count = Convert.ToDouble(pd.Get().Where(a => a.isdel == 0).ToList().Count());
                model = new productViewModel()
                {
                    product = pd.Get().ToList().Where(a => a.isdel == 0).OrderBy(a => a.sort).Skip(pagesort).Take(Convert.ToInt32(pagesize)),
                    productClass = pcd.Get().ToList().OrderBy(a => a.sort),
                    page = page,
                    pages = Convert.ToInt32(Math.Ceiling(count / pagesize))

                };

            }

            return View(model);
        }
Exemplo n.º 13
0
        public ActionResult Index(int? kind)
        {
            var model = new productViewModel()
            {
                product = pd.Get().ToList().Where(a => a.isdel == 0),
                productClass = pcd.Get().ToList().Where(a => a.isdel == 0).OrderBy(a => a.sort),
                productHot = phd.Get().ToList().Where(a => a.num == 1 && a.pid != 0)
            };

            return View(model);
        }
Exemplo n.º 14
0
        public ActionResult list(int m, int? kind, int? kind2)
        {
            ViewBag.kind = kind;

            ViewBag.m = m;
            int page = (Request.QueryString["page"] != null) ? Convert.ToInt32(Request.QueryString["page"]) : 1;
            double pagesize = 6, count = 0;
            int pagesort = (page - 1) * Convert.ToInt32(pagesize);
            IEnumerable<product> data = null;
            if (kind != null && kind2 == null)
            {
                count = Convert.ToDouble(pd.Get().ToList().Where(a => a.isdel == 0 && a.kind == kind).Count());
                data = pd.Get().ToList().Where(a => a.isdel == 0 && a.kind == kind).OrderBy(a => a.sort).ThenByDescending(a => a.wdate);
            }
            else if (kind2 != null)
            {
                count = Convert.ToDouble(pd.Get().ToList().Where(a => a.isdel == 0 && a.kind2 == kind2).Count());
                data = pd.Get().ToList().Where(a => a.isdel == 0 && a.kind2 == kind2).OrderBy(a => a.sort).ThenByDescending(a => a.wdate);

            }

            var model = new productViewModel()
            {
                productClass = pcd.Get().ToList(),
                product_detail = pd.Get().ToList().Where(a => a.isdel == 0).OrderBy(a => a.sort).ThenByDescending(a => a.wdate),
                product = data.OrderBy(a => a.sort).ThenByDescending(a => a.wdate).Skip(pagesort).Take(Convert.ToInt32(pagesize)),
                page = page,
                pages = Convert.ToInt32(Math.Ceiling(count / pagesize)),
                m = m
            };
            return View(model);
        }
 public ActionResult Edit(int num)
 {
     if (!CheckMemberlogin)
     {
         return RedirectToAction("login", "admin");
     }
     else
     {
         leftModel();
         var model = new productViewModel()
         {
             productSize = psd.Get().ToList().Where(a => a.num == num),
             product = pd.Get().ToList()
         };
         return View(model);
     }
 }
        public ActionResult Read(int page = 1, string find1 = "")
        {
            if (!CheckMemberlogin)
            {
                return RedirectToAction("login", "admin");
            }
            else
            {
                leftModel();
                ViewBag.searchResult = 0;
                ViewBag.search = 1;
                ViewBag.gowhere = Url.Action("Read", "adminProductSize");
                ViewBag.searchSession = false;
                var currentpage = page < 1 ? 1 : page;
                var pagesize = 10;
                if (find1 != "")
                {
                    //ViewBag.searchResult = 1;
                    //ViewBag.searchText = find1;
                    Session["SizeSearch"] = find1;
                }
                else
                {
                    if (Session["SizeSearch"] == null)
                    {
                        Session["SizeSearch"] = find1;
                    }

                }
                if (Session["SizeSearch"].ToString() != "")
                {
                    ViewBag.searchSession = true;
                }
                else
                {
                    ViewBag.searchSession = false;
                }

                var pro = psd.Get().ToList().Where(a => a.isdel == 0 && (a.pname.Contains(Session["SizeSearch"].ToString()) || a.size.Contains(Session["SizeSearch"].ToString()))).OrderBy(a => a.sort);
                var model = new productViewModel()
                {
                    productSize_pagelist = pro.ToPagedList(currentpage, pagesize)

                };

                return View(model);
            }
        }
        public ActionResult Detail(int num)
        {
            ViewBag.num = num;
            var pro = productd.Get().ToList().Where(a => a.isdel == 0 && a.num == num).SingleOrDefault();
            ViewBag.kind = pro.kind;
            var model = new productViewModel()
            {
                product = productd.Get().ToList().Where(a => a.isdel == 0),
                productClass = proclassd.Get().ToList(),
                product_single = productd.Get().ToList().Where(a => a.isdel == 0 && a.num == num)

            };
            return View(model);
        }
        public ActionResult Read()
        {
            if (!CheckMemberlogin)
            {
                return RedirectToAction("login", "admin");
            }
            else
            {
                leftModel();

                var model = new productViewModel()
                {
                    productClass = proclassd.Get().ToList().OrderBy(a => a.sort)
                };

                return View(model);
            }
        }
        public ActionResult Index()
        {
            int page = (Request.QueryString["page"] != null) ? Convert.ToInt32(Request.QueryString["page"]) : 1;
            double pagesize = 6, count = 0;
            int pagesort = (page - 1) * Convert.ToInt32(pagesize);

            count = Convert.ToDouble(productd.Get().ToList().Where(a => a.isdel == 0).Count());

            var model = new productViewModel()
            {
                product = productd.Get().ToList().Where(a => a.isdel == 0).OrderBy(a => a.sort).Skip(pagesort).Take(Convert.ToInt32(pagesize)),
                productClass = proclassd.Get().ToList(),
                page = page,
                pages = Convert.ToInt32(Math.Ceiling(count / pagesize))
            };
            return View(model);
        }
        public ActionResult Read(int page = 1, string find1 = "")
        {
            try
            {
                if (!CheckMemberlogin)
                {
                    return RedirectToAction("login", "admin");
                }
                else
                {
                    leftModel();
                    ViewBag.searchResult = 0;
                    ViewBag.search = 1;
                    ViewBag.gowhere = Url.Action("Read", "adminProduct");
                    if (find1 != "")
                    {
                        ViewBag.searchResult = 1;
                        ViewBag.searchText = find1;
                    }

                    var currentpage = page < 1 ? 1 : page;
                    var pagesize = 10;
                    var pro = productd.Get().ToList().Where(a => a.isdel == 0 && (a.pname.Contains(find1))).OrderBy(a => a.sort);
                    var model = new productViewModel()
                    {
                        product_pagelist = pro.ToPagedList(currentpage, pagesize),
                        productClass = proclassd.Get().ToList()
                    };

                    return View(model);
                }
            }
            catch (Exception ex)
            {
                NlogWrite.Log(ex, 6);
                return RedirectToAction("login", "admin");
            }
        }
        public ActionResult Read(int page = 1, string find1 = "")
        {
            if (!CheckMemberlogin)
            {
                return RedirectToAction("login", "admin");
            }
            else
            {
                leftModel();
                ViewBag.searchResult = 0;
                ViewBag.search = 1;
                ViewBag.gowhere = Url.Action("Read", "adminProductSize");
                if (find1 != "")
                {
                    ViewBag.searchResult = 1;
                    ViewBag.searchText = find1;
                }

                var currentpage = page < 1 ? 1 : page;
                var pagesize = 10;
                var pro = pcd.Get().ToList().Where(a => a.isdel == 0 && (a.pname.Contains(find1) || a.color.Contains(find1))).OrderBy(a => a.sort);
                var model = new productViewModel()
                {
                    productColor_pagelist = pro.ToPagedList(currentpage, pagesize)

                };

                return View(model);
            }
        }