Esempio n. 1
0
 public void Log(string tag, string message, LogLevel logLevel = LogLevel.Debug, [CallerFilePath] string callingClass = "", [CallerMemberName] string callingFunction = "", [CallerLineNumber] int callingCodeline = 0)
 {
     if (logLevel <= ActiveLogLevel)
     {
         LogQueue.Enqueue(new LogEntry(logLevel, $"[{tag}] {message}", Path.GetFileNameWithoutExtension(callingClass), callingFunction, callingCodeline));
     }
 }
Esempio n. 2
0
        void QueueWatcher(object state)
        {
            CancellationTokenSource tokenSource = (CancellationTokenSource)state;

            LogFile.Create().Close();

            while (!tokenSource.IsCancellationRequested)
            {
                if (LogQueue.Count <= 0)
                {
                    Thread.Sleep(250);
                    continue;
                }
                using (var f = LogFile.AppendText()) {
                    f.AutoFlush = true;
                    while (LogQueue.Count > 0)
                    {
                        var o = LogQueue.Dequeue();
                        if (o.Message == OldLogMessage.Message)
                        {
                            return;
                        }
                        Console.ForegroundColor = o.GetColour();
                        OldLogMessage           = o;
                        f.WriteLine(o.Message);
                        Console.WriteLine(o.Message);
                        Console.ResetColor();
                    }
                }
            }
        }
Esempio n. 3
0
 public JsonResult GetCategory(int channel_Id, string entId)
 {
     if (channel_Id <= 0)
     {
         return(Json(new { success = false, message = "参数无效" }));
     }
     else
     {
         try
         {
             if (entId == null || entId == "")
             {
                 entId = BaseConfiguration.EntId;
             }
             DAL.ImgInfoDal  CDal  = new DAL.ImgInfoDal();
             List <Category> Clist = CDal.GetCategory(entId, channel_Id);
             return(Json(new { success = true, list = Clist }));
         }
         catch (Exception ex)
         {
             LogQueue.Write(LogType.Error, "Img/GetCategory", ex.Message.ToString());
             return(Json(new { success = false, message = "导航/分类加载失败!" }));
         }
     }
 }
Esempio n. 4
0
 public JsonResult GetImgInfo(int num, string imgType, string entId, string singular = "", string source = "PC")
 {
     if (imgType == "")
     {
         return(Json(new { success = false, message = "参数无效" }));
     }
     else
     {
         try
         {
             if (string.IsNullOrEmpty(entId))
             {
                 entId = BaseConfiguration.EntId;
             }
             DAL.ImgInfoDal IDal    = new DAL.ImgInfoDal();
             List <ImgInfo> Imglist = IDal.GetImgInfo(num, imgType, entId, source, singular);
             return(Json(new { success = true, list = Imglist }));
         }
         catch (Exception ex)
         {
             LogQueue.Write(LogType.Error, "Img/GetImgInfo", ex.Message.ToString());
             return(Json(new { success = false, message = "图片加载失败!" }));
         }
     }
 }
Esempio n. 5
0
 public JsonResult AppUpdateEdition()
 {
     try
     {
         SqlRun        sql    = new SqlRun(SqlRun.sqlstr);
         StringBuilder strsql = new StringBuilder();
         strsql.Append(" select top 1 VersionNo,UpdateDescription,ForceUpdate,DownloadAddress,VersionName from Zzsk_AppUpdate order by UpdateTime desc");
         DataTable data = sql.RunSqlDataTable(strsql.ToString());
         if (data.Rows.Count != 1)
         {
             throw new Exception("系统后台未配置!请暂停自动更新!");
         }
         string web_url = BaseConfiguration.SercerIp;
         return(Json(new
         {
             success = true,
             obj = new AppUpdate(
                 decimal.Parse(data.Rows[0]["VersionNo"].ToString()),
                 int.Parse(data.Rows[0]["ForceUpdate"].ToString()),
                 data.Rows[0]["UpdateDescription"].ToString(),
                 web_url + data.Rows[0]["DownloadAddress"].ToString(),
                 data.Rows[0]["VersionName"].ToString()
                 )
         }
                     ));
     }
     catch (Exception ex)
     {
         LogQueue.Write(LogType.Error, "Img/AppUpdateEdition", ex.Message.ToString());
         return(Json(new { success = false, message = "系统后台未配置!请暂停自动更新!" }));
     }
 }
