Exemple #1
0
        /// <summary>
        /// Request Nodes
        /// </summary>
        /// <param name="nodes">nodes</param>
        private void RequestNodes(List <NodeInfo> nodes)
        {
            try {
                var orders = new List <OrderInfo>();
                foreach (var node in nodes)
                {
                    var order = new OrderInfo();
                    order.LscID      = node.LscID;
                    order.TargetID   = node.NodeID;
                    order.TargetType = node.NodeType;
                    order.OrderType  = EnmActType.RequestNode;
                    order.RelValue1  = WebUtility.DefaultString;
                    order.RelValue2  = WebUtility.DefaultString;
                    order.RelValue3  = WebUtility.DefaultString;
                    order.RelValue4  = WebUtility.DefaultString;
                    order.RelValue5  = WebUtility.DefaultString;
                    order.UpdateTime = DateTime.Now;
                    orders.Add(order);
                }

                if (orders.Count > 0)
                {
                    var orderEntity = new BOrder();
                    orderEntity.AddOrders(orders);
                }
            } catch (Exception err) {
                WebUtility.WriteLog(EnmSysLogLevel.Error, EnmSysLogType.Exception, err.ToString(), Page.User.Identity.Name);
                WebUtility.ShowMessage(EnmErrType.Error, err.Message);
            }
        }
        /// <summary>
        /// Query Button Click
        /// </summary>
        protected void QueryBtn_Click(object sender, DirectEventArgs e)
        {
            try {
                var nodes = AddDataToCache();
                if (nodes != null && nodes.Count > 0)
                {
                    var orders = new List <OrderInfo>();
                    foreach (var node in nodes)
                    {
                        var order = new OrderInfo();
                        order.LscID      = node.LscID;
                        order.TargetID   = node.NodeID;
                        order.TargetType = node.NodeType;
                        order.OrderType  = EnmActType.RequestNode;
                        order.RelValue1  = WebUtility.DefaultString;
                        order.RelValue2  = WebUtility.DefaultString;
                        order.RelValue3  = WebUtility.DefaultString;
                        order.RelValue4  = WebUtility.DefaultString;
                        order.RelValue5  = WebUtility.DefaultString;
                        order.UpdateTime = DateTime.Now;
                        orders.Add(order);
                    }

                    var orderEntity = new BOrder();
                    orderEntity.AddOrders(orders);
                    var duration = Int32.Parse(WebConfigurationManager.AppSettings["NodesRequstInterval"]) * 1000;
                    Thread.Sleep(duration);
                    AddDataToCache();
                }
            } catch (Exception err) {
                WebUtility.WriteLog(EnmSysLogLevel.Error, EnmSysLogType.Exception, err.ToString(), Page.User.Identity.Name);
                WebUtility.ShowMessage(EnmErrType.Error, err.Message);
            }
        }