/// <summary> /// 处理单个监控记录 /// </summary> /// <param name="loggingSessionInfo"></param> /// <param name="monitorlogInfo"></param> /// <returns></returns> private bool SetMonitorLogInfo(LoggingSessionInfo loggingSessionInfo, MonitorLogInfo monitorlogInfo) { try { if (monitorlogInfo != null) { if (monitorlogInfo.monitor_log_id == null || monitorlogInfo.monitor_log_id.Equals("")) { monitorlogInfo.monitor_log_id = NewGuid(); } monitorlogInfo.customer_id = loggingSessionInfo.CurrentLoggingManager.Customer_Id; if (monitorlogInfo.create_user_id == null || monitorlogInfo.create_user_id.Equals("")) { monitorlogInfo.create_user_id = loggingSessionInfo.CurrentUser.User_Id; monitorlogInfo.create_time = GetCurrentDateTime(); } cSqlMapper.Instance(loggingSessionInfo.CurrentLoggingManager).Update("MonitorLog.InsertOrUpdate", monitorlogInfo); } return(true); } catch (Exception ex) { throw (ex); } }
/// <summary> /// Monitor Log 查询 /// </summary> /// <param name="loggingSessionInfo">登录model</param> /// <param name="order_no">订单号</param> /// <param name="unit_code">门店</param> /// <param name="item_name">商品</param> /// <param name="order_date_begin">开始日期</param> /// <param name="order_date_end">结束日期</param> /// <param name="maxRowCount">每页数量</param> /// <param name="startRowIndex">开始行号</param> /// <returns></returns> public MonitorLogInfo SearchMonitorLogList(cPos.Model.LoggingSessionInfo loggingSessionInfo , string customer_code , string unit_code , string date_begin , string date_end , int maxRowCount , int startRowIndex ) { Hashtable ht = new Hashtable(); ht["customer_code"] = customer_code; ht["unit_code"] = unit_code; ht["date_begin"] = date_begin; ht["date_end"] = date_end; ht["StartRow"] = startRowIndex; ht["EndRow"] = startRowIndex + maxRowCount; MonitorLogInfo obj = new MonitorLogInfo(); IList <MonitorLogInfo> list = new List <MonitorLogInfo>(); list = MSSqlMapper.Instance(loggingSessionInfo.CurrentLoggingManager).QueryForList <MonitorLogInfo>( "Monitor.SearchMonitorLogList", ht); if (list != null && list.Count > 0) { obj.icount = list[0].icount; } obj.List = list; return(obj); }
public Hashtable Run(string batId, CustomerInfo customer) { string bizId = Utils.NewGuid(); var data = new Hashtable(); try { string customerId = customer.ID; int count = 0; // 总数量 int rowsCount = 10; // 每页数量 int startRow = 0; string unitId = null; var apMonitorService = new Service.MonitorService(); var bsService = BsWebService.CreateMonitorLogService(customer); count = bsService.GetMonitorLogNotPackagedCount(customerId, unitId); IList <MonitorLogInfo> logList = new List <MonitorLogInfo>(); string dataBatId = string.Empty; while (count > 0 && startRow < count) { dataBatId = Utils.NewGuid(); logList.Clear(); var tmpList = bsService.GetMonitorLogListPackaged(customerId, unitId, 0, rowsCount, dataBatId); if (tmpList != null && tmpList.Length > 0) { foreach (var tmpObj in tmpList) { var logObj = new MonitorLogInfo(); logObj.monitor_log_id = tmpObj.monitor_log_id; logObj.customer_id = tmpObj.customer_id; logObj.unit_id = tmpObj.unit_id; logObj.pos_id = tmpObj.pos_id; logObj.upload_time = tmpObj.upload_time; logObj.remark = tmpObj.remark; logObj.create_time = tmpObj.create_time; logObj.create_user_id = tmpObj.create_user_id; logList.Add(logObj); } // 保存 data = apMonitorService.SaveMonitorLogList(true, logList); // 更新标记 bsService.SetMonitorLogIfFlagInfo(customerId, dataBatId); } startRow += logList.Count; } data["status"] = Utils.GetStatus(true); return(data); } catch (Exception ex) { data["status"] = Utils.GetStatus(false); data["error"] = ex.ToString(); Console.WriteLine(ex.ToString()); } return(data); }
/// <summary> /// 更新MonitorLog表打包标识方法 /// </summary> /// <param name="loggingSessionInfo">登录model</param> /// <param name="bat_id">批次标识</param> /// <param name="strError">错误信息返回</param> /// <returns></returns> public bool SetMonitorLogIfFlagInfo(LoggingSessionInfo loggingSessionInfo, string bat_id, out string strError) { MonitorLogInfo monitorLogInfo = new MonitorLogInfo(); monitorLogInfo.bat_id = bat_id; cSqlMapper.Instance(loggingSessionInfo.CurrentLoggingManager).Update("MonitorLog.UpdateUnDownloadIfFlag", monitorLogInfo); strError = "Success"; return(true); }
/// <summary> /// 设置打包批次号 /// </summary> /// <param name="loggingSessionInfo">登录model</param> /// <param name="bat_id">批次号</param> /// <param name="MonitorLogList">监控集合</param> /// <param name="strError">错误信息返回</param> /// <returns></returns> public bool SetMonitorLogBatInfo(LoggingSessionInfo loggingSessionInfo, string bat_id, IList <MonitorLogInfo> MonitorLogList, out string strError) { MonitorLogInfo monitorlogInfo = new MonitorLogInfo(); monitorlogInfo.bat_id = bat_id; monitorlogInfo.monitorLogInfoList = MonitorLogList; cSqlMapper.Instance(loggingSessionInfo.CurrentLoggingManager).Update("MonitorLog.UpdateUnDownloadBatId", monitorlogInfo); strError = "Success"; return(true); }
/// <summary> /// 更新MonitorLog表打包标识方法 /// </summary> /// <param name="Customer_Id">客户标识</param> /// <param name="bat_id">批次标识</param> /// <param name="strError">错误信息返回</param> /// <returns></returns> public bool SetMonitorLogIfFlagInfoWeb(string Customer_Id, string bat_id, out string strError) { //获取连接数据库信息 LoggingManager loggingManager = new cLoggingManager().GetLoggingManager(Customer_Id); MonitorLogInfo monitorLogInfo = new MonitorLogInfo(); monitorLogInfo.bat_id = bat_id; cSqlMapper.Instance(loggingManager).Update("MonitorLog.UpdateUnDownloadIfFlag", monitorLogInfo); strError = "Success"; return(true); }
private void TestInsertOrUpdate() { MonitorLogAuthService monitorLogAuthService = new MonitorLogAuthService(); IList <MonitorLogInfo> monitorLogList = new List <MonitorLogInfo>(); MonitorLogInfo m1 = new MonitorLogInfo(); m1.customer_id = "2241b59b81ba4684b2a3095c66a489db"; m1.unit_id = "A8FB3A3A7A604DB78FF963394EF12DF1"; m1.upload_time = System.DateTime.Now.ToString(); m1.remark = "it is test."; bool b = monitorLogAuthService.SetMonitorLogInfo("2241b59b81ba4684b2a3095c66a489db", "A8FB3A3A7A604DB78FF963394EF12DF1", "0714B2ACD7E24486A66A435C937D4CE7", m1); this.lb1.Text = b.ToString(); }
/// <summary> /// 打包 /// </summary> /// <param name="Customer_Id">客户标识</param> /// <param name="Unit_Id">组织标识</param> /// <param name="maxRowCount">最大行数</param> /// <param name="startRowIndex">开始行号</param> /// <param name="bat_id">批次号</param> /// <returns></returns> public IList <MonitorLogInfo> GetMonitorLogListPackagedWeb(string Customer_Id, string Unit_Id, int maxRowCount, int startRowIndex, string bat_id) { //获取连接数据库信息 LoggingManager loggingManager = new cLoggingManager().GetLoggingManager(Customer_Id); //获取要传输的监控信息集合 Hashtable _ht = new Hashtable(); _ht.Add("StartRow", startRowIndex); _ht.Add("EndRow", startRowIndex + maxRowCount); _ht.Add("CustomerId", Customer_Id); _ht.Add("UnitId", Unit_Id); IList <MonitorLogInfo> MonitorlogInfoList = new List <MonitorLogInfo>(); MonitorlogInfoList = cSqlMapper.Instance(loggingManager).QueryForList <MonitorLogInfo>("MonitorLog.SelectUnDownload", _ht); //修改获取的监控信息批次号 MonitorLogInfo monitorlogInfo = new MonitorLogInfo(); monitorlogInfo.bat_id = bat_id; monitorlogInfo.monitorLogInfoList = MonitorlogInfoList; cSqlMapper.Instance(loggingManager).Update("MonitorLog.UpdateUnDownloadBatId", monitorlogInfo); return(MonitorlogInfoList); }
/// <summary> /// 检查MonitorLog是否已存在 /// </summary> /// <param name="log"></param> /// <returns></returns> public bool CheckExistMonitorLog(MonitorLogInfo log) { int count = MSSqlMapper.Instance().QueryForObject <int>("Monitor.CheckExistMonitorLog", log); return(count > 0 ? true : false); }
/// <summary> /// 保存监控日志集合 /// </summary> /// <param name="Customer_Id">客户标识</param> /// <param name="Unit_Id">组织标识</param> /// <param name="User_Id">用户标识</param> /// <param name="MonitorLogList">监控日志集合</param> /// <returns></returns> public bool SetMonitorLogInfo(string Customer_Id, string Unit_Id, string User_Id, MonitorLogInfo monitorLogInfo) { string strError = string.Empty; try { LoggingSessionInfo loggingSessionInfo = GetLoggingSessionInfo(Customer_Id, User_Id, Unit_Id); MonitorLogService monitorLogService = new MonitorLogService(); monitorLogInfo.if_flag = 0; monitorLogInfo.customer_id = Customer_Id; IList <MonitorLogInfo> MonitorLogList = new List <MonitorLogInfo>(); MonitorLogList.Add(monitorLogInfo); bool bReturn = monitorLogService.SetMonitorLogListInfo(loggingSessionInfo, MonitorLogList, out strError); if (bReturn) { return(bReturn); } else { throw new Exception(string.Format(strError, strError)); } } catch (Exception ex) { strError = ex.ToString(); throw (ex); } }