Beispiel #1
0
        /// <summary>
        /// 请求服务器将记录数据转成Excel文件并返回路径给客户端。
        /// </summary>
        /// <param name="strIdList"></param>
        /// <param name="strDataType"></param>
        /// <param name="beginTime"></param>
        /// <param name="endTime"></param>
        /// <returns></returns>
        public IDictionary <string, NameValueCollection> QueryAllMonitorInfo()
        {
            //组织输入参数
            anyType2anyTypeMapEntry[] requestData = new anyType2anyTypeMapEntry[]
            {
                Helper.XfireCreateKeyValue("dowhat", "QueryAllMonitorInfo"),
            };

            //通过WebService查数据
            this.service.Url = UserPermissionContext.Instance.Url;

            RetMapInVector result = ServiceClient.GetUnivData2(requestData);

            if (!result.retbool)
            {
                if (logger.IsErrorEnabled)
                {
                    logger.Error(result.estr);
                }
                throw new Exception(result.estr);
            }

            IDictionary <string, NameValueCollection> resultData = Helper.XfireConventMapEntryToDictionary(result.vmap);

            return(resultData);
        }
Beispiel #2
0
        /// <summary>
        /// 删除指定表格的指定时间以前的记录
        /// </summary>
        public static IDictionary <string, NameValueCollection> DeleteTableRecords(string strTableId, DateTime tmFrom)
        {
            //组织输入参数
            anyType2anyTypeMapEntry[] requestData = new anyType2anyTypeMapEntry[]
            {
                Helper.XfireCreateKeyValue("dowhat", "DeleteRecords"),
                Helper.XfireCreateKeyValue("id", strTableId),
                Helper.XfireCreateKeyValue("year", tmFrom.Year.ToString()),
                Helper.XfireCreateKeyValue("month", tmFrom.Month.ToString()),
                Helper.XfireCreateKeyValue("day", tmFrom.Day.ToString()),
                Helper.XfireCreateKeyValue("hour", tmFrom.Hour.ToString()),
                Helper.XfireCreateKeyValue("minute", tmFrom.Minute.ToString()),
                Helper.XfireCreateKeyValue("second", tmFrom.Second.ToString())
            };

            //通过WebService查数据
            service.Url = UserPermissionContext.Instance.Url;

            RetMapInVector result = ServiceClient.GetUnivData2(requestData);

            if (!result.retbool)
            {
                throw new Exception(result.estr);
            }

            IDictionary <string, NameValueCollection> resultData = Helper.XfireConventMapEntryToDictionary(result.vmap);

            return(resultData);
        }
Beispiel #3
0
        /// <summary>
        /// QueryReportData
        /// </summary>
        /// <param name="strIdList"></param>
        /// <param name="bCompress"></param>
        /// <param name="beginTime"></param>
        /// <param name="endTime"></param>
        /// <returns></returns>
        public DataTable QueryReportData(string strIdList, bool bCompress, bool bDstrNeed, DateTime beginTime, DateTime endTime)
        {
            //组织输入参数
            anyType2anyTypeMapEntry[] requestData = new anyType2anyTypeMapEntry[]
            {
                Helper.XfireCreateKeyValue("dowhat", "QueryReportData"),
                Helper.XfireCreateKeyValue("id", strIdList),
                Helper.XfireCreateKeyValue("compress", bCompress?"true":"false"),
                Helper.XfireCreateKeyValue("dstrNeed", bDstrNeed?"true":"false"),
                Helper.XfireCreateKeyValue("begin_year", beginTime.Year.ToString()),
                Helper.XfireCreateKeyValue("begin_month", beginTime.Month.ToString()),
                Helper.XfireCreateKeyValue("begin_day", beginTime.Day.ToString()),
                Helper.XfireCreateKeyValue("begin_hour", beginTime.Hour.ToString()),
                Helper.XfireCreateKeyValue("begin_minute", beginTime.Minute.ToString()),
                Helper.XfireCreateKeyValue("begin_second", beginTime.Second.ToString()),
                Helper.XfireCreateKeyValue("end_year", endTime.Year.ToString()),
                Helper.XfireCreateKeyValue("end_month", endTime.Month.ToString()),
                Helper.XfireCreateKeyValue("end_day", endTime.Day.ToString()),
                Helper.XfireCreateKeyValue("end_hour", endTime.Hour.ToString()),
                Helper.XfireCreateKeyValue("end_minute", endTime.Minute.ToString()),
                Helper.XfireCreateKeyValue("end_second", endTime.Second.ToString())
            };

            return(CreateDataTable(requestData));
        }
Beispiel #4
0
        public IDictionary <string, NameValueCollection> Decrypt(string[] values)
        {
            anyType2anyTypeMapEntry[] requestData = new anyType2anyTypeMapEntry[values.Length + 1];
            requestData[0] = Helper.XfireCreateKeyValue("dowhat", "decrypt");

            for (int i = 1; i <= values.Length; i++)
            {
                //requestData[i] = Helper.XfireCreateKeyValue("X" + i.ToString(), values[i - 1]);
                requestData[i] = Helper.XfireCreateKeyValue(values[i - 1], "");
            }

            this.service.Url = UserPermissionContext.Instance.Url;
            RetMapInVector result = ServiceClient.GetUnivData2(requestData);

            if (!result.retbool)
            {
                if (logger.IsErrorEnabled)
                {
                    logger.Error(result.estr);
                }
                throw new Exception(result.estr);
            }

            return(Helper.XfireConventMapEntryToDictionary(result.vmap));
        }
Beispiel #5
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="id"></param>
        /// <param name="count"></param>
        /// <returns></returns>
        public DataTable Query(MonitorTemplet templet, string id, int count)
        {
            anyType2anyTypeMapEntry[] requestData = new anyType2anyTypeMapEntry[]
            {
                Helper.XfireCreateKeyValue("dowhat", "QueryRecordsByCount"),
                Helper.XfireCreateKeyValue("id", id),
                Helper.XfireCreateKeyValue("count", count.ToString())
            };
            this.service.Url = UserPermissionContext.Instance.Url;
            RetMapInVector result = ServiceClient.GetForestData(requestData);

            //RetMapInVector result = this.service.GetForestData(requestData);

            if (!result.retbool)
            {
                if (logger.IsWarnEnabled)
                {
                    logger.Warn(result.estr);
                }
                return(null);
            }

            DataTable dt = CreateDataTable(templet, result.vmap);

            return(dt);
        }
        /// <summary>
        /// ��Ӳ�����־
        /// </summary>
        /// <param name="strUserID"></param>
        /// <param name="strOperateTime"></param>
        /// <param name="strOperateType"></param>
        /// <param name="strOperateObjName"></param>
        /// <param name="strOperateObjInfo"></param>
        public static void AddUserOperateLogRecord(string strUserID, string strOperateTime, string strOperateObjName, string strOperateType, string strOperateObjInfo)
        {
            int nCount = data.Count + 1;

            NameValueCollection values = new NameValueCollection();
            values.Add("_UserID", strUserID);
            values.Add("_OperateTime", strOperateTime);
            values.Add("_OperateType", strOperateType);
            values.Add("_OperateObjName", strOperateObjName);
            values.Add("_OperateObjInfo", strOperateObjInfo);

            data.Add("OperateLog_" + nCount.ToString(), values);

            if(nCount < 10)
            {
                return;
            }

            anyType2anyTypeMapEntry[][] logData = Helper.XfireConventDictionaryToMapEntry(data);

            service.Url = UserPermissionContext.Instance.Url;
            anyType2anyTypeMapEntry[] requestData = new anyType2anyTypeMapEntry[]
            {
                Helper.XfireCreateKeyValue("dowhat","AppendOperateLog")
            };

            RetMapInVector result = ServiceClient.SubmitUnivData2(logData, requestData);

            data.Clear();

            if (!result.retbool)
            {
                throw new System.Net.WebException("����WebServiceʧ�ܣ����������");
            }
        }
Beispiel #7
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="task"></param>
        public void Update(Task task)
        {
            anyType2anyTypeMapEntry[] requestData = new anyType2anyTypeMapEntry[]
            {
                Helper.XfireCreateKeyValue("dowhat", "SubmitTask"),
                Helper.XfireCreateKeyValue("del_supplement", "true")
            };

            IDictionary <string, NameValueCollection> taskData = new Dictionary <string, NameValueCollection>();

            taskData["property"]     = task.Properties;
            taskData["return"]       = new NameValueCollection();
            taskData["return"]["id"] = task.Name;
            this.service.Url         = UserPermissionContext.Instance.Url;
            RetMapInVector result = ServiceClient.SubmitUnivData2(Helper.XfireConventDictionaryToMapEntry(taskData), requestData);

            if (!result.retbool)
            {
                if (logger.IsErrorEnabled)
                {
                    logger.Error(result.estr);
                }
                throw new Exception(result.estr);
            }
        }
Beispiel #8
0
        /// <summary>
        /// SmsTest
        /// </summary>
        /// <param name="strPhoneNumber"></param>
        /// <param name="bByWebSms"></param>
        /// <returns></returns>
        public bool SmsTest(string strPhoneNumber, bool bByWebSms)
        {
            //组织输入参数
            anyType2anyTypeMapEntry[] requestData = new anyType2anyTypeMapEntry[]
            {
                Helper.XfireCreateKeyValue("dowhat", "SmsTest"),
                Helper.XfireCreateKeyValue("phoneNumber", strPhoneNumber),
                Helper.XfireCreateKeyValue("ByWebSms", bByWebSms?"true":"false")
            };

            //通过WebService查数据
            this.service.Url = UserPermissionContext.Instance.Url;

            RetMapInVector result = ServiceClient.GetUnivData2(requestData);

            if (!result.retbool)
            {
                if (logger.IsErrorEnabled)
                {
                    logger.Error(result.estr);
                }
            }

            return(result.retbool);
        }
Beispiel #9
0
        /// <summary>
        /// EmailTest
        /// </summary>
        /// <param name="strMailServer"></param>
        /// <param name="strMailTo"></param>
        /// <param name="strMailFrom"></param>
        /// <param name="strUser"></param>
        /// <param name="strPassword"></param>
        /// <param name="strSubject"></param>
        /// <param name="strContent"></param>
        /// <returns></returns>
        public bool EmailTest(string strMailServer, string strMailTo, string strMailFrom, string strUser,
                              string strPassword, string strSubject, string strContent)
        {
            //组织输入参数
            anyType2anyTypeMapEntry[] requestData = new anyType2anyTypeMapEntry[]
            {
                Helper.XfireCreateKeyValue("dowhat", "EmailTest"),
                Helper.XfireCreateKeyValue("mailServer", strMailServer),
                Helper.XfireCreateKeyValue("mailTo", strMailTo),
                Helper.XfireCreateKeyValue("mailFrom", strMailFrom),
                Helper.XfireCreateKeyValue("user", strUser),
                Helper.XfireCreateKeyValue("password", strPassword),
                Helper.XfireCreateKeyValue("subject", strSubject),
                Helper.XfireCreateKeyValue("content", strContent)
            };

            //通过WebService查数据
            this.service.Url = UserPermissionContext.Instance.Url;

            RetMapInVector result = ServiceClient.GetUnivData2(requestData);

            if (!result.retbool)
            {
                if (logger.IsErrorEnabled)
                {
                    logger.Error(result.estr);
                }
            }

            return(result.retbool);
        }
