Beispiel #1
0
 public void AddSiteLog(int publishmentSystemId, int channelId, int contentId, string action, string summary)
 {
     if (publishmentSystemId <= 0)
     {
         LogUtils.AddAdminLog(AdministratorName, action, summary);
     }
     else
     {
         try
         {
             if (!string.IsNullOrEmpty(action))
             {
                 action = StringUtils.MaxLengthText(action, 250);
             }
             if (!string.IsNullOrEmpty(summary))
             {
                 summary = StringUtils.MaxLengthText(summary, 250);
             }
             if (channelId < 0)
             {
                 channelId = -channelId;
             }
             var logInfo = new Model.LogInfo(0, publishmentSystemId, channelId, contentId, AdministratorName, PageUtils.GetIpAddress(), DateTime.Now, action, summary);
             DataProvider.LogDao.Insert(logInfo);
         }
         catch
         {
             // ignored
         }
     }
 }
        public void FillInfo(Model.LogInfo model)
        {
            EventControl logEvent = new EventControl();

            logEvent.Width     = FLP_Events.Width - 30;
            logEvent.EventText = model.Text;
            logEvent.EventTime = model.CreateTime.ToShortTimeString();
            logEvent.Status    = EventControl.StatusType.Keep;
            FLP_Events.Controls.Add(logEvent);
        }
 public void AddSellerOperationLog(Model.LogInfo model)
 {
     if (model.ShopId != 0)
     {
         model.ShopId = model.ShopId;
         Context.LogInfo.Add(model);
         Context.SaveChanges();
     }
     else
     {
         throw new Himall.Core.HimallException("日志获取诊所ID错误");
     }
 }
        protected override void OnSessionClosed(CloseReason reason)
        {
            try
            {
                Logger.Info("########################SessionClosed开始执行###############################");
                if (null != this.equipment)
                {
                    //设备离线时更新人员状态
                    this.patroler.AccountState = "OFFLINE";
                    new BLL.Patroler().setPatrolerAccountStateByName(this.patroler);
                    Logger.Info("将巡检人" + this.patroler.UserName + "状态更新为OFFLINE");

                    //填写离线日志
                    Model.LogInfo logInfoModel = new Model.LogInfo();
                    logInfoModel.Equipment    = this.equipment.MacId;
                    logInfoModel.Operate      = "离线";
                    logInfoModel.Operate_time = DateTime.Now;
                    logInfoModel.Username     = this.patroler.UserName;
                    logInfoModel.Patroler_id  = this.patroler.DbId;
                    new BLL.LogInfo().insertLogInfo(logInfoModel);
                    Logger.Info("保存巡检人" + this.patroler.UserName + "操作日志");

                    //修改任务状态
                    Model.TaskInfo task = new BLL.TaskInfo().getTaskInfo(this.taskinfo.DbId);
                    if ("接受任务".Equals(task.TaskState) || "开始任务".Equals(task.TaskState))
                    {
                        task.TaskState = "执行过程中";
                        new BLL.TaskInfo().setTaskInfo(task);
                        Logger.Info("修改巡检人" + this.patroler.UserName + "当前任务状态为'执行过程中'");
                    }
                    else
                    {
                        Logger.Info("巡检人" + this.patroler.UserName + "已经完成任务");
                    }
                }
                Logger.Info("#################SessionClosed关闭成功####################");
                Logger.Info("\n");
                Logger.Info("\n");
                Logger.Info("\n");
            }
            catch (Exception e)
            {
                Logger.Error("#################SessionClosed关闭失败####################");
                Logger.Error(e.ToString());
                Logger.Error("\n");
                Logger.Error("\n");
                Logger.Error("\n");
            }
        }
Beispiel #5
0
 public void insertLogInfo(Model.LogInfo logInfo)
 {
     try
     {
         if (null == logInfo)
         {
             return;
         }
         IDAL.ILogInfo dal = DALFactory.LogInfo.Create();
         dal.insertLogInfo(logInfo);
     }
     catch (Exception e)
     {
         throw e;
     }
 }
Beispiel #6
0
        public void Insert(Model.LogInfo log)
        {
            var sqlString = "INSERT INTO siteserver_Log(PublishmentSystemID, ChannelID, ContentID, UserName, IPAddress, AddDate, Action, Summary) VALUES (@PublishmentSystemID, @ChannelID, @ContentID, @UserName, @IPAddress, @AddDate, @Action, @Summary)";

            var parms = new IDataParameter[]
            {
                GetParameter(ParmPublishmentsystemid, EDataType.Integer, log.PublishmentSystemID),
                GetParameter(ParmChannelid, EDataType.Integer, log.ChannelID),
                GetParameter(ParmContentid, EDataType.Integer, log.ContentID),
                GetParameter(ParmUserName, EDataType.VarChar, 50, log.UserName),
                GetParameter(ParmIpAddress, EDataType.VarChar, 50, log.IPAddress),
                GetParameter(ParmAddDate, EDataType.DateTime, log.AddDate),
                GetParameter(ParmAction, EDataType.NVarChar, 255, log.Action),
                GetParameter(ParmSummary, EDataType.NVarChar, 255, log.Summary)
            };

            ExecuteNonQuery(sqlString, parms);
        }