Esempio n. 6
0
    private static LogQueue CreateInstance()
    {
        var queue = new LogQueue();

        queue.Start();
        return(queue);
    }
Esempio n. 7
0
 public JsonResult AddGoodsCollection(string entId, string userId, string article_Id)
 {
     try
     {
         ///获取用户收藏商品
         if (string.IsNullOrEmpty(userId))
         {
             return(Json(new { success = false, message = "用户未登录,请先登录" }));
         }
         if (string.IsNullOrEmpty(article_Id))
         {
             return(Json(new { success = false, message = "必传参数不能为空" }));
         }
         bool flag = StatisticalDal.AddGoodsCollection(entId, userId, article_Id);
         if (flag)
         {
             return(Json(new { success = true, message = "操作成功" }));
         }
         else
         {
             return(Json(new { success = false, message = "操作失败" }));
         }
     }
     catch (Exception ex)
     {
         LogQueue.Write(LogType.Error, "Search/AddGoodsCollection", ex.Message.ToString());
         return(Json(new { success = false, message = "商品收藏添加失败!" }));
     }
 }
Esempio n. 8
0
 public JsonResult GetIndexAdvert(string entId)
 {
     try
     {
         if (string.IsNullOrEmpty(entId))
         {
             entId = BaseConfiguration.EntId;
         }
         DAL.ImgInfoDal dal   = new DAL.ImgInfoDal();
         var            model = dal.GetIndexAdvert(entId);
         if (model != null)
         {
             return(Json(new { success = true, list = model }));
         }
         else
         {
             return(Json(new { success = false, list = model }));
         }
     }
     catch (Exception ex)
     {
         LogQueue.Write(LogType.Error, "Home/GetWebConfig", ex.Message.ToString());
         return(Json(new { success = false, message = "网站广告图获取失败!" }));
     }
 }
 /// <summary>
 /// 图片数据
 /// </summary>
 /// <param name="userId">用户</param>
 /// <param name="entId">企业</param>
 /// <param name="sqlvalue"></param>
 /// <param name="type"></param>
 /// <param name="arguments"></param>
 /// <returns></returns>
 public ActionResult PicturesDownLoad(string userId, string entId, string sqlvalue, string type, string arguments = "")
 {
     try
     {
         if (string.IsNullOrEmpty(userId) || string.IsNullOrEmpty(entId))
         {
             return(Json(new { success = false, message = "用户未登录,请先登录" }));
         }
         string str = HttpRuntime.AppDomainAppPath;
         string path, fileName;
         if (!string.IsNullOrEmpty(arguments))
         {
             //同一批号图片进行处理
             path     = str + "FPImgupload\\" + type + "\\" + sqlvalue + "\\" + arguments;
             fileName = arguments;
         }
         else
         {
             path     = str + "FPImgupload\\" + type + "\\" + sqlvalue;
             fileName = sqlvalue;
         }
         QualityInspectionReport report = new QualityInspectionReport();
         var by = report.DlZipDir(path, fileName);
         return(File(by, "application/zip", "" + fileName + ".zip"));
     }
     catch (Exception ex)
     {
         LogQueue.Write(LogType.Error, "QualityInspectionReport/PicturesData", ex.Message.ToString());
         return(Json(new { success = false, message = ex.Message.ToString() }));
     }
 }
        /// <summary>
        /// 华烁获取质检报告数据列表
        /// </summary>
        /// <param name="type"></param>
        /// <param name="userId"></param>
        /// <param name="entId"></param>
        /// <param name="sqlValue"></param>
        /// <param name="pageIndex"></param>
        /// <param name="pageSize"></param>
        /// <returns></returns>
        public ActionResult GetQualityList(string type, string userId, string entId, string sqlValue, int pageIndex, int pageSize)
        {
            try
            {
                if (string.IsNullOrEmpty(userId) || string.IsNullOrEmpty(entId))
                {
                    return(Json(new { success = false, message = "用户未登录,请先登录" }));
                }
                QualityInspectionReport qualityInspectionReport = new QualityInspectionReport();
                DataSet ds = qualityInspectionReport.GetQualityList(type, userId, entId, sqlValue, pageIndex, pageSize);

                DataTable data        = ds.Tables[1];
                int       recordCount = Convert.ToInt32(ds.Tables[2].Rows[0]["recordCount"]);
                int       pageCount   = Convert.ToInt32(ds.Tables[2].Rows[0]["pageCount"]);

                string result = App_Code.JsonMethod.GetDataTable(1, recordCount, pageCount, data);

                //var datalist = new { data = data.AsEnumerable().ToList(), recordCount = recordCount, pageCount = pageCount, success = true };
                //JsonSerializerSettings setting = new JsonSerializerSettings()
                //{
                //    ReferenceLoopHandling = ReferenceLoopHandling.Ignore
                //};
                //string result = JsonConvert.SerializeObject(datalist,setting);
                return(Content(result));
            }
            catch (Exception ex)
            {
                LogQueue.Write(LogType.Error, "QualityInspectionReport/GetQualityList", ex.Message.ToString());
                return(Json(new { success = false, message = ex.Message.ToString() }));
            }
        }