Beispiel #10
0
        /// <summary>
        /// 
        /// </summary>
        /// <returns></returns>
        public Task[] FindAll()
        {
            anyType2anyTypeMapEntry[] requestData = new anyType2anyTypeMapEntry[]
            {
                Helper.XfireCreateKeyValue("dowhat","GetAllTask")
            };
            this.service.Url = UserPermissionContext.Instance.Url;
            RetMapInVector result = ServiceClient.GetUnivData2(requestData);
            if (!result.retbool)
            {
                if (logger.IsErrorEnabled)
                {
                    logger.Error(result.estr);
                    throw new Exception(result.estr);
                }
            }

            IDictionary<string, NameValueCollection> resultData = Helper.XfireConventMapEntryToDictionary(result.vmap);
            Task[] tasks = new Task[resultData.Keys.Count - 1];
            int i = 0;
            foreach (string key in resultData.Keys)
            {
                if ("return".Equals(key))
                {
                    continue;
                }
                tasks[i] = new Task();
                tasks[i].Properties = resultData[key];
                tasks[i].Name = key;
                i++;
            }

            return tasks;
        }
        /// <summary>
        /// EmailTest
        /// </summary>
        /// <param name="strMailServer"></param>
        /// <param name="strMailTo"></param>
        /// <param name="strMailFrom"></param>
        /// <param name="strUser"></param>
        /// <param name="strPassword"></param>
        /// <param name="strSubject"></param>
        /// <param name="strContent"></param>
        /// <returns></returns>
        public bool EmailTest(string strMailServer, string strMailTo, string strMailFrom, string strUser, 
            string strPassword, string strSubject, string strContent)
        {
            //��֯�������
            anyType2anyTypeMapEntry[] requestData = new anyType2anyTypeMapEntry[]
            {
                Helper.XfireCreateKeyValue("dowhat","EmailTest"),
                Helper.XfireCreateKeyValue("mailServer",strMailServer),
                Helper.XfireCreateKeyValue("mailTo",strMailTo),
                Helper.XfireCreateKeyValue("mailFrom",strMailFrom),
                Helper.XfireCreateKeyValue("user",strUser),
                Helper.XfireCreateKeyValue("password",strPassword),
                Helper.XfireCreateKeyValue("subject",strSubject),
                Helper.XfireCreateKeyValue("content",strContent)
            };

            //ͨ��WebService������
            this.service.Url = UserPermissionContext.Instance.Url;

            RetMapInVector result = ServiceClient.GetUnivData2(requestData);
            if (!result.retbool)
            {
                if (logger.IsErrorEnabled)
                {
                    logger.Error(result.estr);
                }
            }

            return result.retbool;
        }
Beispiel #12
0
        public bool PushStringMessage(string queuename, string label, string content)
        {
            this.service.Url = UserPermissionContext.Instance.Url;
            anyType2anyTypeMapEntry[] requestData = new anyType2anyTypeMapEntry[]
            {
                Helper.XfireCreateKeyValue("dowhat", "PushStringMessage"),
                Helper.XfireCreateKeyValue("queuename", queuename),
                Helper.XfireCreateKeyValue("label", label),
                Helper.XfireCreateKeyValue("content", content)
            };
            RetMapInVector result = ServiceClient.GetUnivData2(requestData);
            bool           rs     = false;

            if (result.retbool)
            {
                rs = true;
            }
            else
            {
                if (logger.IsWarnEnabled)
                {
                    logger.Warn(result.estr);
                }
            }
            IDictionary <string, NameValueCollection> resultData = Helper.XfireConventMapEntryToDictionary(result.vmap);

            return(rs);
        }
Beispiel #13
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="entitys"></param>
        /// <returns></returns>
        public string[] BatchAddEntitys(ArrayList entitys)
        {
            //构造设备数据
            IDictionary <string, NameValueCollection> data = new Dictionary <string, NameValueCollection>();

            int i = 0;

            foreach (NameValueCollection entity in entitys)
            {
                string strTmp = "";
                strTmp       = "entity_" + i.ToString();
                data[strTmp] = entity;
                i++;
            }

            anyType2anyTypeMapEntry[][] values = Helper.XfireConventDictionaryToMapEntry(data);

            anyType2anyTypeMapEntry[] requestData = new anyType2anyTypeMapEntry[]
            {
                Helper.XfireCreateKeyValue("dowhat", "AddManyMonitor"),
                //Helper.XfireCreateKeyValue("parentid",parentid),
                Helper.XfireCreateKeyValue("autoCreateTable", "true")
            };

            this.service.Url = UserPermissionContext.Instance.Url;
            int oldTimeout = this.service.Timeout;

            this.service.Timeout = 600000;

            RetMapInVector result = ServiceClient.SubmitUnivData2(values, requestData);

            if (!result.retbool)
            {
                if (logger.IsErrorEnabled)
                {
                    logger.Error(result.estr);
                }
                throw new System.Net.WebException("调用Web Service失败:" + result.estr);
            }

            IDictionary <string, NameValueCollection> resultData = Helper.XfireConventMapEntryToDictionary(result.vmap);

            string[] entityids = new string[resultData["return"].Count - 1];
            i = 0;
            foreach (string id in resultData["return"].AllKeys)
            {
                if (id.ToLower() == "return")
                {
                    continue;
                }
                entityids[i] = id;
                i            = i + 1;
            }

            this.service.Timeout = oldTimeout;

            return(entityids);
        }
        /// <summary>
        /// 
        /// </summary>
        /// <param name="entitys"></param>
        /// <returns></returns>
        public string[] BatchAddEntitys(ArrayList entitys)
        {
            //�����豸����
            IDictionary<string, NameValueCollection> data = new Dictionary<string, NameValueCollection>();

            int i = 0;
            foreach (NameValueCollection entity in entitys)
            {
                string strTmp = "";
                strTmp = "entity_" + i.ToString();
                data[strTmp] = entity;
                i++;
            }

            anyType2anyTypeMapEntry[][] values = Helper.XfireConventDictionaryToMapEntry(data);

            anyType2anyTypeMapEntry[] requestData = new anyType2anyTypeMapEntry[]
            {
                Helper.XfireCreateKeyValue("dowhat","AddManyMonitor"),
                //Helper.XfireCreateKeyValue("parentid",parentid),
                Helper.XfireCreateKeyValue("autoCreateTable","true")
            };

            this.service.Url = UserPermissionContext.Instance.Url;
            int oldTimeout = this.service.Timeout;
            this.service.Timeout = 600000;

            RetMapInVector result = ServiceClient.SubmitUnivData2(values, requestData);
            if (!result.retbool)
            {
                if (logger.IsErrorEnabled)
                {
                    logger.Error(result.estr);
                }
                throw new System.Net.WebException("����Web Serviceʧ�ܣ�" + result.estr);
            }

            IDictionary<string, NameValueCollection> resultData = Helper.XfireConventMapEntryToDictionary(result.vmap);
            string[] entityids = new string[resultData["return"].Count - 1];
            i = 0;
            foreach (string id in resultData["return"].AllKeys)
            {
                if (id.ToLower() == "return")
                {
                    continue;
                }
                entityids[i] = id;
                i = i + 1;
            }

            this.service.Timeout = oldTimeout;

            return entityids;
        }
Beispiel #15
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="task"></param>
        public Task FindByName(string name)
        {
            Task task = new Task();

            anyType2anyTypeMapEntry[] requestData = new anyType2anyTypeMapEntry[]
            {
                Helper.XfireCreateKeyValue("dowhat", "GetTask"),
                Helper.XfireCreateKeyValue("id", name)
            };
            this.service.Url = UserPermissionContext.Instance.Url;
            RetMapInVector result = ServiceClient.GetUnivData2(requestData);
            IDictionary <string, NameValueCollection> resultData = Helper.XfireConventMapEntryToDictionary(result.vmap);

            task.Properties = resultData["property"];
            task.Name       = name;

            return(task);
        }
Beispiel #16
0
 /// <summary>
 /// 
 /// </summary>
 /// <param name="taskName"></param>
 public void DeleteTaskByName(string taskName)
 {
     anyType2anyTypeMapEntry[] requestData = new anyType2anyTypeMapEntry[]
     {
         Helper.XfireCreateKeyValue("dowhat","DeleteTask"),
         Helper.XfireCreateKeyValue("id",taskName)
     };
     this.service.Url = UserPermissionContext.Instance.Url;
     RetMapInVector result = ServiceClient.GetUnivData2(requestData);
     if (!result.retbool)
     {
         if (logger.IsErrorEnabled)
         {
             logger.Error(result.estr);
         }
         throw new Exception(result.estr);
     }
 }
Beispiel #17
0
        public void GetAllQueueNames()
        {
            this.service.Url = UserPermissionContext.Instance.Url;
            anyType2anyTypeMapEntry[] requestData = new anyType2anyTypeMapEntry[]
            {
                Helper.XfireCreateKeyValue("dowhat", "GetAllQueueNames"),
            };
            RetMapInVector result = ServiceClient.GetUnivData2(requestData);

            if (!result.retbool)
            {
                if (logger.IsWarnEnabled)
                {
                    logger.Warn(result.estr);
                }
            }
            IDictionary <string, NameValueCollection> resultData = Helper.XfireConventMapEntryToDictionary(result.vmap);
        }
 public void DeleteQueue(string queuename)
 {
     this.service.Url = UserPermissionContext.Instance.Url;
     anyType2anyTypeMapEntry[] requestData = new anyType2anyTypeMapEntry[]
     {
         Helper.XfireCreateKeyValue("dowhat","DeleteQueue"),
         Helper.XfireCreateKeyValue("queuename",queuename),
     };
     RetMapInVector result = ServiceClient.GetUnivData2(requestData);
     if (!result.retbool)
     {
         if (logger.IsWarnEnabled)
         {
             logger.Warn(result.estr);
         }
     }
     IDictionary<string, NameValueCollection> resultData = Helper.XfireConventMapEntryToDictionary(result.vmap);
 }
Beispiel #19
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="taskName"></param>
        public void DeleteTaskByName(string taskName)
        {
            anyType2anyTypeMapEntry[] requestData = new anyType2anyTypeMapEntry[]
            {
                Helper.XfireCreateKeyValue("dowhat", "DeleteTask"),
                Helper.XfireCreateKeyValue("id", taskName)
            };
            this.service.Url = UserPermissionContext.Instance.Url;
            RetMapInVector result = ServiceClient.GetUnivData2(requestData);

            if (!result.retbool)
            {
                if (logger.IsErrorEnabled)
                {
                    logger.Error(result.estr);
                }
                throw new Exception(result.estr);
            }
        }
        public DataTable QueryRecordsByCount(string id, string count)
        {
            anyType2anyTypeMapEntry[] requestData = new anyType2anyTypeMapEntry[3];
                requestData[0] = Helper.XfireCreateKeyValue("dowhat", "QueryRecordsByCount");
                requestData[1] = Helper.XfireCreateKeyValue("id", id);
                requestData[2] = Helper.XfireCreateKeyValue("count", count);

                this.service.Url = UserPermissionContext.Instance.Url;
                RetMapInVector result = ServiceClient.GetForestData(requestData);
                //RetMapInVector result = this.service.GetForestData(requestData);
                if (!result.retbool)
                {
                    if (logger.IsErrorEnabled)
                    {
                        logger.Error(result.estr);
                    }
                    throw new Exception(result.estr);
                }

                return CreateDataTable(id, result.vmap);
        }
Beispiel #21
0
        private void Load()
        {
            anyType2anyTypeMapEntry[] requestData = new anyType2anyTypeMapEntry[]
            {
                Helper.XfireCreateKeyValue("dowhat", "LoadResource"),
                Helper.XfireCreateKeyValue("language", this.language)
            };
            this.service.Url = UserPermissionContext.Instance.Url;
            RetMapInVector result = ServiceClient.GetUnivData2(requestData);

            if (!result.retbool)
            {
                if (logger.IsErrorEnabled)
                {
                    logger.Error(result.estr);
                }
                throw new Exception(result.estr);
            }
            IDictionary <string, NameValueCollection> data = Helper.XfireConventMapEntryToDictionary(result.vmap);

            this.resource = data["property"];
        }
        public DataTable QueryRecordsByCount(string id, string count)
        {
            anyType2anyTypeMapEntry[] requestData = new anyType2anyTypeMapEntry[3];
            requestData[0] = Helper.XfireCreateKeyValue("dowhat", "QueryRecordsByCount");
            requestData[1] = Helper.XfireCreateKeyValue("id", id);
            requestData[2] = Helper.XfireCreateKeyValue("count", count);

            this.service.Url = UserPermissionContext.Instance.Url;
            RetMapInVector result = ServiceClient.GetForestData(requestData);

            //RetMapInVector result = this.service.GetForestData(requestData);
            if (!result.retbool)
            {
                if (logger.IsErrorEnabled)
                {
                    logger.Error(result.estr);
                }
                throw new Exception(result.estr);
            }


            return(CreateDataTable(id, result.vmap));
        }
