Beispiel #1
0
        public void SetAocParms()
        {
            try {
                if (String.IsNullOrEmpty(SettingWindowHF.Text.Trim()))
                {
                    var warningMsg = "获取AO参数时发生错误,设置失败!";
                    WebUtility.WriteLog(EnmSysLogLevel.Warn, EnmSysLogType.Operating, warningMsg, Page.User.Identity.Name);
                    WebUtility.ShowMessage(EnmErrType.Warning, warningMsg);
                    return;
                }

                var ids = WebUtility.ItemSplit(SettingWindowHF.Text.Trim());
                if (ids.Length != 3)
                {
                    var warningMsg = "AO参数格式错误,设置失败!";
                    WebUtility.WriteLog(EnmSysLogLevel.Warn, EnmSysLogType.Operating, warningMsg, Page.User.Identity.Name);
                    WebUtility.ShowMessage(EnmErrType.Warning, warningMsg);
                    return;
                }

                var lscId       = Int32.Parse(ids[0]);
                var nodeId      = Int32.Parse(ids[1]);
                var nodeType    = Int32.Parse(ids[2]);
                var enmNodeType = Enum.IsDefined(typeof(EnmNodeType), nodeType) ? (EnmNodeType)nodeType : EnmNodeType.Null;
                var lscUser     = UserData.LscUsers.Find(lu => { return(lu.LscID == lscId); });
                if (lscUser == null)
                {
                    var warningMsg = "无法获取用户信息,设置失败!";
                    WebUtility.WriteLog(EnmSysLogLevel.Warn, EnmSysLogType.Operating, warningMsg, Page.User.Identity.Name);
                    WebUtility.ShowMessage(EnmErrType.Warning, warningMsg);
                    return;
                }

                var order = new OrderInfo();
                order.LscID      = lscId;
                order.TargetID   = nodeId;
                order.TargetType = enmNodeType;
                order.OrderType  = EnmActType.SetAoc;
                order.RelValue1  = (double.MinValue == SettingSpinnerField.Number ? 0 : SettingSpinnerField.Number).ToString("0.000");
                order.RelValue2  = lscId.ToString();
                order.RelValue3  = lscUser.UserID.ToString();
                order.RelValue4  = lscUser.UserName;
                order.RelValue5  = WebUtility.DefaultString;
                order.UpdateTime = DateTime.Now;

                var orderEntity = new BOrder();
                orderEntity.AddOrder(order);
            } catch (Exception err) {
                WebUtility.WriteLog(EnmSysLogLevel.Error, EnmSysLogType.Exception, err.ToString(), Page.User.Identity.Name);
                WebUtility.ShowMessage(EnmErrType.Error, err.Message);
            } finally {
                SettingSpinnerField.Number = 0;
                SettingWindow.Hide();
            }
        }