示例#1
0
        /// <summary>
        /// برای ثبت بازدید وبسایت
        /// </summary>

        protected void Session_Start()
        {
            NetworkOperation objNetworkOperation = new NetworkOperation();
            VisitWebsiteLog  objVisitWebsiteLog  = new VisitWebsiteLog();
            string           CurrentClientIP     = objNetworkOperation.ClientIPaddress();

            try
            {
                objVisitWebsiteLog.StartOperation(CurrentClientIP);
            }
            catch (Exception)
            {
            }
            //}
        }
示例#2
0
 public AsyncNetworkOperation(AsyncCallback callback, object state, NetworkOperation operationType)
 {
     _callback = callback;
     _state = state;
     _operationType = operationType;
 }
示例#3
0
文件: Main.cs 项目: jparicka/agent_nt
 //Get actual network values
 private string GetNetwork(NetworkOperation network_operation)
 {
     double bits=0;  //Initialise temp variable
     if (network_instances.Length > 0)   //If at last one network instance
     {
         for (int instance = 0; instance < network_instances.Length; instance++) //For all instances
         {
             if (network_operation == NetworkOperation.Download) //For NetworkOperation.Download enum
             {
                 bits += GetCounterValue(network_download[instance], "Network Interface", "Bytes Received/sec", network_instances[instance]);    //Get bites
             }
             else if(network_operation==NetworkOperation.Upload) //For NetworkOperation.Upload enum
             {
                 bits += GetCounterValue(network_upload[instance], "Network Interface", "Bytes Sent/sec", network_instances[instance]);  //Get bites
             }
         }
     }
     return bits.ToString(); //Return bites
 }
    public void AddNetworkOperation(NetworkOperation networkOperation)
    {
        NetworkOperations.Enqueue(networkOperation);

        Work();
    }
示例#5
0
        public async Task <ActionResult> AddComment(vmComment input)
        {
            if (!ModelState.IsValid)
            {
                foreach (var item in ModelState)
                {
                    var errors = item.Value.Errors.ToList();
                }
                return(Json("null"));
            }

            if (input.CaptchaText.ToLower() == HttpContext.Session["captchastring"].ToString().ToLower())
            {
                Session.Remove("captchastring");
                NetworkOperation objNetworkOperation = new NetworkOperation();
                VisitWebsiteLog  visitWebsiteLog     = new VisitWebsiteLog();
                string           CurrentClientIP     = null;
                CurrentClientIP = objNetworkOperation.ClientIPaddress();
                IpInformation IpInfo            = visitWebsiteLog.GetLocationIPINFO(CurrentClientIP);
                var           _objEntityMessage = new RepositoryPattern <PostComment>(new ApplicationDbContext());
                var           NewItem           = new PostComment
                {
                    PostID      = input.PostID,
                    FullName    = input.FullName,
                    Comment     = input.Comment,
                    Email       = input.Email,
                    SendDate    = DateConvertor.DateToNumber(DateConvertor.TodayDate()),
                    SendTime    = DateConvertor.TimeNow(),
                    Browser     = objNetworkOperation.ClientBrowser(),
                    DeviceInfo  = objNetworkOperation.ClientDeviceType(),
                    IP_Address  = CurrentClientIP,
                    HostName    = objNetworkOperation.ClientHostName(),
                    country     = IpInfo.country,
                    city        = IpInfo.city,
                    countryCode = IpInfo.countryCode,
                    org         = IpInfo.org,
                    region      = IpInfo.region,
                    regionName  = IpInfo.regionName,
                    status      = IpInfo.status,
                    timezone    = IpInfo.timezone,
                    mobile      = IpInfo.mobile == true ? true :false,
                    Is_Active   = "1"
                };
                _objEntityMessage.Insert(NewItem);
                _objEntityMessage.Save();
                _objEntityMessage.Dispose();
                try
                {
                    var _objEntityPost = new RepositoryPattern <Post>(new ApplicationDbContext());
                    OpratingClasses.EmailService emailService = new OpratingClasses.EmailService();
                    var strSubject = " نام و نام خانوادگی : " + NewItem.FullName;
                    var strMessage =
                        " ديدگاه كاربر راجع به پست : " + _objEntityPost.GetByPredicate(X => X.ID == NewItem.PostID).Title.Trim() +
                        " <br /> " + NewItem.Comment +
                        " <br /> " + " ایمیل : " + NewItem.Email +
                        " <br /> " + " ساير اطلاعات : " + NewItem.DeviceInfo + " - " + NewItem.country + NewItem.city +
                        " <br /> " + " تاریخ و ساعت ارسال : " + NewItem.SendDate + " - " + NewItem.SendTime;

                    //" <br /> <p styel=\"font-family:\"Tahoma;\"\">" + NewItem.Comment +

                    await emailService.SendMail(strSubject, strMessage);
                }
                catch (Exception)
                {
                }
                return(PartialView("_PartialPageComment", NewItem));
            }
            else
            {
                return(Json("CaptchaTextMistake"));
                //ViewBag.Message = "CAPTCHA verification failed!";
            }
        }