Beispiel #23
0
        /// <summary>
        ///
        /// </summary>
        /// <returns></returns>
        public Task[] FindAll()
        {
            anyType2anyTypeMapEntry[] requestData = new anyType2anyTypeMapEntry[]
            {
                Helper.XfireCreateKeyValue("dowhat", "GetAllTask")
            };
            this.service.Url = UserPermissionContext.Instance.Url;
            RetMapInVector result = ServiceClient.GetUnivData2(requestData);

            if (!result.retbool)
            {
                if (logger.IsErrorEnabled)
                {
                    logger.Error(result.estr);
                    throw new Exception(result.estr);
                }
            }

            IDictionary <string, NameValueCollection> resultData = Helper.XfireConventMapEntryToDictionary(result.vmap);

            Task[] tasks = new Task[resultData.Keys.Count - 1];
            int    i     = 0;

            foreach (string key in resultData.Keys)
            {
                if ("return".Equals(key))
                {
                    continue;
                }
                tasks[i]            = new Task();
                tasks[i].Properties = resultData[key];
                tasks[i].Name       = key;
                i++;
            }

            return(tasks);
        }
Beispiel #24
0
        /// <summary>
        /// 1
        /// </summary>
        /// <param name="templet"></param>
        /// <param name="id"></param>
        /// <param name="beginTime"></param>
        /// <param name="endTime"></param>
        /// <param name="tj"></param>
        /// <returns></returns>
        public DataTable Query1(MonitorTemplet templet, string id, DateTime beginTime, DateTime endTime)
        {
            anyType2anyTypeMapEntry[] requestData = new anyType2anyTypeMapEntry[]
            {
                Helper.XfireCreateKeyValue("dowhat", "QueryRecordsByTime"),
                Helper.XfireCreateKeyValue("id", id),
                Helper.XfireCreateKeyValue("begin_year", beginTime.Year.ToString()),
                Helper.XfireCreateKeyValue("begin_month", beginTime.Month.ToString()),
                Helper.XfireCreateKeyValue("begin_day", beginTime.Day.ToString()),
                Helper.XfireCreateKeyValue("begin_hour", beginTime.Hour.ToString()),
                Helper.XfireCreateKeyValue("begin_minute", beginTime.Minute.ToString()),
                Helper.XfireCreateKeyValue("begin_second", beginTime.Second.ToString()),
                Helper.XfireCreateKeyValue("end_year", endTime.Year.ToString()),
                Helper.XfireCreateKeyValue("end_month", endTime.Month.ToString()),
                Helper.XfireCreateKeyValue("end_day", endTime.Day.ToString()),
                Helper.XfireCreateKeyValue("end_hour", endTime.Hour.ToString()),
                Helper.XfireCreateKeyValue("end_minute", endTime.Minute.ToString()),
                Helper.XfireCreateKeyValue("end_second", endTime.Second.ToString())
            };
            this.service.Url = UserPermissionContext.Instance.Url;
            RetMapInVector result = ServiceClient.GetForestData(requestData);

            //RetMapInVector result = this.service.GetForestData(requestData);

            if (!result.retbool)
            {
                if (logger.IsWarnEnabled)
                {
                    logger.Warn(result.estr);
                }
                return(null);
            }

            DataTable dt = CreateDataTable1(templet, result.vmap);

            return(dt);
        }
Beispiel #25
0
        /// <summary>
        /// 请求服务器将记录数据转成Excel文件并返回路径给客户端。
        /// </summary>
        /// <param name="strIdList"></param>
        /// <param name="strDataType"></param>
        /// <param name="beginTime"></param>
        /// <param name="endTime"></param>
        /// <returns></returns>
        public string QueryDataAndMakeExcel(string strIdList, string strDataType, DateTime beginTime, DateTime endTime)
        {
            //组织输入参数
            anyType2anyTypeMapEntry[] requestData = new anyType2anyTypeMapEntry[]
            {
                Helper.XfireCreateKeyValue("dowhat", "QueryDataAndMakeExcel"),
                Helper.XfireCreateKeyValue("id", strIdList),
                Helper.XfireCreateKeyValue("datatype", strDataType),
                Helper.XfireCreateKeyValue("begin_year", beginTime.Year.ToString()),
                Helper.XfireCreateKeyValue("begin_month", beginTime.Month.ToString()),
                Helper.XfireCreateKeyValue("begin_day", beginTime.Day.ToString()),
                Helper.XfireCreateKeyValue("begin_hour", beginTime.Hour.ToString()),
                Helper.XfireCreateKeyValue("begin_minute", beginTime.Minute.ToString()),
                Helper.XfireCreateKeyValue("begin_second", beginTime.Second.ToString()),
                Helper.XfireCreateKeyValue("end_year", endTime.Year.ToString()),
                Helper.XfireCreateKeyValue("end_month", endTime.Month.ToString()),
                Helper.XfireCreateKeyValue("end_day", endTime.Day.ToString()),
                Helper.XfireCreateKeyValue("end_hour", endTime.Hour.ToString()),
                Helper.XfireCreateKeyValue("end_minute", endTime.Minute.ToString()),
                Helper.XfireCreateKeyValue("end_second", endTime.Second.ToString())
            };

            return(CreateDataTable(requestData).ToString());
        }
Beispiel #26
0
        /// <summary>
        /// 添加操作日志
        /// </summary>
        /// <param name="strUserID"></param>
        /// <param name="strOperateTime"></param>
        /// <param name="strOperateType"></param>
        /// <param name="strOperateObjName"></param>
        /// <param name="strOperateObjInfo"></param>
        public static void AddUserOperateLogRecord(string strUserID, string strOperateTime, string strOperateObjName, string strOperateType, string strOperateObjInfo)
        {
            int nCount = data.Count + 1;

            NameValueCollection values = new NameValueCollection();

            values.Add("_UserID", strUserID);
            values.Add("_OperateTime", strOperateTime);
            values.Add("_OperateType", strOperateType);
            values.Add("_OperateObjName", strOperateObjName);
            values.Add("_OperateObjInfo", strOperateObjInfo);

            data.Add("OperateLog_" + nCount.ToString(), values);

            if (nCount < 10)
            {
                return;
            }

            anyType2anyTypeMapEntry[][] logData = Helper.XfireConventDictionaryToMapEntry(data);

            service.Url = UserPermissionContext.Instance.Url;
            anyType2anyTypeMapEntry[] requestData = new anyType2anyTypeMapEntry[]
            {
                Helper.XfireCreateKeyValue("dowhat", "AppendOperateLog")
            };

            RetMapInVector result = ServiceClient.SubmitUnivData2(logData, requestData);

            data.Clear();

            if (!result.retbool)
            {
                throw new System.Net.WebException("调用WebService失败,请检查服务器");
            }
        }
Beispiel #27
0
        /// <summary>
        ///
        /// </summary>
        public static void SubmitUserOperateLogRecord()
        {
            if (data.Count <= 0)
            {
                return;
            }

            anyType2anyTypeMapEntry[][] logData = Helper.XfireConventDictionaryToMapEntry(data);

            service.Url = UserPermissionContext.Instance.Url;
            anyType2anyTypeMapEntry[] requestData = new anyType2anyTypeMapEntry[]
            {
                Helper.XfireCreateKeyValue("dowhat", "AppendOperateLog")
            };

            RetMapInVector result = ServiceClient.SubmitUnivData2(logData, requestData);

            data.Clear();

            if (!result.retbool)
            {
                throw new System.Net.WebException("调用WebService失败,请检查服务器");
            }
        }
        public IDictionary<string, NameValueCollection> Encrypt(string[] values)
        {
            anyType2anyTypeMapEntry[] requestData = new anyType2anyTypeMapEntry[values.Length + 1];
            requestData[0] = Helper.XfireCreateKeyValue("dowhat","encrypt");

            for (int i = 1; i <= values.Length; i++)
            {
                //requestData[i] = Helper.XfireCreateKeyValue("X" + i.ToString(), values[i - 1]);
                requestData[i] = Helper.XfireCreateKeyValue(values[i - 1],"");
            }

            this.service.Url = UserPermissionContext.Instance.Url;
            RetMapInVector result = ServiceClient.GetUnivData2(requestData);
            if (!result.retbool)
            {
                if (logger.IsErrorEnabled)
                {
                    logger.Error(result.estr);
                }
                throw new Exception(result.estr);
            }

            return Helper.XfireConventMapEntryToDictionary(result.vmap);
        }
        /// <summary>
        /// 
        /// </summary>
        /// <param name="id"></param>
        /// <param name="count"></param>
        /// <returns></returns>
        public DataTable Query1(MonitorTemplet templet, string id, int count)
        {
            anyType2anyTypeMapEntry[] requestData = new anyType2anyTypeMapEntry[]
                {
                    Helper.XfireCreateKeyValue("dowhat","QueryRecordsByCount"),
                    Helper.XfireCreateKeyValue("id",id),
                    Helper.XfireCreateKeyValue("count",count.ToString())
                };
                this.service.Url = UserPermissionContext.Instance.Url;
                RetMapInVector result = ServiceClient.GetForestData(requestData);
                //RetMapInVector result = this.service.GetForestData(requestData);

                if (!result.retbool)
                {
                    if (logger.IsWarnEnabled)
                    {
                        logger.Warn(result.estr);
                    }
                    if (measureTable != null) measureTable.Clear();
                    if (ImageTable != null) ImageTable.Clear();
                    if (primaryTable != null) primaryTable.Clear();
                    return null;
                }

                DataTable dt = CreateDataTable1(templet, result.vmap);
                return dt;
        }