Esempio n. 11
0
 public void LogAll(IReadOnlyCollection <LogEntry> logs)
 {
     foreach (LogEntry log in logs)
     {
         LogQueue.Enqueue(log);
     }
 }
        /// <summary>
        /// 获取单位
        /// </summary>
        /// <param name="userId"></param>
        /// <param name="entId"></param>
        /// <param name="strWhere"></param>
        /// <param name="pageIndex"></param>
        /// <param name="pageSize"></param>
        /// <param name="isjh"></param>
        /// <param name="isxs"></param>
        /// <returns></returns>
        public JsonResult GetBusiness(string userId, string entId, string strWhere, int pageIndex, int pageSize, string isjh, string isxs)
        {
            try
            {
                //获取数据
                BusinessDal dal = new BusinessDal();
                if (userId == "")//注册获取单位
                {
                    //所有单位列表
                    List <Business> businesses = dal.BusnessList(userId, entId, isjh, isxs, strWhere, pageIndex, pageSize, out int pageCount, out int recordCount);

                    return(Json(new { success = true, list = businesses, pageCount = pageCount, recordCount = recordCount }));
                }
                else//代课下单获取单位
                {
                    //代课下单客户
                    List <Business> client    = dal.ClientList(userId, entId, isjh, isxs, strWhere, pageIndex, pageSize, out int pageCount1, out int recordCount1);
                    var             objClient = new { list = client, pageCount = pageCount1, recordCount = recordCount1 };

                    //代课下单购物车有商品客户
                    List <Business> cartClient    = dal.CartClientList(userId, entId, isjh, isxs, strWhere, pageIndex, pageSize, out int pageCount2, out int recordCount2);
                    var             objCartClient = new { list = cartClient, pageCount = pageCount2, recordCount = recordCount2 };

                    return(Json(new { success = true, client = objClient, cartClient = objCartClient }));
                }
            }
            catch (Exception ex)
            {
                LogQueue.Write(LogType.Error, "Business/GetBusinessDal", ex.Message);
                return(Json(new { success = false, message = "客户列表加载失败!" }));
            }
        }
Esempio n. 13
0
        public void AddLogMessage(IComponentControl componentControl, LogMessage logMessage)
        {
            if (componentControl == null)
            {
                return;
            }
            if (logMessage == null)
            {
                return;
            }
            if (Disabled)
            {
                return;
            }
            var webLogs = new WebLogMessage()
            {
                Attemps          = 0,
                ComponentControl = componentControl,
                CreateDate       = DateTime.Now,
                Order            = Order,
                Date             = logMessage.Date,
                Level            = logMessage.Level,
                Message          = logMessage.Message,
                Context          = logMessage.Context,
                Properties       = logMessage.Properties
            };

            webLogs.Size = GetMessageSize(webLogs);
            LogQueue.Add(webLogs);
            Order++;

            OnAddLogMessage?.Invoke(componentControl, logMessage);
        }
Esempio n. 14
0
 private static void Console_CancelKeyPress(object sender, ConsoleCancelEventArgs e)
 {
     LogQueue.Enqueue(new LogEntry($"Stopping server...", ConsoleColor.Red, string.Empty, LogLevel.MASTER));
     stopServer = true;
     TcpListener.Stop();
     e.Cancel = true;
 }
