Example #1
0
 public DefaultMaster()
 {
     this._categoryRT        = new CategoryRT();
     this._userInformationRT = new UserInformationRT();
     this._visitorCounterRT  = new VisitorCounterRT();
     this._visitorCounter    = new VisitorCounter();
 }
Example #2
0
 /// <summary>
 /// Delete
 /// </summary>
 /// <param name="visitorCounter"></param>
 public void Delete(VisitorCounter visitorCounter)
 {
     if (visitorCounter == null)
     {
         throw new ArgumentNullException(nameof(visitorCounter));
     }
     _vistorCounteRepository.Delete(visitorCounter);
     _eventPublisher.EntityDeleted(visitorCounter);
 }
Example #3
0
 public void UpdateVisitorCounter(VisitorCounter visitorCounter)
 {
     try
     {
         VisitorCounter objVisitor = _OiiOMartDBDataContext.VisitorCounters.SingleOrDefault(d => d.IID == visitorCounter.IID);
         DatabaseHelper.Update <VisitorCounter>(_OiiOMartDBDataContext, visitorCounter, objVisitor);
     }
     catch (Exception ex) { throw new Exception(ex.Message, ex); }
 }
Example #4
0
 public void AddVisitorCounter(VisitorCounter visitorCounter)
 {
     try
     {
         DatabaseHelper.Insert <VisitorCounter>(visitorCounter);
     }
     catch (Exception ex)
     {
         throw new Exception(ex.Message, ex);
     }
 }
Example #5
0
 public void DeleteVisitorCounterByIID(long Id)
 {
     try
     {
         VisitorCounter objVisitor = _OiiOMartDBDataContext.VisitorCounters.SingleOrDefault(x => x.IID == Id);
         DatabaseHelper.Delete(_OiiOMartDBDataContext, objVisitor);
     }
     catch (Exception ex)
     {
         throw new Exception(ex.Message, ex);
     }
 }
        public object AfterReceiveRequest(ref Message request, IClientChannel channel, InstanceContext instanceContext)
        {
            // www-form
            try
            {
                ContentTransform(ref request);
            }
            catch (Exception ex)
            {
                LogHelper.Info(ex.Message + ex.StackTrace);
            }
            if (DEBUG)
            {
                QZ.RealTimeRequestLogService.RequestLog log = LogInccomingRequest(request);
                return(log);
            }

            var res = Util.Get_RemoteIp().ToMaybe().Do(ip => counter.AddRec(ip))
                      .Select <VisitorCounter.IpInfo, string>(
                ip => counter.GetIpInfo(ip, false).ToMaybe(),
                (ip, info) =>
            {
                if (counter.IsMechineIpInfo(info))
                {
                    counter.AddRecCount(ip, 0x1000);
                }
                if (!counter.IsIpAuthorized(ip))
                {
                    if (VisitorCounter.GetReqPath().ToLower() == "orgcompany/branch/select/page")
                    {
                        throw new WebFaultException <string>(string.Format("{0} Unauthorized!", ip), System.Net.HttpStatusCode.Unauthorized);
                    }
                }
                return(string.Empty);
            }
                );



            return(null);
        }
Example #7
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (AccessControl.IsLoggedIn(this.Page))
        {
            user = "******" + AccessControl.GetLoggedUser(this.Page);
            // all the buttons are invisible at first
            logoutButton.Visible  = true;
            updateButton.Visible  = true;
            galleryButton.Visible = true;
        }
        else
        {
            loginButton.Visible        = true;
            registrationButton.Visible = true;
        }

        if (AccessControl.IsAdmin(this.Page))
        {
            adminButton.Visible = true;
        }

        VisitorCounter.LogPageLoad(this.Page);
    }
Example #8
0
        protected override void OnActionExecuting(ActionExecutingContext filterContext)
        {
            using (var db = new ApplicationDbContext()) {
                string controller = filterContext.ActionDescriptor.ControllerDescriptor.ControllerName.ToUpper();
                ViewBag.CurrentController = controller;

                var vendors = db.Vendors
                              //.Where(x => x.IsPublish.HasValue && x.IsPublish.Value)
                              .OrderBy(x => x.OrderNo)
                              .ToList();
                ViewBag.Vendors = vendors;

                var cofig = db.ConfigSettings.FirstOrDefault();
                if (cofig == null)
                {
                    cofig = new ConfigSetting();
                }
                ViewBag.ConfigSetting = cofig;

                var productCategories = db.ProductCategories.ToList();
                ViewBag.ProductCategories = productCategories;

                var visitorCounter = db.VisitorCounters.FirstOrDefault();
                if (visitorCounter == null)
                {
                    visitorCounter = new VisitorCounter();
                }
                ViewBag.VisitorCounter = visitorCounter;

                var plugins = db.Plugins
                              .Where(x => x.Show)
                              .OrderBy(x => x.OrderNo)
                              .ToList();
                ViewBag.Plugins = plugins;
            }
        }
Example #9
0
 // This will load after MasterPage.On_Load()
 protected override void OnLoadComplete(EventArgs e)
 {
     visitors = VisitorCounter.GetCount(this);
     base.OnLoadComplete(e);
 }
 public VisitorCounterController(VisitorCounter visitorCounter)
 {
     _visitorCounter = visitorCounter;
 }
 static VisitorStatisticHandler()
 {
     counter = new VisitorCounter(null);
     DEBUG   = System.Configuration.ConfigurationManager.AppSettings["Debug"].ToLower() == "true";
 }
 public override string ToString()
 {
     return(Year.ToString() + "\t" + HomeWinCounter.ToString() + "\t" + VisitorCounter.ToString() + "\t" + ((int)(HomeWinPercentage * 100)).ToString());
 }