Beispiel #30
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="monitors"></param>
        /// <returns></returns>
        public string[] BatchAddMonitors(ArrayList monitors)
        {
            //构造监测器数据
            IDictionary <string, NameValueCollection> data = new Dictionary <string, NameValueCollection>();

            int i = 0;

            foreach (NameValueCollection monitor in monitors)
            {
                string strTmp = "";
                foreach (string strKey in monitor.Keys)
                {
                    strTmp += ("monitor_" + strKey.Split(':')[0]);
                    strTmp += "_";
                    strTmp += i.ToString();

                    if (data.ContainsKey(strTmp))
                    {
                        data[strTmp][strKey.Split(':')[1]] = monitor[strKey];
                    }
                    else
                    {
                        data[strTmp] = new NameValueCollection();
                        data[strTmp][strKey.Split(':')[1]] = monitor[strKey];
                    }

                    strTmp = "";
                }

                i++;
            }

            anyType2anyTypeMapEntry[][] values = Helper.XfireConventDictionaryToMapEntry(data);

            anyType2anyTypeMapEntry[] requestData = new anyType2anyTypeMapEntry[]
            {
                Helper.XfireCreateKeyValue("dowhat", "AdvanceAddManyMonitor"),
                Helper.XfireCreateKeyValue("autoCreateTable", "true")
            };

            this.service.Url = UserPermissionContext.Instance.Url;
            int oldTimeout = this.service.Timeout;

            this.service.Timeout = 600000;

            RetMapInVector result = ServiceClient.SubmitUnivData2(values, requestData);

            if (!result.retbool)
            {
                if (logger.IsErrorEnabled)
                {
                    logger.Error(result.estr);
                }
                throw new System.Net.WebException("调用Web Service失败:" + result.estr);
            }

            IDictionary <string, NameValueCollection> resultData = Helper.XfireConventMapEntryToDictionary(result.vmap);

            string[] monitorids = new string[resultData["return"].Count - 1];
            i = 0;
            foreach (string id in resultData["return"].AllKeys)
            {
                if (id.ToLower() == "return")
                {
                    continue;
                }
                monitorids[i] = id;
                i             = i + 1;
            }

            this.service.Timeout = oldTimeout;

            return(monitorids);
        }
 public bool PushStringMessage(string queuename, string label, string content)
 {
     this.service.Url = UserPermissionContext.Instance.Url;
     anyType2anyTypeMapEntry[] requestData = new anyType2anyTypeMapEntry[]
     {
         Helper.XfireCreateKeyValue("dowhat","PushStringMessage"),
         Helper.XfireCreateKeyValue("queuename",queuename),
         Helper.XfireCreateKeyValue("label",label),
         Helper.XfireCreateKeyValue("content",content)
     };
     RetMapInVector result = ServiceClient.GetUnivData2(requestData);
     bool rs = false;
     if (result.retbool)
     {
         rs = true;
     }
     else
     {
         if (logger.IsWarnEnabled)
         {
             logger.Warn(result.estr);
         }
     }
     IDictionary<string, NameValueCollection> resultData = Helper.XfireConventMapEntryToDictionary(result.vmap);
     return rs;
 }
        public DataTable QueryRecordsByTime(
            string id,
            string begin_year,
            string begin_month,
            string begin_day,
            string begin_hour,
            string begin_minute,
            string begin_second,
            string end_year,
            string end_month,
            string end_day,
            string end_hour,
            string end_minute,
            string end_second)
        {
            anyType2anyTypeMapEntry[] requestData = new anyType2anyTypeMapEntry[14];
                requestData[0] = Helper.XfireCreateKeyValue("dowhat", "QueryRecordsByTime");
                requestData[1] = Helper.XfireCreateKeyValue("id", id);
                requestData[2] = Helper.XfireCreateKeyValue("begin_year", begin_year);
                requestData[3] = Helper.XfireCreateKeyValue("begin_month", begin_month);
                requestData[4] = Helper.XfireCreateKeyValue("begin_day", begin_day);
                requestData[5] = Helper.XfireCreateKeyValue("begin_hour", begin_hour);
                requestData[6] = Helper.XfireCreateKeyValue("begin_minute", begin_minute);
                requestData[7] = Helper.XfireCreateKeyValue("begin_second", begin_second);

                requestData[8] = Helper.XfireCreateKeyValue("end_year", end_year);
                requestData[9] = Helper.XfireCreateKeyValue("end_month", end_month);
                requestData[10] = Helper.XfireCreateKeyValue("end_day", end_day);
                requestData[11] = Helper.XfireCreateKeyValue("end_hour", end_hour);
                requestData[12] = Helper.XfireCreateKeyValue("end_minute", end_minute);
                requestData[13] = Helper.XfireCreateKeyValue("end_second", end_second);

                this.service.Url = UserPermissionContext.Instance.Url;
                RetMapInVector result = ServiceClient.GetForestData(requestData);
                //RetMapInVector result = this.service.GetForestData(requestData);
                if (!result.retbool)
                {
                    if (logger.IsErrorEnabled)
                    {
                        logger.Error(result.estr);
                    }
                    // ��������
            //#if DEBUG
            //                DataTable dttemp = new DataTable();
            //                dttemp.Columns.Add("No.");
            //                dttemp.Columns.Add("CreateTime");
            //                dttemp.Columns.Add("RecordState");
            //                dttemp.Columns.Add("_SysLogIndex");
            //                dttemp.Columns.Add("_SysLogTime");
            //                dttemp.Columns.Add("_SourceIp");
            //                dttemp.Columns.Add("_SysLogMsg");
            //                dttemp.Columns.Add("_Facility");
            //                dttemp.Columns.Add("_Level");
            //                dttemp.Columns.Add("dstr");
            //                for (int i = 1; i < 220; i++)
            //                {
            //                    DataRow row = dttemp.NewRow();
            //                    row["No."] = i.ToString();
            //                    row["CreateTime"] = "1";
            //                    row["RecordState"] = "1";
            //                    row["_SysLogIndex"] = "1";
            //                    row["_SysLogTime"] = "1";
            //                    row["_SourceIp"] = "192.168.0." + i.ToString();
            //                    row["_SysLogMsg"] = "1";
            //                    row["_Facility"] = "1";
            //                    row["_Level"] = "1";
            //                    row["dstr"] = "1";
            //                    dttemp.Rows.Add(row);
            //                }
            //                return dttemp;
            //#endif
                    return null;

                    // ���Խ���
                    //throw new Exception(result.estr);
                }

                //IDictionary<string, NameValueCollection> dict = Helper.XfireConventMapEntryToDictionary(result.vmap);

                return CreateDataTable(id, result.vmap);
        }
        public QueryAlertLogResult QueryAlertLog(AccessControl AccessInformation, AlertLogQueryCondition QueryCondition)
        {
            QueryAlertLogResult Result = new QueryAlertLogResult();
            if (QueryCondition.LimitTime)
            {
                anyType2anyTypeMapEntry[] requestData = new anyType2anyTypeMapEntry[]
               {
                Helper.XfireCreateKeyValue("dowhat","QueryRecordsByTime"),
                Helper.XfireCreateKeyValue("id","alertlogs"),
                Helper.XfireCreateKeyValue("begin_year",QueryCondition.StartTime.Year.ToString()),
                Helper.XfireCreateKeyValue("begin_month",QueryCondition.StartTime.Month.ToString()),
                Helper.XfireCreateKeyValue("begin_day",QueryCondition.StartTime.Day.ToString()),
                Helper.XfireCreateKeyValue("begin_hour",QueryCondition.StartTime.Hour.ToString()),
                Helper.XfireCreateKeyValue("begin_minute",QueryCondition.StartTime.Minute.ToString()),
                Helper.XfireCreateKeyValue("begin_second",QueryCondition.StartTime.Second.ToString()),
                Helper.XfireCreateKeyValue("end_year",QueryCondition.EndTime.Year.ToString()),
                Helper.XfireCreateKeyValue("end_month",QueryCondition.EndTime.Month.ToString()),
                Helper.XfireCreateKeyValue("end_day",QueryCondition.EndTime.Day.ToString()),
                Helper.XfireCreateKeyValue("end_hour",QueryCondition.EndTime.Hour.ToString()),
                Helper.XfireCreateKeyValue("end_minute",QueryCondition.EndTime.Minute.ToString()),
                Helper.XfireCreateKeyValue("end_second",QueryCondition.EndTime.Second.ToString())
              };
                this.service.Url = UserPermissionContext.Instance.Url;
                RetMapInVector result = ServiceClient.GetForestData(requestData);
                //RetMapInVector result = this.service.GetForestData(requestData);
                if (!result.retbool)
                {
                    if (logger.IsWarnEnabled)
                    {
                        logger.Warn(result.estr);
                    }
                    return null;
                }
                IList<NameValueCollection> resultData = Helper.XfireConventMapEntryToList(result.vmap);
            }
            else
            {

            }

            return Result;
        }
        public DataTable QueryRecordsByTime(
            string id,
            string begin_year,
            string begin_month,
            string begin_day,
            string begin_hour,
            string begin_minute,
            string begin_second,
            string end_year,
            string end_month,
            string end_day,
            string end_hour,
            string end_minute,
            string end_second)
        {
            anyType2anyTypeMapEntry[] requestData = new anyType2anyTypeMapEntry[14];
            requestData[0] = Helper.XfireCreateKeyValue("dowhat", "QueryRecordsByTime");
            requestData[1] = Helper.XfireCreateKeyValue("id", id);
            requestData[2] = Helper.XfireCreateKeyValue("begin_year", begin_year);
            requestData[3] = Helper.XfireCreateKeyValue("begin_month", begin_month);
            requestData[4] = Helper.XfireCreateKeyValue("begin_day", begin_day);
            requestData[5] = Helper.XfireCreateKeyValue("begin_hour", begin_hour);
            requestData[6] = Helper.XfireCreateKeyValue("begin_minute", begin_minute);
            requestData[7] = Helper.XfireCreateKeyValue("begin_second", begin_second);

            requestData[8]  = Helper.XfireCreateKeyValue("end_year", end_year);
            requestData[9]  = Helper.XfireCreateKeyValue("end_month", end_month);
            requestData[10] = Helper.XfireCreateKeyValue("end_day", end_day);
            requestData[11] = Helper.XfireCreateKeyValue("end_hour", end_hour);
            requestData[12] = Helper.XfireCreateKeyValue("end_minute", end_minute);
            requestData[13] = Helper.XfireCreateKeyValue("end_second", end_second);

            this.service.Url = UserPermissionContext.Instance.Url;
            RetMapInVector result = ServiceClient.GetForestData(requestData);

            //RetMapInVector result = this.service.GetForestData(requestData);
            if (!result.retbool)
            {
                if (logger.IsErrorEnabled)
                {
                    logger.Error(result.estr);
                }
                // ²âÊÔÊý¾Ý
                //#if DEBUG
                //                DataTable dttemp = new DataTable();
                //                dttemp.Columns.Add("No.");
                //                dttemp.Columns.Add("CreateTime");
                //                dttemp.Columns.Add("RecordState");
                //                dttemp.Columns.Add("_SysLogIndex");
                //                dttemp.Columns.Add("_SysLogTime");
                //                dttemp.Columns.Add("_SourceIp");
                //                dttemp.Columns.Add("_SysLogMsg");
                //                dttemp.Columns.Add("_Facility");
                //                dttemp.Columns.Add("_Level");
                //                dttemp.Columns.Add("dstr");
                //                for (int i = 1; i < 220; i++)
                //                {
                //                    DataRow row = dttemp.NewRow();
                //                    row["No."] = i.ToString();
                //                    row["CreateTime"] = "1";
                //                    row["RecordState"] = "1";
                //                    row["_SysLogIndex"] = "1";
                //                    row["_SysLogTime"] = "1";
                //                    row["_SourceIp"] = "192.168.0." + i.ToString();
                //                    row["_SysLogMsg"] = "1";
                //                    row["_Facility"] = "1";
                //                    row["_Level"] = "1";
                //                    row["dstr"] = "1";
                //                    dttemp.Rows.Add(row);
                //                }
                //                return dttemp;
                //#endif
                return(null);

                // ²âÊÔ½áÊø
                //throw new Exception(result.estr);
            }

            //IDictionary<string, NameValueCollection> dict = Helper.XfireConventMapEntryToDictionary(result.vmap);

            return(CreateDataTable(id, result.vmap));
        }
 private void Load()
 {
     anyType2anyTypeMapEntry[] requestData = new anyType2anyTypeMapEntry[]
     {
         Helper.XfireCreateKeyValue("dowhat","LoadResource"),
         Helper.XfireCreateKeyValue("language",this.language)
     };
     this.service.Url = UserPermissionContext.Instance.Url;
     RetMapInVector result = ServiceClient.GetUnivData2(requestData);
     if (!result.retbool)
     {
         if (logger.IsErrorEnabled)
         {
             logger.Error(result.estr);
         }
         throw new Exception(result.estr);
     }
     IDictionary<string,NameValueCollection> data = Helper.XfireConventMapEntryToDictionary(result.vmap);
     this.resource = data["property"];
 }
        /// <summary>
        /// 
        /// </summary>
        public static void SubmitUserOperateLogRecord()
        {
            if (data.Count <= 0)
                return;

            anyType2anyTypeMapEntry[][] logData = Helper.XfireConventDictionaryToMapEntry(data);

            service.Url = UserPermissionContext.Instance.Url;
            anyType2anyTypeMapEntry[] requestData = new anyType2anyTypeMapEntry[]
            {
                Helper.XfireCreateKeyValue("dowhat","AppendOperateLog")
            };

            RetMapInVector result = ServiceClient.SubmitUnivData2(logData, requestData);

            data.Clear();

            if (!result.retbool)
            {
                throw new System.Net.WebException("����WebServiceʧ�ܣ����������");
            }
        }
        /// <summary>
        /// ͨ��WebService������ �������� ����֯��DataTable
        /// </summary>
        /// <param name="requestData"></param>
        /// <returns></returns>
        private DataTable CreateDataTable(anyType2anyTypeMapEntry[] requestData)
        {
            //ͨ��WebService������
            this.service.Url = UserPermissionContext.Instance.Url;

            RetMapInVector result = ServiceClient.GetUnivData2(requestData);
            if (!result.retbool)
            {
                if (logger.IsErrorEnabled)
                {
                    logger.Error(result.estr);
                }
                throw new Exception(result.estr);
            }

            //�������ݲ���֯��DataTable
            DataTable runTable = new DataTable();
            runTable.Columns.Add("����");
            runTable.Columns.Add("����(%)");
            runTable.Columns.Add("��(%)");
            runTable.Columns.Add("����(%)");
            runTable.Columns.Add("��ֵ");
            runTable.Columns.Add("����״̬");
            runTable.Columns.Add("���һ������");

            //��ô��ʾhashKey�����? ...
            DataTable statTable = new DataTable();
            statTable.Columns.Add("hashKey");
            statTable.Columns.Add("����");
            statTable.Columns.Add("����ֵ����");
            statTable.Columns.Add("���ֵ");
            statTable.Columns.Add("��Сֵ");
            statTable.Columns.Add("ƽ��ֵ");
            statTable.Columns.Add("���һ��");
            statTable.Columns.Add("���ֵʱ��");

            DataTable m_dstrTable = new DataTable();
            m_dstrTable.Columns.Add("����");
            m_dstrTable.Columns.Add("ʱ��");
            m_dstrTable.Columns.Add("״̬");
            m_dstrTable.Columns.Add("����ֵ");

            string[] strFilters = strFilter.Split(',');

            DataRow dr = null;
            IDictionary<string, DataTable> hashImgTable = new Dictionary<string, DataTable>();

            IDictionary<string, NameValueCollection> resultData = Helper.XfireConventMapEntryToDictionary(result.vmap);
            foreach (string key in resultData.Keys)
            {
                if (key.StartsWith("(Return"))
                {
                    //��ô��֯ͳ�Ʊ��� �� dstr��� �ı���ʽ��? ... --> StatReportר��

                    //��ô���ݷ���ֵ��sv_primary����������? ...--> ��̨����Щ���Է���������ʱֻ��ֵΪ 1 + and ��ϵ
                    bool bFilter = false;
                    if (!strFilter.Equals(""))
                    {
                        foreach (string strTmp in strFilters)
                        {
                            if (!resultData[key][strTmp].Equals("1"))
                            {
                                bFilter = true;
                                break;
                            }
                        }
                    }
                    else
                    {
                        //strFilter Ϊ�������з���ֵ������
                    }

                    if (bFilter)
                        continue;

                    //���ͳ�Ʊ�

                    string strImageData = resultData[key]["detail"].ToString();
                    if (strImageData == "")
                        continue;

                    dr = statTable.NewRow();
                    //����  ����ֵ����  ���  ƽ��  ���һ��
                    //latest max min MonitorName ReturnName average
                    //dr["monitorid"] = key;
                    dr["hashKey"] = key; //hashKey ��ǰ̨�ÿؼ����β���ʾ����
                    dr["����"] = resultData[key]["MonitorName"].ToString();
                    dr["����ֵ����"] = resultData[key]["ReturnName"].ToString();
                    dr["���ֵ"] = resultData[key]["max"].ToString();
                    dr["��Сֵ"] = resultData[key]["min"].ToString();
                    dr["ƽ��ֵ"] = resultData[key]["average"].ToString();
                    dr["���һ��"] = resultData[key]["latest"].ToString();
                    dr["���ֵʱ��"] = resultData[key]["when_max"].ToString();

                    statTable.Rows.Add(dr);

                    //ͼƬ���ݱ�
                    //monitorid -> value = ReturnValue -> key detail time=value
                    string []imgDatas = strImageData.Split(',');

                    hashImgTable.Add(key, new DataTable());
                    //hashImgTable[key] = new DataTable();
                    DataColumn column = null;
                    column = new DataColumn();
                    column.DataType = System.Type.GetType("System.DateTime");
                    column.ColumnName = "ʱ��";
                    hashImgTable[key].Columns.Add(column);

                    column = new DataColumn();
                    column.DataType = System.Type.GetType("System.Single");
                    column.ColumnName = resultData[key]["ReturnName"].ToString();
                    hashImgTable[key].Columns.Add(column);

                    foreach (string strImg in imgDatas)
                    {
                        string[] strTmps = strImg.Split('=');

                        if(strTmps.Length == 2)
                        {
                            //����ֵ���ַ�����ô����? ...--> ��̨�Ѿ�������(�ַ����ͷ���ֵû�з�������)

                            dr = hashImgTable[key].NewRow();
                            dr["ʱ��"] = strTmps[0];

                            if (strTmps[1].StartsWith("(status)"))
                                dr[resultData[key]["ReturnName"].ToString()] = "0";
                            else
                                dr[resultData[key]["ReturnName"].ToString()] = float.Parse(strTmps[1]);

                            hashImgTable[key].Rows.Add(dr);
                        }
                    }
                }
                else if (key.StartsWith("(dstr"))
                {
                    //dstr ��
                    //monitor���� + ʱ�� + dstr
                    string strName = resultData[key]["MonitorName"];
                    foreach (string strKey in resultData[key].AllKeys)
                    {
                        if (strKey != "MonitorName")
                        {
                            dr = m_dstrTable.NewRow();
                            dr["����"] = strName;
                            dr["ʱ��"] = strKey;
                            dr["״̬"] = resultData[key][strKey].ToString().Substring(0, 8).Trim();
                            dr["����ֵ"] = resultData[key][strKey].ToString().Substring(7).Trim();
                            m_dstrTable.Rows.Add(dr);
                        }
                    }
                }
                else
                {
                    //
                    if (key.Equals("return"))
                        continue;

                    //���������
                    //����  ����(%)  Σ��(%)  ����(%)  ��ֵ
                    //monitorid -> MonitorName errorCondition errorPercent latestStatus okPercent warnPercent
                    dr = runTable.NewRow();
                    //dr["monitorid"] = key;
                    dr["����"] = resultData[key]["MonitorName"].ToString();
                    dr["����(%)"] = resultData[key]["okPercent"].ToString();
                    dr["��(%)"] = resultData[key]["warnPercent"].ToString();
                    dr["����(%)"] = resultData[key]["errorPercent"].ToString();
                    dr["��ֵ"] = resultData[key]["errorCondition"].ToString();
                    dr["����״̬"] = resultData[key]["latestStatus"].ToString();
                    dr["���һ������"] = resultData[key]["latestDstr"].ToString();

                    runTable.Rows.Add(dr);
                }
            }

            //
            this.imgTables = hashImgTable;
            this.measureTable = statTable;
            this.primaryTable = runTable;
            this.dstrTable = m_dstrTable;

            return runTable;
        }
        /// <summary>
        /// QueryReportData
        /// </summary>
        /// <param name="strIdList"></param>
        /// <param name="bCompress"></param>
        /// <param name="beginTime"></param>
        /// <param name="endTime"></param>
        /// <returns></returns>
        public IDictionary<string, NameValueCollection> QueryTopnMonitorInfo()
        {
            //��֯�������
            anyType2anyTypeMapEntry[] requestData = new anyType2anyTypeMapEntry[]
            {
                Helper.XfireCreateKeyValue("dowhat","QueryInfo"),
                Helper.XfireCreateKeyValue("needkey","sv_monitortype,sv_name"),
                Helper.XfireCreateKeyValue("needtype","monitor")
            };

            //ͨ��WebService������
            this.service.Url = UserPermissionContext.Instance.Url;

            RetMapInVector result = ServiceClient.GetUnivData2(requestData);
            if (!result.retbool)
            {
                if (logger.IsErrorEnabled)
                {
                    logger.Error(result.estr);
                }
                throw new Exception(result.estr);
            }

            IDictionary<string, NameValueCollection> resultData = Helper.XfireConventMapEntryToDictionary(result.vmap);

            //ͳ���������õļ�������� �� ѡ��������� + ѡ�����ָ��ļ���ʾ ...
            IMonitorTempletDao templetDao = new MonitorTempletDaoImpl();

            IDictionary<string, MonitorTemplet> topnMontiorTemplet = new Dictionary<string, MonitorTemplet>();
            try
            {
                foreach (string key in resultData.Keys)
                {
                    if (resultData[key]["sv_monitortype"] == null)
                        continue;

                    if (!topnMontiorTemplet.ContainsKey(resultData[key]["sv_monitortype"]))
                    {
                        string strTemplateId = resultData[key]["sv_monitortype"];

                        //MonitorTemplet templet = templetDao.FindById(resultData[key]["sv_monitortype"]);
                        //MonitorTemplet[] templet = templetDao.FindById(new string[] { resultData[key]["sv_monitortype"] }, true);
                        MonitorTemplet[] templet = templetDao.FindById(new string[] { resultData[key]["sv_monitortype"] }, false);
                        topnMontiorTemplet.Add(resultData[key]["sv_monitortype"], templet[0]);

                        ////���������(��FindById true ����ʵ��ѡָ��)
                        //string strTmp = topnMontiorTemplet[resultData[key]["sv_monitortype"]].Name;

                        //foreach (string key1 in topnMontiorTemplet[resultData[key]["sv_monitortype"]].Returns.Keys)
                        //{
                        //    //���ָ��
                        //    strTmp = topnMontiorTemplet[resultData[key]["sv_monitortype"].ToString()].Returns[key1]["sv_label"];
                        //}
                    }
                }
            }
            catch (Exception e)
            {
                ;
            }

            return resultData;
        }