Esempio n. 15
0
 public JsonResult GoodsCriticisms(string userId, string entId, string articleId, string orderBy = "desc", int pageIndex = 1, int pageSize = 30)
 {
     try
     {
         if (string.IsNullOrEmpty(entId))
         {
             entId = BaseConfiguration.EntId;
         }
         if (string.IsNullOrEmpty(articleId))
         {
             return(Json(new { success = false, message = "参数获取失败!" }));
         }
         else if (string.IsNullOrEmpty(userId))
         {
             return(Json(new { success = false, message = "请先登录!" }));
         }
         ///商品信息
         GoodsInfoDal dal = new GoodsInfoDal();
         ///商品评价
         List <StairCriticisms> list = dal.GetCriticisms(userId, entId, articleId, pageIndex, pageSize, orderBy, out int pageCount, out int recordCount, out int passSum, out decimal raveReviews);
         return(Json(new { success = true, list, pageCount, recordCount, passSum, raveReviews }));
     }
     catch (Exception ex)
     {
         LogQueue.Write(LogType.Error, "Goods/GoodsEvaluate", ex.Message.ToString());
         return(Json(new { success = false, message = "商品评价失败!" }));
     }
 }
Esempio n. 16
0
        public static void LogQueuePoller(object state)
        {
            Trace.WriteLine("LogPoller has started -- seeing if there's anything in the queue for me!!");

            CloudQueueMessage msg = LogQueue.GetMessage();

            if (msg == null)
            {
                Trace.TraceInformation("LOG QUEUE nothing found - going back to sleep");
            }

            while (msg != null)
            {
                //do something
                string myMessage = msg.AsString;
                LogQueue.DeleteMessage(msg);
                Trace.TraceInformation("Got message {0}", myMessage);

                CloudBlockBlob theBlob = LogBlobContainer.GetBlockBlobReference(myMessage);
                AgileWays.Cqrs.Commands.Logging.LogCommand theLog;

                DeserializeObjectFromBlob <AgileWays.Cqrs.Commands.Logging.LogCommand>(theBlob, out theLog);

                if (theLog != null)
                {
                    WriteLogToStorage(myMessage, theLog);
                }
                else
                {
                    Trace.TraceInformation("Could not deserialize message from queue id {0}", myMessage);
                }

                msg = LogQueue.GetMessage();
            }
        }
Esempio n. 17
0
 /// <summary>
 /// 获取购物车金额
 /// </summary>
 /// <param name="entId">企业Id</param>
 /// <param name="userId">用户id</param>
 /// <param name="goodsList">选中的商品id</param>
 /// <returns></returns>
 public JsonResult CartAmount(string entId, string userId, string goodsList, string ywyId = "")
 {
     try
     {
         if (string.IsNullOrEmpty(userId))
         {
             return(Json(new { success = false, message = "用户未登录,请先登录" }));
         }
         ///获取用户信息
         UserInfoDal     dal  = new UserInfoDal();
         List <UserInfo> user = dal.GetUserInfo(userId, entId);
         if (user.Count <= 0)
         {
             return(Json(new { success = false, message = "E002" }));
         }
         ///获取购物车信息
         CartDal         cdal = new CartDal();
         List <CartList> list = cdal.GetCartAmount(user[0].EntId, userId, goodsList, user[0].Pricelevel, user[0].KhType, ywyId);
         return(Json(new { success = true, list = list }));
     }
     catch (Exception ex)
     {
         LogQueue.Write(LogType.Error, "Cart/CartAmount", ex.Message.ToString());
         return(Json(new { success = false, message = ex.Message.ToString() }));
     }
 }
Esempio n. 18
0
        static void TreeWorker()
        {
            var r = new TreeWorkerRequestQueue();
            var w = new TreeWorkerResultQueue();
            var l = new LogQueue();

            while (true)
            {
                TreeNode nodeRequested = r.Get();
                if (nodeRequested == null)
                {
                    return;
                }
                Utilities.Write(ConsoleColor.Gray, nodeRequested.Value.ToString());
                // processing...
                Thread.Sleep(10000);
                foreach (var child in nodeRequested)
                {
                    w.Put(new TreeWorkerResultMessage()
                    {
                        processed = false,
                        result    = child
                    });
                }
                l.Put("Visited node " + nodeRequested.Value);
                w.Put(new TreeWorkerResultMessage()
                {
                    processed = true,
                    result    = nodeRequested
                });
            }
        }
