示例#1
0
        protected override void Initialize(System.Web.Routing.RequestContext requestContext)
        {
            base.Initialize(requestContext);

            a__WebVisitData ac_WebVisit = new a__WebVisitData()
            {
                Connection = getSQLConnection()
            };
            m__WebVisitData md_WebVisit = new m__WebVisitData();

            md_WebVisit.id      = ac_WebVisit.GetIDX();
            md_WebVisit.ip      = System.Web.HttpContext.Current.Request.UserHostAddress;
            md_WebVisit.browser = System.Web.HttpContext.Current.Request.Browser.Browser + "." + System.Web.HttpContext.Current.Request.Browser.Version;
            md_WebVisit.setdate = DateTime.Now;
            if (System.Web.HttpContext.Current.Request.UrlReferrer != null)
            {
                md_WebVisit.source = System.Web.HttpContext.Current.Request.UrlReferrer.AbsoluteUri;
            }

            md_WebVisit.page = System.Web.HttpContext.Current.Request.Url.AbsoluteUri;
            ac_WebVisit.InsertMaster(md_WebVisit, 0);

            a__WebCount ac_WebCount = new a__WebCount()
            {
                Connection = getSQLConnection()
            };

            if (System.Web.HttpContext.Current.Session["Visited"] == null)
            {
                System.Web.HttpContext.Current.Session["Visited"] = true;
                ac_WebCount.UpdateMaster(0);
            }
            VisitCount         = ac_WebCount.SearchMaster(0).SearchData.Cnt;
            ViewBag.VisitCount = VisitCount;
        }
示例#2
0
        protected override void Initialize(System.Web.Routing.RequestContext requestContext)
        {
            base.Initialize(requestContext);

            plamInfo.BroswerInfo = System.Web.HttpContext.Current.Request.Browser.Browser + "." + System.Web.HttpContext.Current.Request.Browser.Version;
            plamInfo.IP          = System.Web.HttpContext.Current.Request.UserHostAddress;
            plamInfo.UserId      = 0;
            plamInfo.UnitId      = 0;

            Log.SetupBasePath = System.Web.HttpContext.Current.Server.MapPath("~\\_Code\\Log\\");
            Log.Enabled       = true;

            try
            {
                a__WebVisitData ac_WebVisit = new a__WebVisitData()
                {
                    Connection = getSQLConnection()
                };
                m__WebVisitData md_WebVisit = new m__WebVisitData();
                md_WebVisit.id      = ac_WebVisit.GetIDX();
                md_WebVisit.ip      = System.Web.HttpContext.Current.Request.UserHostAddress;
                md_WebVisit.browser = System.Web.HttpContext.Current.Request.Browser.Browser + "." + System.Web.HttpContext.Current.Request.Browser.Version;
                md_WebVisit.setdate = DateTime.Now;
                if (System.Web.HttpContext.Current.Request.UrlReferrer != null)
                {
                    md_WebVisit.source = System.Web.HttpContext.Current.Request.UrlReferrer.AbsoluteUri;
                }

                md_WebVisit.page = System.Web.HttpContext.Current.Request.Url.AbsoluteUri;
                ac_WebVisit.InsertMaster(md_WebVisit, 0);

                a__WebCount ac_WebCount = new a__WebCount()
                {
                    Connection = getSQLConnection()
                };
                if (System.Web.HttpContext.Current.Session["Visited"] == null)
                {
                    System.Web.HttpContext.Current.Session["Visited"] = true;
                    ac_WebCount.UpdateMaster(0);
                }
                VisitCount          = ac_WebCount.SearchMaster(0).SearchData.Cnt;
                ViewBag.VisitCount  = VisitCount;
                ViewBag.IsFirstPage = false; //是否為首頁,請在首頁的Action此值設為True

                a_ProductMainKind ac_KindProduct = new a_ProductMainKind()
                {
                    Connection = getSQLConnection(), logPlamInfo = this.plamInfo
                };
                ViewBag.ProductMainKinds = ac_KindProduct.AllKind();

                ViewData["ProductL1"] = 0;
                ViewData["ProductL2"] = 0;

                //ShoppingHead s = null;

                //ViewData["ShippingAmt"] = 0;
                //ViewData["ShippingTotal"] = 0;

                //if (System.Web.HttpContext.Current.Session[SessionShippingString] != null)
                //{
                //    s = (ShippingHead)System.Web.HttpContext.Current.Session[SessionShippingString];

                //    if (s.Items != null)
                //    {
                //        ViewData["ShippingAmt"] = s.Items.Sum(x => x.amt);
                //        ViewData["ShippingTotal"] = s.Items.Sum(x => x.subcount);
                //    }
                //}
            }
            catch (Exception ex)
            {
                Log.Write(ex.Message);
            }
        }