Beispiel #39
0
        /// <summary>
        /// QueryReportData
        /// </summary>
        /// <param name="strIdList"></param>
        /// <param name="bCompress"></param>
        /// <param name="beginTime"></param>
        /// <param name="endTime"></param>
        /// <returns></returns>
        public IDictionary <string, NameValueCollection> QueryTopnMonitorInfo()
        {
            //组织输入参数
            anyType2anyTypeMapEntry[] requestData = new anyType2anyTypeMapEntry[]
            {
                Helper.XfireCreateKeyValue("dowhat", "QueryInfo"),
                Helper.XfireCreateKeyValue("needkey", "sv_monitortype,sv_name"),
                Helper.XfireCreateKeyValue("needtype", "monitor")
            };

            //通过WebService查数据
            this.service.Url = UserPermissionContext.Instance.Url;

            RetMapInVector result = ServiceClient.GetUnivData2(requestData);

            if (!result.retbool)
            {
                if (logger.IsErrorEnabled)
                {
                    logger.Error(result.estr);
                }
                throw new Exception(result.estr);
            }


            IDictionary <string, NameValueCollection> resultData = Helper.XfireConventMapEntryToDictionary(result.vmap);


            //统计所有已用的监测器类型 及 选监测器类型 + 选监测器指标的简单演示 ...
            IMonitorTempletDao templetDao = new MonitorTempletDaoImpl();

            IDictionary <string, MonitorTemplet> topnMontiorTemplet = new Dictionary <string, MonitorTemplet>();

            try
            {
                foreach (string key in resultData.Keys)
                {
                    if (resultData[key]["sv_monitortype"] == null)
                    {
                        continue;
                    }

                    if (!topnMontiorTemplet.ContainsKey(resultData[key]["sv_monitortype"]))
                    {
                        string strTemplateId = resultData[key]["sv_monitortype"];

                        //MonitorTemplet templet = templetDao.FindById(resultData[key]["sv_monitortype"]);
                        //MonitorTemplet[] templet = templetDao.FindById(new string[] { resultData[key]["sv_monitortype"] }, true);
                        MonitorTemplet[] templet = templetDao.FindById(new string[] { resultData[key]["sv_monitortype"] }, false);
                        topnMontiorTemplet.Add(resultData[key]["sv_monitortype"], templet[0]);

                        ////监测器类型(用FindById true 即可实现选指标)
                        //string strTmp = topnMontiorTemplet[resultData[key]["sv_monitortype"]].Name;

                        //foreach (string key1 in topnMontiorTemplet[resultData[key]["sv_monitortype"]].Returns.Keys)
                        //{
                        //    //监测指标
                        //    strTmp = topnMontiorTemplet[resultData[key]["sv_monitortype"].ToString()].Returns[key1]["sv_label"];
                        //}
                    }
                }
            }
            catch (Exception e)
            {
                ;
            }

            return(resultData);
        }
Beispiel #40
0
        /// <summary>
        /// 
        /// </summary>
        /// <param name="task"></param>
        public void Update(Task task)
        {
            anyType2anyTypeMapEntry[] requestData = new anyType2anyTypeMapEntry[]
            {
                Helper.XfireCreateKeyValue("dowhat","SubmitTask"),
                Helper.XfireCreateKeyValue("del_supplement","true")
            };

            IDictionary<string, NameValueCollection> taskData = new Dictionary<string, NameValueCollection>();
            taskData["property"] = task.Properties;
            taskData["return"] = new NameValueCollection();
            taskData["return"]["id"] = task.Name;
            this.service.Url=UserPermissionContext.Instance.Url;
            RetMapInVector result = ServiceClient.SubmitUnivData2(Helper.XfireConventDictionaryToMapEntry(taskData), requestData);
            if (!result.retbool)
            {
                if (logger.IsErrorEnabled)
                {
                    logger.Error(result.estr);
                }
                throw new Exception(result.estr);
            }
        }