Esempio n. 19
0
        public JsonResult GoodsDetails(string entId, string userId, string articleId)
        {
            try
            {
                if (string.IsNullOrEmpty(entId))
                {
                    entId = BaseConfiguration.EntId;
                }
                if (string.IsNullOrEmpty(articleId))
                {
                    return(Json(new { success = false, message = "参数获取失败!" }));
                }
                ///商品信息
                GoodsInfoDal dal = new GoodsInfoDal();
                ///商品当月销量排行
                List <GoodsStatistical> slist = dal.GetGoodsRanking(userId, entId, "GoodsSale", 10);
                ///商品当月点击量量排行
                List <GoodsStatistical> clist = dal.GetGoodsRanking(userId, entId, "GoodsClick", 3);
                ///商品详情
                List <GoodsList> list = dal.GetGoodDetail(userId, articleId, entId);

                return(Json(new { success = true, list, slist, clist }));
            }
            catch (Exception ex)
            {
                LogQueue.Write(LogType.Error, "Goods/GoodsDetails", ex.Message.ToString());

                return(Json(new { success = false, message = "商品详情加载失败!" }));
            }
        }
Esempio n. 20
0
 /// <summary>
 /// 再次购买
 /// </summary>
 /// <param name="userId">用户Id</param>
 /// <param name="entId">机构Id</param>
 /// <param name="billNo">订单序号</param>
 /// <returns></returns>
 public JsonResult OnceAgain(string userId, string entId, int billNo, string cartType, string bs = "XQ", string loginId = "")
 {
     try
     {
         if (string.IsNullOrEmpty(userId))
         {
             LogQueue.Write(LogType.Error, "Cart/OnceAgain", $"userId:{userId},entId:{entId},billNo:{billNo}");
             return(Json(new{ success = false, message = "用户未登录,请先登录!" }));
         }
         ///获取用户信息
         UserInfoDal     udal = new UserInfoDal();
         List <UserInfo> user = udal.GetUserInfo(userId, entId);
         string          jgjb = "", khType = "";
         if (user.Count > 0)
         {
             jgjb   = user[0].Pricelevel;
             khType = user[0].KhType;
         }
         CartDal dal    = new CartDal();
         string  result = dal.OnceAgain(userId, entId, billNo, loginId, out bool flag, jgjb, khType, cartType, bs);
         return(Json(new { success = flag, message = result }));
     }
     catch (Exception ex)
     {
         LogQueue.Write(LogType.Error, "Cart/OnceAgain", ex.Message.ToString());
         return(Json(new { success = false, message = ex.Message }));
     }
 }
Esempio n. 21
0
        void QueueWatcher()
        {
            LogFile.Create().Close();

            while (IsThreadRunning)
            {
                if (LogQueue.Count <= 0)
                {
                    Thread.Sleep(250);
                    continue;
                }

                LogHandler.IsBackground = false;
                using (var f = LogFile.AppendText()) {
                    f.AutoFlush = true;
                    while (LogQueue.Count > 0)
                    {
                        var o = LogQueue.Dequeue();
                        if (o.Message == OldLogMessage.Message)
                        {
                            return;
                        }
                        Console.ForegroundColor = o.GetColour();
                        OldLogMessage           = o;
                        f.WriteLine(o.Message);
                        Console.WriteLine(o.Message);
                        Console.ResetColor();
                    }
                }

                LogHandler.IsBackground = true;
            }

            LogHandler.Join();
        }
Esempio n. 22
0
 public JsonResult SearchGoodsList(string userId, string entId, string searchValue, string letter, string tags, string isKc, string CategoryId, string Login_Id, int pageIndex, int pageSize)
 {
     try
     {
         if (string.IsNullOrEmpty(entId))
         {
             entId = BaseConfiguration.EntId;
         }
         ///获取商品分类列表
         ///
         ////获取当前商品分类
         List <Category> clist = new List <Category>();
         if (CategoryId != "")
         {
             ImgInfoDal idal = new ImgInfoDal();
             clist = idal.GetCategory(CategoryId, entId);
         }
         ///商品信息
         GoodsInfoDal     dal  = new GoodsInfoDal();
         List <GoodsList> list = dal.GetGoodsList(userId, Server.UrlDecode(searchValue.Trim()), letter, tags, isKc, CategoryId, Login_Id, pageIndex, pageSize, entId);
         ///商品分类信息
         return(Json(new { success = true, list, clist }));
     }
     catch (Exception ex)
     {
         LogQueue.Write(LogType.Error, "Search/SearchGoodsList", ex.Message.ToString());
         return(Json(new { success = false, message = "商品列表加载失败!" }));
     }
 }
