public ActionResult IGOrder(int p = 1)
        {
            var data = igorderService.Get().OrderByDescending(o => o.Createdate);

            ViewBag.pageNumber = p;
            /*** Instagram產品選單 ***/
            IGProductDropDownList();
            ViewBag.IGOrder       = data.ToPagedList(pageNumber: p, pageSize: 20);
            ViewBag.IGOrder_total = igorderService.Get().OrderByDescending(o => o.Createdate);
            return(View());
        }
        public JsonResult AjaxCalcCheckedCost()
        {
            double Cost  = 0.0;  //成本
            double Price = 0.0;  //售價
            double Count = 0.0;  //筆數

            string[] OrdernumberList = Session["OrderStatistics"].ToString().Split(';');
            foreach (string ordernumber in OrdernumberList)
            {
                if (ordernumber != "")
                {
                    if (ordernumber.IndexOf("FB") != -1)
                    {
                        FBOrder fborder = fborderService.Get().Where(a => a.FBOrdernumber == ordernumber).FirstOrDefault();
                        Product product = productService.GetByID(fborder.Productid);
                        if (fborder.Istest == true)
                        {
                            Cost  += 0.0;
                            Price += 0.0;
                        }
                        else
                        {
                            Cost  += Convert.ToInt32(product.Cost * fborder.Count);
                            Price += Convert.ToInt32(product.Price * fborder.Count);
                        }
                    }
                    else if (ordernumber.IndexOf("IG") != -1)
                    {
                        IGOrder igorder = igorderService.Get().Where(a => a.IGOrdernumber == ordernumber).FirstOrDefault();
                        Product product = productService.GetByID(igorder.Productid);
                        if (igorder.Istest == true)
                        {
                            Cost  += 0.0;
                            Price += 0.0;
                        }
                        else
                        {
                            Cost  += Convert.ToInt32(product.Cost * igorder.Count);
                            Price += Convert.ToInt32(product.Price * igorder.Count);
                        }
                    }
                    else if (ordernumber.IndexOf("YT") != -1)
                    {
                        YTOrder ytorder = ytorderService.Get().Where(a => a.YTOrdernumber == ordernumber).FirstOrDefault();
                        Product product = productService.GetByID(ytorder.Productid);
                        if (ytorder.Istest == true)
                        {
                            Cost  += 0.0;
                            Price += 0.0;
                        }
                        else
                        {
                            Cost  += Convert.ToInt32(product.Cost * ytorder.Count);
                            Price += Convert.ToInt32(product.Price * ytorder.Count);
                        }
                    }
                    Count++;
                }
            }
            Session.Remove("OrderStatistics");  // 清除Session的訂單編號
            return(this.Json(Cost + ";" + Price + ";" + (Price - Cost) + ";" + Count));
        }