Beispiel #41
0
        /// <summary>
        /// 
        /// </summary>
        /// <param name="task"></param>
        public Task FindByName(string name)
        {
            Task task = new Task();
            anyType2anyTypeMapEntry[] requestData = new anyType2anyTypeMapEntry[]
            {
                Helper.XfireCreateKeyValue("dowhat","GetTask"),
                Helper.XfireCreateKeyValue("id",name)
            };
            this.service.Url = UserPermissionContext.Instance.Url;
            RetMapInVector result = ServiceClient.GetUnivData2(requestData);
            IDictionary<string, NameValueCollection> resultData = Helper.XfireConventMapEntryToDictionary(result.vmap);

            task.Properties = resultData["property"];
            task.Name = name;

            return task;
        }
        /// <summary>
        /// 1
        /// </summary>
        /// <param name="templet"></param>
        /// <param name="id"></param>
        /// <param name="beginTime"></param>
        /// <param name="endTime"></param>
        /// <param name="tj"></param>
        /// <returns></returns>
        public DataTable Query1(MonitorTemplet templet, string id, DateTime beginTime, DateTime endTime)
        {
            anyType2anyTypeMapEntry[] requestData = new anyType2anyTypeMapEntry[]
                {
                    Helper.XfireCreateKeyValue("dowhat","QueryRecordsByTime"),
                    Helper.XfireCreateKeyValue("id",id),
                    Helper.XfireCreateKeyValue("begin_year",beginTime.Year.ToString()),
                    Helper.XfireCreateKeyValue("begin_month",beginTime.Month.ToString()),
                    Helper.XfireCreateKeyValue("begin_day",beginTime.Day.ToString()),
                    Helper.XfireCreateKeyValue("begin_hour",beginTime.Hour.ToString()),
                    Helper.XfireCreateKeyValue("begin_minute",beginTime.Minute.ToString()),
                    Helper.XfireCreateKeyValue("begin_second",beginTime.Second.ToString()),
                    Helper.XfireCreateKeyValue("end_year",endTime.Year.ToString()),
                    Helper.XfireCreateKeyValue("end_month",endTime.Month.ToString()),
                    Helper.XfireCreateKeyValue("end_day",endTime.Day.ToString()),
                    Helper.XfireCreateKeyValue("end_hour",endTime.Hour.ToString()),
                    Helper.XfireCreateKeyValue("end_minute",endTime.Minute.ToString()),
                    Helper.XfireCreateKeyValue("end_second",endTime.Second.ToString())
                };
                this.service.Url = UserPermissionContext.Instance.Url;
                RetMapInVector result = ServiceClient.GetForestData(requestData);
                //RetMapInVector result = this.service.GetForestData(requestData);

                if (!result.retbool)
                {
                    if (logger.IsWarnEnabled)
                    {
                        logger.Warn(result.estr);
                    }
                    return null;
                }

                DataTable dt = CreateDataTable1(templet, result.vmap);
                return dt;
        }
        /// <summary>
        /// QueryTopnDevInfo
        /// </summary>
        /// <param name="strIdList"></param>
        /// <param name="bCompress"></param>
        /// <param name="beginTime"></param>
        /// <param name="endTime"></param>
        /// <returns></returns>
        public IDictionary<string, NameValueCollection> QueryTopnDevInfo()
        {
            //��֯�������
            anyType2anyTypeMapEntry[] requestData = new anyType2anyTypeMapEntry[]
            {
                Helper.XfireCreateKeyValue("dowhat","QueryInfo"),
                Helper.XfireCreateKeyValue("needkey","sv_name"),
                Helper.XfireCreateKeyValue("needtype","entity")
            };

            //ͨ��WebService������
            this.service.Url = UserPermissionContext.Instance.Url;

            RetMapInVector result = ServiceClient.GetUnivData2(requestData);
            if (!result.retbool)
            {
                if (logger.IsErrorEnabled)
                {
                    logger.Error(result.estr);
                }
                throw new Exception(result.estr);
            }

            IDictionary<string, NameValueCollection> resultData = Helper.XfireConventMapEntryToDictionary(result.vmap);

            return resultData;
        }
        /// <summary>
        /// 1
        /// </summary>
        /// <param name="templet"></param>
        /// <param name="data"></param>
        /// <returns></returns>
        public DataTable CreateDataTable1(MonitorTemplet templet, anyType2anyTypeMapEntry[][] data)
        {
            DataTable Primarydt = new DataTable();
                DataTable Measuredt = new DataTable();
                DataTable Imgdt = new DataTable();
                Imgdt.Columns.Add(new DataColumn("ʱ��", typeof(DateTime)));
                Imgdt.Columns.Add(new DataColumn("��¼״̬", typeof(String)));
                Imgdt.Columns.Add(new DataColumn("����", typeof(String)));
                NameValueCollection ImgTextName = new NameValueCollection();
                ImgTextName.Add("creat_time", "ʱ��");
                ImgTextName.Add("record_status", "��¼״̬");
                ImgTextName.Add("dstr", "����");
                int j = 0;
                foreach (NameValueCollection returnItem in templet.Returns.Values)
                {
                    if (returnItem.Get("sv_drawimage") != null)
                    {
                        if (j < 1)
                        {
                            if ((returnItem["sv_drawimage"] == "1") && (returnItem["sv_primary"] == "1"))
                            {
                                headtitle = returnItem["sv_label"];
                                ImgTextName.Add(returnItem["sv_name"], returnItem["sv_label"]);
                                Imgdt.Columns.Add(new DataColumn(returnItem["sv_label"], typeof(Double)));
                                j = j + 1;
                            }
                        }
                    }
                }

                NameValueCollection PrimaryTextName = new NameValueCollection();
                NameValueCollection MeasureTextName = new NameValueCollection();

                Primarydt.Columns.Add(new DataColumn("����", typeof(String)));
                Primarydt.Columns.Add(new DataColumn("ʱ��", typeof(DateTime)));
                Primarydt.Columns.Add(new DataColumn("��¼״̬", typeof(String)));
                PrimaryTextName.Add("creat_time", "ʱ��");
                PrimaryTextName.Add("record_status", "��¼״̬");

                Measuredt.Columns.Add(new DataColumn("record_status", typeof(String)));
                MeasureTextName.Add("record_status", "��¼״̬");

                foreach (NameValueCollection returnItem in templet.Returns.Values)
                {
                    if (returnItem.Get("sv_primary") != null)
                    {
                        if (returnItem["sv_primary"] == "1")
                        {
                            PrimaryTextName.Add(returnItem["sv_name"], returnItem["sv_label"]);
                            Primarydt.Columns.Add(new DataColumn(returnItem["sv_label"], typeof(Double)));
                        }
                    }
                    // sv_drawmeasure
                    if (returnItem.Get("sv_drawimage") != null)
                    {
                        if (returnItem["sv_drawimage"] == "1")
                        {
                            if (returnItem["sv_name"] != null)
                            {
                                MeasureTextName.Add(returnItem["sv_name"], returnItem["sv_label"]);
                                Measuredt.Columns.Add(new DataColumn(returnItem["sv_name"], typeof(Double)));
                            }
                        }
                    }
                }

                DataRow dr = null;
                IList<NameValueCollection> resultData = Helper.XfireConventMapEntryToList(data);

                foreach (NameValueCollection nameValueCollection in resultData)
                {
                    dr = Primarydt.NewRow();
                    dr["����"] = string.IsNullOrEmpty(this.Name) ? "" : this.Name;
                    foreach (string key in nameValueCollection.AllKeys)
                    {
                        if (PrimaryTextName.Get(key) != null)
                        {
                            string clumnname = PrimaryTextName[key];
                            if (Primarydt.Columns[clumnname].DataType.Equals(typeof(Double)))
                            {
                                double value = 0;
                                Double.TryParse(nameValueCollection[key], out value);
                                dr[clumnname] = value;
                            }
                            else
                            {
                                dr[clumnname] = nameValueCollection[key];
                            }
                        }
                    }
                    Primarydt.Rows.Add(dr);
                }
                //foreach (MapType map in data)
                //{
                //    dr = Primarydt.NewRow();
                //    dr["����"] = string.IsNullOrEmpty(this.Name) ? "" : this.Name;
                //    foreach (KeyValue keyvalue in map.Map)
                //    {
                //        if (PrimaryTextName.Get(keyvalue.Key) != null)
                //        {
                //            string clumnname = PrimaryTextName[keyvalue.Key];
                //            if (Primarydt.Columns[clumnname].DataType.Equals(typeof(Double)))
                //            {
                //                double value = 0;
                //                Double.TryParse(keyvalue.Value, out value);
                //                dr[clumnname] = value;
                //            }
                //            else
                //            {
                //                dr[clumnname] = keyvalue.Value;
                //            }
                //        }
                //    }
                //    Primarydt.Rows.Add(dr);
                //}
                //foreach (NameValueCollection nameValueCollection in resultData)
                //{
                //    dr = dt.NewRow();
                //    dr["����"] = this.Name;
                //    foreach (string key in nameValueCollection.AllKeys)
                //    {
                //        string clumnname = TextName[key];
                //        if (dt.Columns[clumnname].DataType.Equals(typeof(Double)))
                //        {
                //            double value = 0;
                //            Double.TryParse(nameValueCollection[key], out value);
                //            dr[clumnname] = value;
                //        }
                //        else
                //        {
                //            dr[clumnname] = nameValueCollection[key];
                //        }
                //    }
                //    dt.Rows.Add(dr);
                //}

                DataRow dr1 = null;
                foreach (NameValueCollection nameValueCollection in resultData)
                {
                    dr1 = Measuredt.NewRow();
                    for (int i = 0; i < Measuredt.Columns.Count; i++)
                    {
                        dr1[i] = 0.00;
                    }
                    bool rowadd = false;
                    foreach (string key in nameValueCollection.AllKeys)
                    {
                        if (MeasureTextName.Get(key) != null)
                        {
                            if (Measuredt.Columns[key].DataType.Equals(typeof(Double)))
                            {
                                double value = 0;
                                rowadd = Double.TryParse(nameValueCollection[key], out value);
                                dr1[key] = value;
                            }
                            else
                            {
                                dr1[key] = nameValueCollection[key];
                            }
                            //if (nameValueCollection[key].Equals("ok"))
                            //{
                            //    rowadd = true;
                            //}
                        }

                    }
                    if (rowadd)
                    {
                        Measuredt.Rows.Add(dr1);
                    }
                }

                foreach (NameValueCollection nameValueCollection in resultData)
                {
                    dr1 = Imgdt.NewRow();
                    foreach (string key in nameValueCollection.Keys)
                    {
                        if (ImgTextName.Get(key) != null)
                        {
                            string clumnname = ImgTextName[key];
                            if (Imgdt.Columns[clumnname].DataType.Equals(typeof(Double)))
                            {
                                double value = 0;
                                Double.TryParse(nameValueCollection[key], out value);
                                dr1[clumnname] = value;
                            }
                            else
                            {
                                dr1[clumnname] = nameValueCollection[key];
                            }
                        }
                    }
                    Imgdt.Rows.Add(dr1);
                }

                //DataRow dr1 = null;
                //foreach (MapType map in data)
                //{
                //    dr1 = Measuredt.NewRow();
                //    for (int i = 0; i < Measuredt.Columns.Count; i++)
                //    {
                //        dr1[i] = 0.00;
                //    }
                //    bool rowadd = false;
                //    foreach (KeyValue keyvalue in map.Map)
                //    {
                //        if (MeasureTextName.Get(keyvalue.Key) != null)
                //        {
                //            if (Measuredt.Columns[keyvalue.Key].DataType.Equals(typeof(Double)))
                //            {
                //                double value = 0;
                //                Double.TryParse(keyvalue.Value, out value);
                //                dr1[keyvalue.Key] = value;
                //            }
                //            else
                //            {
                //                dr1[keyvalue.Key] = keyvalue.Value;
                //            }
                //            if (keyvalue.Value.Equals("ok"))
                //            {
                //                rowadd = true;
                //            }
                //        }

                //    }
                //    if (rowadd)
                //    {
                //        Measuredt.Rows.Add(dr1);
                //    }
                //}

                if (Measuredt.Rows.Count == 0)
                {
                    DataRow dr2 = null;
                    dr2 = Measuredt.NewRow();
                    foreach (string key in MeasureTextName.Keys)
                    {
                        if (string.IsNullOrEmpty(key)) { continue; }
                        if (Measuredt.Columns[key].DataType.Equals(typeof(Double)))
                        {
                            dr2[key] = 0.0;
                        }
                        else
                        {
                            dr2[key] = MeasureTextName[key];
                        }
                    }
                    Measuredt.Rows.Add(dr2);
                }

                this.PrimaryTable = Primarydt;
                this.MeasureTable = Measuredt;
                this.ImgTable = Imgdt;
                return Primarydt;
        }
        /// <summary>
        /// ɾ��ָ������ָ��ʱ����ǰ�ļ�¼
        /// </summary>
        public static IDictionary<string, NameValueCollection> DeleteTableRecords(string strTableId, DateTime tmFrom)
        {
            //��֯�������
            anyType2anyTypeMapEntry[] requestData = new anyType2anyTypeMapEntry[]
            {
                Helper.XfireCreateKeyValue("dowhat","DeleteRecords"),
                Helper.XfireCreateKeyValue("id",strTableId),
                Helper.XfireCreateKeyValue("year",tmFrom.Year.ToString()),
                Helper.XfireCreateKeyValue("month",tmFrom.Month.ToString()),
                Helper.XfireCreateKeyValue("day",tmFrom.Day.ToString()),
                Helper.XfireCreateKeyValue("hour",tmFrom.Hour.ToString()),
                Helper.XfireCreateKeyValue("minute",tmFrom.Minute.ToString()),
                Helper.XfireCreateKeyValue("second",tmFrom.Second.ToString())
            };

            //ͨ��WebService������
            service.Url = UserPermissionContext.Instance.Url;

            RetMapInVector result = ServiceClient.GetUnivData2(requestData);
            if (!result.retbool)
            {
                throw new Exception(result.estr);
            }

            IDictionary<string, NameValueCollection> resultData = Helper.XfireConventMapEntryToDictionary(result.vmap);

            return resultData;
        }
        public QueryAlertLogResult QueryAlertLog(AccessControl AccessInformation, AlertLogQueryCondition QueryCondition)
        {
            QueryAlertLogResult queryAlertLogResult = new QueryAlertLogResult();
            //dowhat= QueryAlertLog,
            //begin_year= XXX,
            //begin_month= XXX,
            //begin_day= XXX,
            //begin_hour= XXX,
            //begin_minute= XXX,
            //begin_second= XXX,
            //end_year= XXX,
            //end_month= XXX,
            //end_day= XXX,
            //end_hour= XXX,
            //end_minute= XXX,
            //end_second= XXX,
            //alertName= XXX,
            //alertReceive= XXX,
            //alertType= XXX;
            ////alertName��alertReceive��alertType �� and ��ϵ�����Ϊ����Ϊȫ����

            SortedDictionary<string, string> paras = new SortedDictionary<string,string>();

            paras.Add("dowhat","QueryAlertLog");
            paras.Add("begin_year",QueryCondition.StartTime.Year.ToString());
            paras.Add("begin_month",QueryCondition.StartTime.Month.ToString());
            paras.Add("begin_day",QueryCondition.StartTime.Day.ToString());
            paras.Add("begin_hour",QueryCondition.StartTime.Hour.ToString());
            paras.Add("begin_minute",QueryCondition.StartTime.Minute.ToString());
            paras.Add("begin_second",QueryCondition.StartTime.Second.ToString());
            paras.Add("end_year",QueryCondition.EndTime.Year.ToString());
            paras.Add("end_month",QueryCondition.EndTime.Month.ToString());
            paras.Add("end_day",QueryCondition.EndTime.Day.ToString());
            paras.Add("end_hour",QueryCondition.EndTime.Hour.ToString());
            paras.Add("end_minute",QueryCondition.EndTime.Minute.ToString());
            paras.Add("end_second",QueryCondition.EndTime.Second.ToString());

            if(QueryCondition.LimitName)
            {
                paras.Add("alertName", QueryCondition.AlertName);
            }

            if(QueryCondition.LimitReceiver)
            {
                paras.Add("alertReceive", QueryCondition.AlertReceiver);
            }

            if(QueryCondition.LimitType)
            {
                paras.Add("alertType", QueryCondition.AlertType.ToString("D"));
            }
            if (QueryCondition.LimitIndex)
            {
                paras.Add("alertIndex", QueryCondition.AlertIndex);
            }

            anyType2anyTypeMapEntry[] requestData = new anyType2anyTypeMapEntry[paras.Count];

            int i = 0;
            foreach(string key in paras.Keys)
            {
                anyType2anyTypeMapEntry node = Helper.XfireCreateKeyValue(key, paras[key]);
                requestData[i++] = node;
            }

            this.service.Url = UserPermissionContext.Instance.Url;
            RetMapInVector result = ServiceClient.GetForestData(requestData);
            //RetMapInVector result = this.service.GetForestData(requestData);
            if (!result.retbool)
            {
                if (logger.IsWarnEnabled)
                {
                    logger.Warn(result.estr);
                }
                return null;
            }

            queryAlertLogResult.ErrorInformation = result.estr;
            queryAlertLogResult.QueryAlertLogOK = result.retbool;

            IList<NameValueCollection> resultData = Helper.XfireConventMapEntryToList(result.vmap);
            AlertLogItem[] responseData = new AlertLogItem[resultData.Count];
            for (int j = 0; j < resultData.Count; j++)
            {
                NameValueCollection record = resultData[j];
                AlertLogItem item = new AlertLogItem();
                item.AlertIndex = record["_AlertIndex"];
                item.AlertName = record["_AlertRuleName"];
                item.EntityName = record["_DeviceName"];
                item.MonitorName = record["_MonitorName"];
                item.AlertReceiver = record["_AlertReceive"];
                item.AlertStatus = (AlertStatus)Enum.Parse(typeof(AlertStatus), record["_AlertStatus"]);
                item.AlertTime = DateTime.Parse(record["_AlertTime"]);
                item.AlertType = (AlertType)Enum.Parse(typeof(AlertType), record["_AlertType"]);

                responseData[j] = item;

            }

            queryAlertLogResult.ResponseData = responseData;

            return queryAlertLogResult;
        }
        /// <summary>
        /// QueryReportData
        /// </summary>
        /// <param name="strIdList"></param>
        /// <param name="bCompress"></param>
        /// <param name="beginTime"></param>
        /// <param name="endTime"></param>
        /// <returns></returns>
        public DataTable QueryReportData(string strIdList, bool bCompress, bool bDstrNeed, DateTime beginTime, DateTime endTime)
        {
            //��֯�������
            anyType2anyTypeMapEntry[] requestData = new anyType2anyTypeMapEntry[]
            {
                Helper.XfireCreateKeyValue("dowhat","QueryReportData"),
                Helper.XfireCreateKeyValue("id",strIdList),
                Helper.XfireCreateKeyValue("compress",bCompress?"true":"false"),
                Helper.XfireCreateKeyValue("dstrNeed",bDstrNeed?"true":"false"),
                Helper.XfireCreateKeyValue("begin_year",beginTime.Year.ToString()),
                Helper.XfireCreateKeyValue("begin_month",beginTime.Month.ToString()),
                Helper.XfireCreateKeyValue("begin_day",beginTime.Day.ToString()),
                Helper.XfireCreateKeyValue("begin_hour",beginTime.Hour.ToString()),
                Helper.XfireCreateKeyValue("begin_minute",beginTime.Minute.ToString()),
                Helper.XfireCreateKeyValue("begin_second",beginTime.Second.ToString()),
                Helper.XfireCreateKeyValue("end_year",endTime.Year.ToString()),
                Helper.XfireCreateKeyValue("end_month",endTime.Month.ToString()),
                Helper.XfireCreateKeyValue("end_day",endTime.Day.ToString()),
                Helper.XfireCreateKeyValue("end_hour",endTime.Hour.ToString()),
                Helper.XfireCreateKeyValue("end_minute",endTime.Minute.ToString()),
                Helper.XfireCreateKeyValue("end_second",endTime.Second.ToString())
            };

            return CreateDataTable(requestData);
        }
        /// <summary>
        /// SmsTestByDll
        /// </summary>
        /// <param name="strPhoneNumber"></param>
        /// <param name="strParameter"></param>
        /// <param name="strDllName"></param>
        /// <returns></returns>
        public bool SmsTestByDll(string strPhoneNumber, string strDllName, string strParameter)
        {
            //��֯�������
            anyType2anyTypeMapEntry[] requestData = new anyType2anyTypeMapEntry[]
            {
                Helper.XfireCreateKeyValue("dowhat","SmsTestByDll"),
                Helper.XfireCreateKeyValue("phoneNumber",strPhoneNumber),
                Helper.XfireCreateKeyValue("parameter",strParameter),
                Helper.XfireCreateKeyValue("dllName",strDllName)
            };

            //ͨ��WebService������
            this.service.Url = UserPermissionContext.Instance.Url;

            RetMapInVector result = ServiceClient.GetUnivData2(requestData);
            if (!result.retbool)
            {
                if (logger.IsErrorEnabled)
                {
                    logger.Error(result.estr);
                }
            }

            return result.retbool;
        }
        /// <summary>
        /// �������������¼����ת��Excel�ļ�������·�����ͻ��ˡ�
        /// </summary>
        /// <param name="strIdList"></param>
        /// <param name="strDataType"></param>
        /// <param name="beginTime"></param>
        /// <param name="endTime"></param>
        /// <returns></returns>
        public string QueryDataAndMakeExcel(string strIdList, string strDataType, DateTime beginTime, DateTime endTime)
        {
            //��֯�������
            anyType2anyTypeMapEntry[] requestData = new anyType2anyTypeMapEntry[]
            {
                Helper.XfireCreateKeyValue("dowhat","QueryDataAndMakeExcel"),
                Helper.XfireCreateKeyValue("id",strIdList),
                Helper.XfireCreateKeyValue("datatype",strDataType),
                Helper.XfireCreateKeyValue("begin_year",beginTime.Year.ToString()),
                Helper.XfireCreateKeyValue("begin_month",beginTime.Month.ToString()),
                Helper.XfireCreateKeyValue("begin_day",beginTime.Day.ToString()),
                Helper.XfireCreateKeyValue("begin_hour",beginTime.Hour.ToString()),
                Helper.XfireCreateKeyValue("begin_minute",beginTime.Minute.ToString()),
                Helper.XfireCreateKeyValue("begin_second",beginTime.Second.ToString()),
                Helper.XfireCreateKeyValue("end_year",endTime.Year.ToString()),
                Helper.XfireCreateKeyValue("end_month",endTime.Month.ToString()),
                Helper.XfireCreateKeyValue("end_day",endTime.Day.ToString()),
                Helper.XfireCreateKeyValue("end_hour",endTime.Hour.ToString()),
                Helper.XfireCreateKeyValue("end_minute",endTime.Minute.ToString()),
                Helper.XfireCreateKeyValue("end_second",endTime.Second.ToString())
            };

            return CreateDataTable(requestData).ToString();
        }