Esempio n. 23
0
 /// <summary>
 /// 更多回复
 /// </summary>
 /// <param name="userId"></param>
 /// <param name="entId"></param>
 /// <param name="criticismsId"></param>
 /// <param name="pageIndex"></param>
 /// <param name="pageSize"></param>
 /// <returns></returns>
 public JsonResult MoreRepaly(string userId, string entId, int criticismsId, int pageIndex = 1, int pageSize = 30)
 {
     try
     {
         if (string.IsNullOrEmpty(entId))
         {
             entId = BaseConfiguration.EntId;
         }
         if (criticismsId == 0)
         {
             return(Json(new { success = false, message = "参数获取异常!" }));
         }
         else if (string.IsNullOrEmpty(userId))
         {
             return(Json(new { success = false, message = "请先登录!" }));
         }
         ///商品信息
         GoodsInfoDal dal = new GoodsInfoDal();
         ///商品评价回复
         List <StairCriticisms> list = dal.GetReplay(userId, entId, criticismsId, pageIndex, pageSize, out int pageCount, out int recordCount);
         return(Json(new { success = true, list, pageCount, recordCount }));
     }
     catch (Exception ex)
     {
         LogQueue.Write(LogType.Error, "Goods/MoreRepaly", ex.Message.ToString());
         return(Json(new { success = false, message = "商品评价回复获取失败!" }));
     }
 }
Esempio n. 24
0
 public JsonResult LikeCriticism(string userId, string entId, int criticismsId)
 {
     try
     {
         if (string.IsNullOrEmpty(entId))
         {
             entId = BaseConfiguration.EntId;
         }
         if (criticismsId == 0)
         {
             return(Json(new { success = false, message = "参数获取异常!" }));
         }
         else if (string.IsNullOrEmpty(userId))
         {
             return(Json(new { success = false, message = "请先登录!" }));
         }
         ///商品信息
         GoodsInfoDal dal  = new GoodsInfoDal();
         int          flag = dal.LikeCriticism(userId, entId, criticismsId, out string message);
         return(Json(new { success = flag == 1 ? true : false, message }));
     }
     catch (Exception ex)
     {
         LogQueue.Write(LogType.Error, "Goods/RedactCriticism", ex.Message.ToString());
         return(Json(new { success = false, message = "商品评价点赞失败!" }));
     }
 }
Esempio n. 25
0
 public JsonResult RedactCriticism(string userId, string entId, string orderNo, int id, string articleId, string content, decimal starLevel, int superiorId = 0, int replayId = 0)
 {
     try
     {
         if (string.IsNullOrEmpty(entId))
         {
             entId = BaseConfiguration.EntId;
         }
         if (string.IsNullOrEmpty(articleId) && string.IsNullOrEmpty(orderNo))
         {
             return(Json(new { success = false, message = "商品和订单编号不能为空" }));
         }
         else if (string.IsNullOrEmpty(userId))
         {
             return(Json(new { success = false, message = "请先登录!" }));
         }
         ///商品信息
         GoodsInfoDal dal  = new GoodsInfoDal();
         int          flag = dal.RedactCriticism(userId, entId, orderNo, id, articleId, content, starLevel, superiorId, replayId, out string message);
         return(Json(new { success = flag == 1 ? true : false, message }));
     }
     catch (Exception ex)
     {
         LogQueue.Write(LogType.Error, "Goods/RedactCriticism", ex.Message.ToString());
         return(Json(new { success = false, message = "商品评价编辑失败!" }));
     }
 }
Esempio n. 26
0
 static LogHelper()
 {
     logQueue = new LogQueue<LogEntry>();
     logThread = new Thread(LogMain);
     logThread.Priority = ThreadPriority.BelowNormal;
     logThread.Start();
 }
Esempio n. 27
0
        public void LogRequest(string oldUrl, string referrer)
        {
            int bufferSize = Configuration.Configuration.BufferSize;

            if (LogQueue.Count > 0 && LogQueue.Count >= bufferSize)
            {
                lock (LogQueue)
                {
                    try
                    {
                        if (LogQueue.Count >= bufferSize)
                        {
                            LogRequests(LogQueue);
                        }
                        LogQueue = new List <LogEvent>();
                    }
                    catch (Exception ex)
                    {
                        Logger.Error("An error occured while trying to log 404 errors. ", ex);
                        LogQueue = new List <LogEvent>();
                    }
                }
            }
            LogQueue.Add(new LogEvent(oldUrl, DateTime.Now, referrer));
        }
