Exemple #1
0
        /// 生成一条请求数据到数据库
        /// <summary>
        /// 生成一条请求数据到数据库
        /// </summary>
        /// <param name="logdate"></param>
        /// <param name="agentid"></param>
        /// <param name="vendorid"></param>
        /// <returns></returns>
        private bool CreateRequireLogToDB(DateTime logdate, int agentid, int vendorid)
        {
            ClientLogRequireInfo info = BLL.ClientLogRequire.Instance.GetClientLogRequireInfo(logdate, agentid, vendorid);

            if (info == null)
            {
                //新增
                info         = new ClientLogRequireInfo();
                info.AgentID = agentid;
                info.LogDate = logdate;
                info.Vendor  = vendorid;

                info.CreateUserID = userid;
                info.CreateTime   = DateTime.Now;
            }
            else
            {
                if (info.Status_Value == 1)
                {
                    //请求中,无需再次请求
                    return(false);
                }
                //修改
                info.LastUpdateUserID = userid;
                info.LastUpdateTime   = DateTime.Now;
            }

            info.RequireID       = userid;
            info.RequireDateTime = DateTime.Now;
            info.Status          = 1;//请求中

            info.ResponseDateTime = null;
            info.ResponseSuccess  = null;
            info.ResponseRemark   = null;
            info.FilePath         = null;

            if (info.RecID == null)
            {
                return(CommonBll.Instance.InsertComAdoInfo(info));
            }
            else
            {
                return(CommonBll.Instance.UpdateComAdoInfo(info));
            }
        }
Exemple #2
0
        public bool PushClientLogForAgent(string key, byte[] data, DateTime date, int userid, Vender vender)
        {
            bool   filesuccess = false;
            string reason      = "";
            string filepath    = "";

            try
            {
                if (!CheckKey(key))
                {
                    BLL.Loger.Log4Net.Info("[坐席推送日志] 授权码错误");
                    filesuccess = false;
                    reason      = "[坐席推送日志] 授权码错误";
                }

                if (data != null)
                {
                    string root = BitAuto.Utils.Config.ConfigurationUtil.GetAppSettingValue("LogWebAbsolutePath", false).TrimEnd('\\')
                                  + "\\clientlog_" + vender.ToString().ToLower() + "\\" + userid + "\\";
                    string filename = date.ToString("yyyy_MM_dd") + "_" + userid + ".zip";
                    BLL.Util.BinaryToFile(root + filename, data);
                    filesuccess = true;
                    reason      = "";
                    filepath    = "/log/clientlog_" + vender.ToString().ToLower() + "/" + userid + "/" + filename;
                }
                else
                {
                    filesuccess = false;
                    reason      = "客户端日志已不存在";
                }
            }
            catch (Exception ex)
            {
                BLL.Loger.Log4Net.Info("[坐席推送日志] 文件保存异常", ex);
                filesuccess = false;
                reason      = ex.Message;
            }

            //数据入库
            try
            {
                ClientLogRequireInfo info = BLL.ClientLogRequire.Instance.GetClientLogRequireInfo(date, userid, (int)vender);
                if (info == null)
                {
                    //新增
                    info         = new ClientLogRequireInfo();
                    info.AgentID = userid;
                    info.LogDate = date;
                    info.Vendor  = (int)vender;

                    info.CreateUserID = userid;
                    info.CreateTime   = DateTime.Now;
                }
                else
                {
                    //修改
                    info.LastUpdateUserID = userid;
                    info.LastUpdateTime   = DateTime.Now;
                }
                info.Status = 2;//已响应

                info.ResponseDateTime = DateTime.Now;
                info.ResponseSuccess  = filesuccess ? 1 : 2;//0 未知 1 成功 2 失败
                info.ResponseRemark   = reason;
                info.FilePath         = filepath;

                if (info.RecID == null)
                {
                    CommonBll.Instance.InsertComAdoInfo(info);
                }
                else
                {
                    CommonBll.Instance.UpdateComAdoInfo(info);
                }
                return(true);
            }
            catch (Exception ex)
            {
                BLL.Loger.Log4Net.Info("[坐席推送日志] 数据入库异常", ex);
                return(false);
            }
        }