Beispiel #7
0
 public void insertLogInfo(Model.LogInfo logInfo)
 {
     try
     {
         String sql = " insert into LogInfo "
                      + " (EQUIPMENT,OPERATE,OPERATE_TIME,USERNAME,PATROLER_ID)VALUES("
                      + "'" + logInfo.Equipment + "',"
                      + "'" + logInfo.Operate + "',"
                      + "to_date('" + logInfo.Operate_time.ToString("yyyy-MM-dd HH:mm:ss") + "','yyyy-MM-dd hh24:mi:ss')" + ","
                      + "'" + logInfo.Username + "',"
                      + logInfo.Patroler_id + ")";
         OracleParameter[] parms  = null;
         string            strCnn = OracleHelper.ConnectionStringOrderDistributedTransaction;
         using (OracleConnection cnn = new OracleConnection(strCnn))
         {
             OracleHelper.ExecuteNonQuery(cnn, CommandType.Text, sql, parms);
         }
     }
     catch (Exception e)
     {
         throw e;
     }
 }
 public void AddPlatformOperationLog(Model.LogInfo model)
 {
     model.ShopId = 0;
     Context.LogInfo.Add(model);
     Context.SaveChanges();
 }
        public override void ExecuteCommand(EmsSession session, StringRequestInfo requestInfo)
        {
            session.LastLoginTime = System.DateTime.Now;
            session.Logger.Info("##########################开始执行Command##########################");
            try
            {
                session.LastLoginTime = System.DateTime.Now;
                byte[]   data         = new byte[128];
                string[] dataList     = requestInfo.Body.Split('$');
                string   patrolerName = dataList[0];
                string   equip        = dataList[1];
                double   x            = Convert.ToDouble(dataList[2]);
                double   y            = Convert.ToDouble(dataList[3]);

                if ("OFFLINE" == session.Patroler.AccountState)
                {
                    //不在线
                    //修改巡检员在线状态
                    session.Patroler.AccountState = "ONLINE";
                    new BLL.Patroler().setPatrolerAccountStateByName(session.Patroler);
                    session.Logger.Info("离线巡检人" + session.Patroler.UserName + "状态更新为ONLINE");

                    //查询是否有任务
                    session.Taskinfo = new BLL.TaskInfo().getTaskInfo(session.Patroler.UserName, "下发任务");

                    if (null == session.Taskinfo)
                    {
                        data = Encoding.UTF8.GetBytes("none" + "\r\n");
                        session.Send(data, 0, data.Length);
                        session.Logger.Info("离线巡检人" + session.Patroler.UserName + "没有获取到下发任务");
                    }
                    else
                    {
                        //发送任务工单号!
                        data = Encoding.UTF8.GetBytes(session.Taskinfo.DbId + "\r\n");
                        session.Send(data, 0, data.Length);
                        session.Logger.Info("离线巡检人" + session.Patroler.UserName + "获取到下发任务");
                    }

                    Model.LogInfo logInfoModel = new Model.LogInfo();
                    logInfoModel.Equipment    = session.Equipment.MacId;
                    logInfoModel.Operate      = "登录";
                    logInfoModel.Operate_time = DateTime.Now;
                    logInfoModel.Username     = session.Patroler.UserName;
                    logInfoModel.Patroler_id  = session.Patroler.DbId;
                    new BLL.LogInfo().insertLogInfo(logInfoModel);

                    session.Logger.Info("保存离线巡检人" + session.Patroler.UserName + "操作日志");
                }
                else
                {
                    //在线人员定位信息
                    Model.Position position = new Model.Position();
                    position.Longitude   = x;
                    position.Latitude    = y;
                    position.Username    = session.Patroler.UserName;
                    position.Patroler_id = session.Patroler.DbId;
                    position.ReceiveTime = DateTime.Now;

                    if (null != session.Taskinfo)
                    {
                        //插入带下发任务编号的人员定位信息
                        position.Task_id = session.Taskinfo.DbId;
                        new BLL.Position().insertPosition(position);
                        data = Encoding.UTF8.GetBytes(session.Taskinfo.DbId + "\r\n");
                        session.Send(data, 0, data.Length);
                        session.Logger.Info("保存在线巡检人" + session.Patroler.UserName + "任务位置信息!");
                    }
                    else
                    {//无下发任务编号 插入人员定位信息
                        new BLL.Position().insertPosition(position);
                        data = Encoding.UTF8.GetBytes("none" + "\r\n");
                        session.Send(data, 0, data.Length);
                        session.Logger.Info("保存在线巡检人" + session.Patroler.UserName + "位置信息!");
                    }
                }
                session.Logger.Info("##########################Command执行成功##########################");
                session.Logger.Info("\n");
                session.Logger.Info("\n");
                session.Logger.Info("\n");
            }
            catch (Exception e)
            {
                session.Logger.Error("##########################Command执行错误##########################");
                session.Logger.Error(e.ToString());
                session.Logger.Error("\n");
                session.Logger.Error("\n");
                session.Logger.Error("\n");
            }
        }