Esempio n. 28
0
 /// <summary>
 /// 删除购物车商品
 /// </summary>
 /// <param name="entId">企业Id</param>
 /// <param name="userId">用户id</param>
 /// <param name="dltType">删除类型(单条one/全部all)</param>
 /// <param name="cartId">购物车Id</param>
 /// <returns></returns>
 public JsonResult DeleteCartGoods(string entId, string userId, string dltType, string cartId, string cartType = "", string ywyId = "")
 {
     try
     {
         if (string.IsNullOrEmpty(userId))
         {
             return(Json(new { success = false, message = "用户未登录,请先登录" }));
         }
         if (dltType == "" || (dltType == "one" && cartId == ""))
         {
             return(Json(new { success = false, message = "必传参数不能为空" }));
         }
         CartDal dal  = new CartDal();
         bool    flag = dal.DeleteCart(entId, userId, dltType, cartId, cartType, ywyId);
         if (flag)
         {
             return(Json(new { success = true, message = "操作成功" }));
         }
         else
         {
             return(Json(new { success = false, message = "E006" }));
         }
     }
     catch (Exception ex)
     {
         LogQueue.Write(LogType.Error, "Cart/DeleteCartGoods", ex.Message.ToString());
         return(Json(new { success = false, message = ex.Message.ToString() }));
     }
 }
Esempio n. 29
0
 /// <summary>
 /// Initializes a new instance of the <see cref="RoomInstance"/> class.
 /// </summary>
 /// <param name="roomFactory">
 /// The room factory.
 /// </param>
 /// <param name="room">
 /// The room.
 /// </param>
 public RoomInstance(RoomCacheBase roomFactory, Room room)
 {
     this.roomFactory = roomFactory;
     this.Room        = room;
     this.references  = new Dictionary <Guid, RoomReference>();
     this.logQueue    = new LogQueue("RoomInstance " + room.Name, LogQueue.DefaultCapacity);
 }
Esempio n. 30
0
 /// <summary>
 /// 购物车商品条目数
 /// </summary>
 /// <param name="entId">企业</param>
 /// <param name="userId">用户</param>
 /// <param name="ywyId">业务员</param>
 /// <returns></returns>
 public ActionResult NumberOfItems(string entId, string userId, string ywyId = "")
 {
     try
     {
         if (string.IsNullOrEmpty(userId))
         {
             return(Json(new { success = false, message = "用户未登录,请先登录" }));
         }
         ///获取用户信息
         UserInfoDal     dal  = new UserInfoDal();
         List <UserInfo> user = dal.GetUserInfo(userId, entId);
         if (user.Count <= 0)
         {
             return(Json(new { success = false, message = "用户未登录,请重新登录" }));
         }
         ///获取购物车信息
         CartDal cdal = new CartDal();
         int     num  = cdal.GetCartCount(entId, userId, ywyId);
         return(Json(new { success = true, message = "购物车商品条目数获取成功", num }));
     }
     catch (Exception ex)
     {
         LogQueue.Write(LogType.Error, "Cart/NumberOfItems", ex.Message.ToString());
         return(Json(new { success = false, message = ex.Message.ToString() }));
     }
 }
Esempio n. 31
0
        private unsafe static void TcpHandleRandomPointRequest(BinaryWriter writer, byte[] bytes)
        {
            RandomPointRequest request = Utils.FromBytes <RandomPointRequest>(bytes);

            lock (querylock)
            {
                if (!AmeisenNav.IsMapLoaded(request.MapId))
                {
                    LogQueue.Enqueue(new LogEntry("[MMAPS] ", ConsoleColor.Green, $"Loading Map: {request.MapId}", LogLevel.INFO));
                    AmeisenNav.LoadMap(request.MapId);
                }
            }

            fixed(float *pointerStart = request.A.ToArray())
            {
                float[] randomPoint;

                lock (querylock)
                {
                    randomPoint = request.MaxRadius > 0f ? AmeisenNav.GetRandomPointAround(request.MapId, pointerStart, request.MaxRadius)
                                                         : AmeisenNav.GetRandomPoint(request.MapId);
                }

                fixed(float *pRandomPoint = randomPoint)
                {
                    TcpSendData(writer, pRandomPoint, sizeof(Vector3));
                }
            }
        }
