예제 #1
0
        /// <summary>
        /// Submit Nodes
        /// </summary>
        protected void SubmitNodes(object sender, SubmitEventArgs e)
        {
            try {
                var columns = new List <ACSFilterInfo>();
                foreach (var sNode in e.RootNode.Children)
                {
                    var column = new ACSFilterInfo();
                    column.ColName    = sNode.Text;
                    column.FilterItem = sNode.Attributes["filterItem"].ToString();
                    var filterType = Int32.Parse(sNode.Attributes["filterType"].ToString());
                    column.FilterType = Enum.IsDefined(typeof(EnmAlarmFiterType), filterType) ? (EnmAlarmFiterType)filterType : EnmAlarmFiterType.AlarmDeviceID;
                    column.IsNew      = Boolean.Parse(sNode.Attributes["isNew"].ToString());
                    columns.Add(column);
                }

                if (columns.Count > 0 && LscsComboBox.SelectedItem != null)
                {
                    var ids = WebUtility.ItemSplit(LscsComboBox.SelectedItem.Value);
                    if (ids.Length != 2)
                    {
                        WebUtility.ShowNotify(EnmErrType.Warning, "获取客户端参数时发生错误,数据保存失败!");
                        return;
                    }

                    var lscId     = Int32.Parse(ids[0]);
                    var groupId   = Int32.Parse(ids[1]);
                    var lscEntity = new BLsc();
                    var lsc       = lscEntity.GetLsc(lscId);
                    if (lsc == null)
                    {
                        WebUtility.ShowNotify(EnmErrType.Warning, "无法获取客户端信息,数据保存失败!");
                        return;
                    }

                    var userData = UserData;
                    var lscUser  = userData.LscUsers.Find(lui => { return(lui.LscID == lsc.LscID); });
                    if (lscUser == null)
                    {
                        WebUtility.ShowNotify(EnmErrType.Warning, "无法获取用户信息,数据保存失败!");
                        return;
                    }

                    var connectionString    = WebUtility.CreateLscConnectionString(lsc);
                    var reportSettingEntity = new BSetting();
                    columns = reportSettingEntity.UpdateLSCAlarmFilterCols(connectionString, lscUser.UID, columns);
                    reportSettingEntity.UpdateCSCAlarmFilterCols(lscUser.LscID, lscUser.UID, columns);
                    lscUser.AlarmStaticFiterItem = columns;
                    WebUtility.ShowNotify(EnmErrType.Info, "数据已保存成功!");
                }
            } catch (Exception err) {
                WebUtility.WriteLog(EnmSysLogLevel.Error, EnmSysLogType.Exception, err.ToString(), Page.User.Identity.Name);
                WebUtility.ShowMessage(EnmErrType.Error, err.Message);
            }
        }