Beispiel #50
0
        public QueryAlertLogResult QueryAlertLog(AccessControl AccessInformation, AlertLogQueryCondition QueryCondition)
        {
            QueryAlertLogResult queryAlertLogResult = new QueryAlertLogResult();
            //dowhat= QueryAlertLog,
            //begin_year= XXX,
            //begin_month= XXX,
            //begin_day= XXX,
            //begin_hour= XXX,
            //begin_minute= XXX,
            //begin_second= XXX,
            //end_year= XXX,
            //end_month= XXX,
            //end_day= XXX,
            //end_hour= XXX,
            //end_minute= XXX,
            //end_second= XXX,
            //alertName= XXX,
            //alertReceive= XXX,
            //alertType= XXX;
            ////alertName、alertReceive、alertType 是 and 关系,如果为空则为全部。

            SortedDictionary <string, string> paras = new SortedDictionary <string, string>();

            paras.Add("dowhat", "QueryAlertLog");
            paras.Add("begin_year", QueryCondition.StartTime.Year.ToString());
            paras.Add("begin_month", QueryCondition.StartTime.Month.ToString());
            paras.Add("begin_day", QueryCondition.StartTime.Day.ToString());
            paras.Add("begin_hour", QueryCondition.StartTime.Hour.ToString());
            paras.Add("begin_minute", QueryCondition.StartTime.Minute.ToString());
            paras.Add("begin_second", QueryCondition.StartTime.Second.ToString());
            paras.Add("end_year", QueryCondition.EndTime.Year.ToString());
            paras.Add("end_month", QueryCondition.EndTime.Month.ToString());
            paras.Add("end_day", QueryCondition.EndTime.Day.ToString());
            paras.Add("end_hour", QueryCondition.EndTime.Hour.ToString());
            paras.Add("end_minute", QueryCondition.EndTime.Minute.ToString());
            paras.Add("end_second", QueryCondition.EndTime.Second.ToString());

            if (QueryCondition.LimitName)
            {
                paras.Add("alertName", QueryCondition.AlertName);
            }

            if (QueryCondition.LimitReceiver)
            {
                paras.Add("alertReceive", QueryCondition.AlertReceiver);
            }

            if (QueryCondition.LimitType)
            {
                paras.Add("alertType", QueryCondition.AlertType.ToString("D"));
            }
            if (QueryCondition.LimitIndex)
            {
                paras.Add("alertIndex", QueryCondition.AlertIndex);
            }


            anyType2anyTypeMapEntry[] requestData = new anyType2anyTypeMapEntry[paras.Count];

            int i = 0;

            foreach (string key in paras.Keys)
            {
                anyType2anyTypeMapEntry node = Helper.XfireCreateKeyValue(key, paras[key]);
                requestData[i++] = node;
            }

            this.service.Url = UserPermissionContext.Instance.Url;
            RetMapInVector result = ServiceClient.GetForestData(requestData);

            //RetMapInVector result = this.service.GetForestData(requestData);
            if (!result.retbool)
            {
                if (logger.IsWarnEnabled)
                {
                    logger.Warn(result.estr);
                }
                return(null);
            }

            queryAlertLogResult.ErrorInformation = result.estr;
            queryAlertLogResult.QueryAlertLogOK  = result.retbool;

            IList <NameValueCollection> resultData = Helper.XfireConventMapEntryToList(result.vmap);

            AlertLogItem[] responseData = new AlertLogItem[resultData.Count];
            for (int j = 0; j < resultData.Count; j++)
            {
                NameValueCollection record = resultData[j];
                AlertLogItem        item   = new AlertLogItem();
                item.AlertIndex    = record["_AlertIndex"];
                item.AlertName     = record["_AlertRuleName"];
                item.EntityName    = record["_DeviceName"];
                item.MonitorName   = record["_MonitorName"];
                item.AlertReceiver = record["_AlertReceive"];
                item.AlertStatus   = (AlertStatus)Enum.Parse(typeof(AlertStatus), record["_AlertStatus"]);
                item.AlertTime     = DateTime.Parse(record["_AlertTime"]);
                item.AlertType     = (AlertType)Enum.Parse(typeof(AlertType), record["_AlertType"]);

                responseData[j] = item;
            }

            queryAlertLogResult.ResponseData = responseData;

            return(queryAlertLogResult);
        }
        public DataTable CreateDataTable(MonitorTemplet templet, anyType2anyTypeMapEntry[][] data)
        {
            DataTable dt = new DataTable();
                DataTable Imgdt = new DataTable();
                NameValueCollection TextName = new NameValueCollection();
                NameValueCollection ImgTextName = new NameValueCollection();
                dt.Columns.Add(new DataColumn("ʱ��", typeof(DateTime)));
                dt.Columns.Add(new DataColumn("��¼״̬", typeof(String)));
                dt.Columns.Add(new DataColumn("����", typeof(String)));
                dt.Columns.Add(new DataColumn("����", typeof(String)));
                Imgdt.Columns.Add(new DataColumn("ʱ��", typeof(DateTime)));
                Imgdt.Columns.Add(new DataColumn("��¼״̬", typeof(String)));
                Imgdt.Columns.Add(new DataColumn("����", typeof(String)));
                TextName.Add("creat_time", "ʱ��");
                TextName.Add("record_status", "��¼״̬");
                TextName.Add("dstr", "����");
                ImgTextName.Add("creat_time", "ʱ��");
                ImgTextName.Add("record_status", "��¼״̬");
                ImgTextName.Add("dstr", "����");
                foreach (NameValueCollection returnItem in templet.Returns.Values)
                {
                    ///bin.liusv_type
                    ///2008.8.11
                    if (returnItem.Get("sv_type") == null || returnItem["sv_type"] == null || returnItem["sv_type"] == string.Empty || returnItem["sv_type"].ToLower() == "string")
                    {
                        continue;
                    }

                    dt.Columns.Add(new DataColumn(returnItem["sv_label"], typeof(Double)));
                    TextName.Add(returnItem["sv_name"], returnItem["sv_label"]);
                    if (returnItem.Get("sv_drawimage") != null)
                    {
                        if (returnItem["sv_drawimage"] == "1")
                        {
                            ImgTextName.Add(returnItem["sv_name"], returnItem["sv_label"]);
                            Imgdt.Columns.Add(new DataColumn(returnItem["sv_label"], typeof(Double)));
                        }
                    }
                }

                DataRow dr = null;
                IList<NameValueCollection> resultData = Helper.XfireConventMapEntryToList(data);

                foreach (NameValueCollection nameValueCollection in resultData)
                {
                    dr = dt.NewRow();
                    dr["����"] = this.Name;
                    foreach (string key in nameValueCollection.AllKeys)
                    {
                        string clumnname = TextName[key];
                        if (clumnname != null && dt.Columns.Contains(clumnname))  //�ж��Ƿ���ڴ��У������е�����ᱨ�� add by huangyimei
                        {
                            if (dt.Columns[clumnname].DataType.Equals(typeof(Double)))
                            {
                                double value = 0;
                                Double.TryParse(nameValueCollection[key], out value);
                                dr[clumnname] = value;
                            }
                            else
                            {
                                dr[clumnname] = nameValueCollection[key];
                            }
                        }
                    }
                    dt.Rows.Add(dr);
                }

                /*
                foreach (MapType map in data)
                {
                    dr = dt.NewRow();
                    dr["����"] = this.Name;
                    foreach (KeyValue keyvalue in map.Map)
                    {
                        string clumnname = TextName[keyvalue.Key];
                        if (dt.Columns[clumnname].DataType.Equals(typeof(Double)))
                        {
                            double value = 0;
                            Double.TryParse(keyvalue.Value, out value);
                            dr[clumnname] = value;
                        }
                        else
                        {
                            dr[clumnname] = keyvalue.Value;
                        }
                    }
                    dt.Rows.Add(dr);
                }
                 */

                DataRow dr1 = null;
                foreach (NameValueCollection nameValueCollection in resultData)
                {
                    dr1 = Imgdt.NewRow();
                    foreach (string key in nameValueCollection.Keys)
                    {
                        if (ImgTextName.Get(key) != null)
                        {
                            string clumnname = ImgTextName[key];
                            if (Imgdt.Columns[clumnname].DataType.Equals(typeof(Double)))
                            {
                                double value = 0;
                                Double.TryParse(nameValueCollection[key], out value);
                                dr1[clumnname] = value;
                            }
                            else
                            {
                                dr1[clumnname] = nameValueCollection[key];
                            }
                        }
                    }
                    Imgdt.Rows.Add(dr1);
                }

                /*
                DataRow dr1 = null;
                foreach (MapType map in data)
                {
                    dr1 = Imgdt.NewRow();
                    foreach (KeyValue keyvalue in map.Map)
                    {
                        if (ImgTextName.Get(keyvalue.Key) != null)
                        {
                            string clumnname = ImgTextName[keyvalue.Key];
                            if (Imgdt.Columns[clumnname].DataType.Equals(typeof(Double)))
                            {
                                double value = 0;
                                Double.TryParse(keyvalue.Value, out value);
                                dr1[clumnname] = value;
                            }
                            else
                            {
                                dr1[clumnname] = keyvalue.Value;
                            }
                        }
                    }
                    Imgdt.Rows.Add(dr1);
                }
                */

                ImgTable = Imgdt;

                return dt;
        }
        /// <summary>
        /// 
        /// </summary>
        /// <param name="monitors"></param>
        /// <returns></returns>
        public string[] BatchAddMonitors(ArrayList monitors)
        {
            //������������
            IDictionary<string, NameValueCollection> data = new Dictionary<string, NameValueCollection>();

            int i = 0;
            foreach(NameValueCollection monitor in monitors)
            {
                string strTmp = "";
                foreach (string strKey in monitor.Keys)
                {
                    strTmp += ("monitor_" + strKey.Split(':')[0]);
                    strTmp += "_";
                    strTmp += i.ToString();

                    if (data.ContainsKey(strTmp))
                    {
                        data[strTmp][strKey.Split(':')[1]] = monitor[strKey];
                    }
                    else
                    {
                        data[strTmp] = new NameValueCollection();
                        data[strTmp][strKey.Split(':')[1]] = monitor[strKey];
                    }

                    strTmp = "";
                }

                i++;
            }

            anyType2anyTypeMapEntry[][] values = Helper.XfireConventDictionaryToMapEntry(data);

            anyType2anyTypeMapEntry[] requestData = new anyType2anyTypeMapEntry[]
            {
                Helper.XfireCreateKeyValue("dowhat","AdvanceAddManyMonitor"),
                Helper.XfireCreateKeyValue("autoCreateTable","true")
            };

            this.service.Url = UserPermissionContext.Instance.Url;
            int oldTimeout = this.service.Timeout;
            this.service.Timeout = 600000;

            RetMapInVector result = ServiceClient.SubmitUnivData2(values, requestData);
            if (!result.retbool)
            {
                if (logger.IsErrorEnabled)
                {
                    logger.Error(result.estr);
                }
                throw new System.Net.WebException("����Web Serviceʧ�ܣ�" + result.estr);
            }

            IDictionary<string, NameValueCollection> resultData = Helper.XfireConventMapEntryToDictionary(result.vmap);
            string[] monitorids = new string[resultData["return"].Count - 1];
            i = 0;
            foreach (string id in resultData["return"].AllKeys)
            {
                if (id.ToLower() == "return")
                {
                    continue;
                }
                monitorids[i] = id;
                i = i + 1;
            }

            this.service.Timeout = oldTimeout;

            return monitorids;
        }
        private DataTable CreateDataTable(string tableId, anyType2anyTypeMapEntry[][] data)
        {
            try
                {
                    if (data == null) return null;

                    int lb1 = data.GetLowerBound(0);
                    int ub1 = data.GetUpperBound(0);
                    int lb2 = data[0].GetLowerBound(0);
                    int ub2 = data[0].GetUpperBound(0);

                    //IDictionary<string, NameValueCollection> dict = Helper.XfireConventMapEntryToDictionary(data);

                    DataTable dt = new DataTable();
                    string fieldNames = "";
                    switch (tableId.ToLower())
                    {
                        case "syslog":
                            {
                                fieldNames = "No.,CreateTime,RecordState,_SysLogIndex,_SysLogTime,_SourceIp,_SysLogMsg,_Facility,_Level,dstr";
                                dt.Columns.Add("No.");
                                dt.Columns.Add("CreateTime");
                                dt.Columns.Add("RecordState");
                                dt.Columns.Add("_SysLogIndex");
                                dt.Columns.Add("_SysLogTime");
                                dt.Columns.Add("_SourceIp");
                                dt.Columns.Add("_SysLogMsg");
                                dt.Columns.Add("_Facility");
                                dt.Columns.Add("_Level");
                                dt.Columns.Add("dstr");
                                break;
                            }
                        case "useroperatelog":
                            {
                                fieldNames = "No.,CreateTime,RecordState,_UserID,_OperateTime,_OperateType,_OperateObjName,_OperateObjInfo,dstr";
                                dt.Columns.Add("No.");
                                dt.Columns.Add("CreateTime");
                                dt.Columns.Add("RecordState");
                                dt.Columns.Add("_UserID");
                                dt.Columns.Add("_OperateTime");
                                dt.Columns.Add("_OperateType");
                                dt.Columns.Add("_OperateObjName");
                                dt.Columns.Add("_OperateObjInfo");
                                dt.Columns.Add("dstr");
                                break;
                            }
                    }

                    List<string> keyList = new List<string>();

                    for (int i = lb2; i <= ub2; i++)
                    {
                        if (!keyList.Contains(data[0][i].key.ToString()))
                        {
                            keyList.Add(data[0][i].key.ToString());
                        }
                    }

                    for (int j = lb1; j <= ub1; j++)
                    {
                        DataRow row = dt.NewRow();
                        for (int k = lb2; k <= ub2; k++)
                        {

                            if (fieldNames.IndexOf(keyList[k]) >= 0)
                            {
                                row[keyList[k]] = data[j][k].value.ToString();
                            }
                        }
                        dt.Rows.Add(row);
                    }

                    //foreach (string key1 in dict.Keys)
                    //{
                    //    NameValueCollection nvc = dict[key1];
                    //    foreach (string key in nvc.Keys)
                    //    {
                    //        if (fieldNames.IndexOf(key) >= 0)
                    //        {
                    //            DataRow row = dt.NewRow();
                    //            row[key] = nvc[key];
                    //            dt.Rows.Add(row);
                    //        }
                    //    }
                    //}

                    return dt;
                }
                catch (Exception ex)
                {
                    return null;
                }
        }