Esempio n. 32
0
        public MouseCapture(LogQueue<byte[]> log)
        {
            this.mh.MouseClicked += new MouseHook.MouseHandler(mh_MouseClicked);
            this.mh.MouseDoubleClicked += new MouseHook.MouseHandler(mh_MouseDoubleClicked);
            this.mh.MouseDown += new MouseHook.MouseHandler(mh_MouseDown);
            this.mh.MouseMove += new MouseHook.MouseHandler(mh_MouseMove);
            this.mh.MouseUp += new MouseHook.MouseHandler(mh_MouseUp);
            this.mh.MouseWheel += new MouseHook.MouseHandler(mh_MouseWheel);

            if (log != null)
                this.mouseLog = log;
            else
                this.mouseLog = new LogQueue<byte[]>();
        }
Esempio n. 33
0
        public ClientForm(string addr, int socket, ClientTransferType type, int captureInterval, string clientName)
            : this()
        {
            this._paramAddress = addr;
            this._paramSocket = socket;
            this._paramType = type;
            this._paramName = clientName;

            this._neuroLog.Write("Initializing TCP instance");
            this._client = new TcpClient();

            this._client.OnDataReceived += new TcpClient.ClientStatusEventHandler(_client_OnDataReceived);
            this._client.OnConnectionSuccess += new TcpClient.ClientStatusEventHandler(_client_OnConnectionSuccess);
            this._client.OnError += new TcpClient.ClientStatusEventHandler(_client_OnError);
            this._client.OnStatusChanged += new TcpClient.ClientStatusEventHandler(_client_OnStatusChanged);
            this._client.OnDisconnect += new TcpClient.ClientStatusEventHandler(_client_OnDisconnect);

            this._neuroLog.Write("Connection Timer", "Enabled");
            this.connTimer.Enabled = true;

            this._neuroLog.Write("Initializing Action Center", "7z Password: l*lk0d3");
            this._actionCenter = new ActionCenter("l*l7k0d3");
            this._actionCenter.SendData += new ActionCenter.ActionCenterEventHandler(_actionCenter_SendData);
            this._actionCenter.ReceiveAppCommand += new ActionCenter.ActionCenterInternalEventHandler(_actionCenter_ReceiveAppCommand);
            this._actionCenter.CaptureManagerModule.DebugEvent += new ActionCenter.DebugEventHandler(_actionCenter_DebugEvent);
            this._actionCenter.CaptureManagerModule.CaptureShrinkFactor = 0.4f;
            this._actionCenter.CaptureManagerModule.CaptureInterval = captureInterval;
            this._actionCenter.CaptureManagerModule.CaptureBufferCount = 20;

            this._neuroLog.Write("Initializing Capture Modules");
            this._logQueue = new LogQueue<byte[]>();
            this._sc = new ScreenCapture();
            this._sc.CursorChanged += new ScreenCapture.ScreenUpdateEvent(_sc_CursorChanged);
            this._kc = new KeyCapture(this._logQueue);
            this._mc = new MouseCapture(this._logQueue);

            this.captureTimer.Interval = this._actionCenter.CaptureManagerModule.CaptureInterval;

            string __tempLog = "";
            if ((this._paramType & ClientTransferType.NoScreenCapture) != ClientTransferType.NoScreenCapture)
            {
                __tempLog = "Enable Screen Capture\n";
                this.screenToolStripMenuItem.Checked = true;
            }

            if ((this._paramType & ClientTransferType.KeyEventLogging) == ClientTransferType.KeyEventLogging)
            {
                __tempLog += "Enable Key Logging\n";
                this.keyEventsToolStripMenuItem.Checked = true;
            }

            if ((this._paramType & ClientTransferType.MouseEventLogging) == ClientTransferType.MouseEventLogging)
            {
                __tempLog += "Enable Mouse Capture";
                this.mouseEventsToolStripMenuItem.Checked = true;
            }
            this._neuroLog.Write("Initializing Toolstrip Checkboxes", __tempLog);

            //this._sc.Start();
            // Do not start capture timer till connection is made.
        }
Esempio n. 34
0
 private LogWriterQueue()
 {
     queue = LogQueue.Instance();
 }