コード例 #1
0
        /// <summary>
        /// Window Project ComboBox Refresh
        /// </summary>
        protected void OnWProjectRefresh(object sender, StoreRefreshDataEventArgs e)
        {
            try {
                var data = new List <object>();
                if (WLscsComboBox.SelectedItem.Value != null &&
                    WLscsComboBox.SelectedItem.Value != String.Empty)
                {
                    var lscId = Int32.Parse(WLscsComboBox.SelectedItem.Value);
                    var lsc   = new BLsc().GetLsc(lscId);
                    if (lsc != null)
                    {
                        var connectionString = WebUtility.CreateLscConnectionString(lsc);
                        var projects         = new BAppointment().GetProjectItem(lsc.LscID, lsc.LscName, connectionString);
                        foreach (var p in projects)
                        {
                            data.Add(new {
                                Id   = p.ProjectId,
                                Name = p.ProjectName
                            });
                        }
                    }
                }

                WProjectStore.DataSource = data;
                WProjectStore.DataBind();
            } catch (Exception err) {
                WebUtility.WriteLog(EnmSysLogLevel.Error, EnmSysLogType.Exception, err.ToString(), Page.User.Identity.Name);
                WebUtility.ShowMessage(EnmErrType.Error, err.Message);
            }
        }
コード例 #2
0
        public void ShowDetailWindow(int lscId, string projectId)
        {
            try {
                var lsc = new BLsc().GetLsc(lscId);
                if (lsc == null)
                {
                    WebUtility.ShowMessage(EnmErrType.Warning, "无法获取Lsc信息");
                    return;
                }

                var connectionString = WebUtility.CreateLscConnectionString(lsc);
                var project          = new BAppointment().GetProject(lsc.LscID, lsc.LscName, projectId, connectionString);
                if (project == null)
                {
                    WebUtility.ShowMessage(EnmErrType.Warning, "无法获取工程信息");
                    return;
                }

                ProjectIdField.Text   = project.ProjectId;
                ProjNameField.Text    = project.ProjectName;
                StartTimeField.Text   = WebUtility.GetDateString(project.BeginTime);
                EndTimeField.Text     = WebUtility.GetDateString(project.EndTime);
                ResponsibleField.Text = project.Responsible;
                PhoneField.Text       = project.ContactPhone;
                CompanyField.Text     = project.Company;
                CommentField.Text     = project.Comment;
                EnabledField.Text     = WebUtility.GetBooleanName(project.Enabled);
                DetailWindow.Show();
            } catch (Exception err) {
                WebUtility.WriteLog(EnmSysLogLevel.Error, EnmSysLogType.Exception, err.ToString(), Page.User.Identity.Name);
                WebUtility.ShowMessage(EnmErrType.Error, err.Message);
            }
        }
コード例 #3
0
        /// <summary>
        /// Submit Nodes
        /// </summary>
        protected void SubmitNodes(object sender, SubmitEventArgs e)
        {
            try {
                var columns = new List <ACVFilterInfo>();
                foreach (var sNode in e.RootNode.Children)
                {
                    var column = new ACVFilterInfo();
                    column.ColName    = sNode.Text;
                    column.FilterItem = sNode.Attributes["filterItem"].ToString();
                    var filterType = Int32.Parse(sNode.Attributes["filterType"].ToString());
                    column.FilterType = Enum.IsDefined(typeof(EnmActiveValuesFiteType), filterType) ? (EnmActiveValuesFiteType)filterType : EnmActiveValuesFiteType.NodeName;
                    var nodeType = Int32.Parse(sNode.Attributes["vNodeType"].ToString());
                    column.NodeType = Enum.IsDefined(typeof(EnmNodeType), nodeType) ? (EnmNodeType)nodeType : EnmNodeType.Null;
                    column.DevName  = sNode.Attributes["devName"].ToString();
                    column.IsNew    = Boolean.Parse(sNode.Attributes["isNew"].ToString());
                    columns.Add(column);
                }

                if (columns.Count > 0 && LscsComboBox.SelectedItem != null)
                {
                    var nodeId = LscsComboBox.SelectedItem.Value;
                    var ids    = WebUtility.ItemSplit(nodeId);
                    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.UpdateLSCActiveValuesFilterCols(connectionString, lscUser.UID, columns);
                    reportSettingEntity.UpdateCSCActiveValuesFilterCols(lscUser.LscID, lscUser.UID, columns);
                    lscUser.ActiveValuesFiterItem = 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);
            }
        }
コード例 #4
0
ファイル: AcEvents.aspx.cs プロジェクト: radtek/PecsSystem
        /// <summary>
        /// Event Type ComboBox Refresh
        /// </summary>
        protected void OnEventTypeRefresh(object sender, StoreRefreshDataEventArgs e)
        {
            try {
                var data = new List <object>();
                if (LscsComboBox.SelectedIndex > 0)
                {
                    var ids = WebUtility.ItemSplit(LscsComboBox.SelectedItem.Value);
                    if (ids.Length == 2)
                    {
                        var lscId   = Int32.Parse(ids[0]);
                        var groupId = Int32.Parse(ids[1]);
                        var lsc     = new BLsc().GetLsc(lscId);
                        if (lsc != null)
                        {
                            var comboboxEntity = new BComboBox();
                            var dict           = comboboxEntity.GetAcMessageType(WebUtility.CreateLscConnectionString(lsc));
                            if (dict != null && dict.Count > 0)
                            {
                                foreach (var key in dict)
                                {
                                    data.Add(new {
                                        Id   = key.Key,
                                        Name = key.Value
                                    });
                                }
                            }
                        }
                    }
                }

                if (data.Count == 0)
                {
                    var lscs = new BLsc().GetLscs().FindAll(l => l.Enabled);
                    foreach (var lsc in lscs)
                    {
                        var comboboxEntity = new BComboBox();
                        var dict           = comboboxEntity.GetAcMessageType(WebUtility.CreateLscConnectionString(lsc));
                        if (dict != null && dict.Count > 0)
                        {
                            foreach (var key in dict)
                            {
                                data.Add(new {
                                    Id   = key.Key,
                                    Name = key.Value
                                });
                            }
                            break;
                        }
                    }
                }

                EventTypeStore.DataSource = data;
                EventTypeStore.DataBind();
            } catch (Exception err) {
                WebUtility.WriteLog(EnmSysLogLevel.Error, EnmSysLogType.Exception, err.ToString(), Page.User.Identity.Name);
                WebUtility.ShowMessage(EnmErrType.Error, err.Message);
            }
        }
コード例 #5
0
        /// <summary>
        /// UDGSettingWestPanelSubmitNodes
        /// </summary>
        protected void UDGSettingWestPanelSubmitNodes(object sender, SubmitEventArgs e)
        {
            try {
                var lscId     = LscID;
                var udGroupID = UDGroupID;
                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(lu => { return(lu.LscID == lsc.LscID); });
                if (lscUser == null)
                {
                    WebUtility.ShowNotify(EnmErrType.Warning, "无法获取用户信息,数据保存失败!");
                    return;
                }

                var cacheKey = WebUtility.GetCacheKeyName(userData, "udg-setting-devs");
                var devNodes = HttpRuntime.Cache[cacheKey] as List <GroupTreeInfo>;
                if (devNodes == null)
                {
                    WebUtility.ShowNotify(EnmErrType.Warning, "无法获取关联设备,数据保存失败!");
                    return;
                }

                var group = new UDGroupInfo();
                group.LscID        = lscId;
                group.UserID       = lscUser.UserID;
                group.UDGroupID    = udGroupID;
                group.UDGroupName  = UDGroupName.Text;
                group.UDGroupNodes = new List <UDGroupTreeInfo>();
                group.Enabled      = true;
                AddUDGSettingWestPanelSubmitNodes(devNodes, group, e.RootNode);

                var    groupEntity      = new BGroup();
                string connectionString = WebUtility.CreateLscConnectionString(lsc);
                group = groupEntity.SaveLSCUDGroupTreeNodes(connectionString, group);
                groupEntity.SaveCSCUDGroupTreeNodes(group);
                lscUser.UDGroups.RemoveAll(udg => { return(udg.UDGroupID == group.UDGroupID); });
                lscUser.UDGroups.Add(group);
                UDGroupID = group.UDGroupID;
                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);
            }
        }
コード例 #6
0
        /// <summary>
        /// Add Data To Cache
        /// </summary>
        private List <ProjectInfo> AddDataToCache()
        {
            var userData = UserData;
            var cacheKey = WebUtility.GetCacheKeyName(userData, "projects");

            HttpRuntime.Cache.Remove(cacheKey);

            if (LscsComboBox.SelectedItem.Value == null || LscsComboBox.SelectedItem.Value == String.Empty)
            {
                return(null);
            }
            var ids = WebUtility.ItemSplit(LscsComboBox.SelectedItem.Value);

            if (ids.Length != 2)
            {
                return(null);
            }
            var lscId = Int32.Parse(ids[0]);
            var lsc   = new BLsc().GetLsc(lscId);

            if (lsc == null)
            {
                return(null);
            }
            var beginTime = DateTime.Parse(BeginDate.Text);
            var endTime   = DateTime.Parse(EndDate.Text);

            var projects         = new List <ProjectInfo>();
            var searchText       = QueryContentTextField.Text.Trim();
            var connectionString = WebUtility.CreateLscConnectionString(lsc);

            switch (Int32.Parse(QueryTypeComboBox.SelectedItem.Value))
            {
            case 0:
                projects.AddRange(new BAppointment().GetProjects(lsc.LscID, lsc.LscName, searchText, null, beginTime, endTime, connectionString));
                break;

            case 1:
                projects.AddRange(new BAppointment().GetProjects(lsc.LscID, lsc.LscName, null, searchText, beginTime, endTime, connectionString));
                break;

            default:
                break;
            }

            var cacheDuration = Int32.Parse(WebConfigurationManager.AppSettings["DefaultCacheDuration"]);

            HttpRuntime.Cache.Insert(cacheKey, projects, null, Cache.NoAbsoluteExpiration, TimeSpan.FromSeconds(cacheDuration), CacheItemPriority.Default, null);
            return(projects);
        }
コード例 #7
0
        public string Save()
        {
            try {
                if (WLscsComboBox.SelectedItem.Value != null && WLscsComboBox.SelectedItem.Value.Trim() != String.Empty)
                {
                    var lscId = Int32.Parse(WLscsComboBox.SelectedItem.Value);
                    var lsc   = new BLsc().GetLsc(lscId);
                    if (lsc == null)
                    {
                        return(String.Format("{{\"Status\":{0}, \"Msg\":\"{1}\"}}", 0, "无法获取Lsc信息"));
                    }

                    var project = new ProjectInfo();
                    project.LscID        = lsc.LscID;
                    project.LscName      = lsc.LscName;
                    project.ProjectId    = ProjectIdField.Text.Trim();
                    project.ProjectName  = ProjNameField.Text.Trim();
                    project.BeginTime    = DateTime.Parse(StartTimeField.Text);
                    project.EndTime      = DateTime.Parse(EndTimeField.Text);
                    project.Responsible  = ResponsibleField.Text.Trim();
                    project.ContactPhone = PhoneField.Text.Trim();
                    project.Company      = CompanyField.Text.Trim();
                    project.Comment      = CommentField.Text.Trim();
                    project.Enabled      = EnabledCheckbox.Checked;

                    var apptEntity       = new BAppointment();
                    var connectionString = WebUtility.CreateLscConnectionString(lsc);
                    if (OperationWindowHF.Text.Equals("Add") &&
                        apptEntity.ProjectExists(project.ProjectId, connectionString))
                    {
                        return(String.Format("{{\"Status\":{0}, \"Msg\":\"{1}\"}}", 0, "工程已存在"));
                    }

                    apptEntity.SaveProjects(new List <ProjectInfo>()
                    {
                        project
                    }, connectionString);
                    var userData = UserData;
                    var cacheKey = WebUtility.GetCacheKeyName(userData, "projects");
                    HttpRuntime.Cache.Remove(cacheKey);
                    return(String.Format("{{\"Status\":{0}, \"Msg\":\"{1}\"}}", 200, "数据保存成功"));
                }
            } catch (Exception err) {
                WebUtility.WriteLog(EnmSysLogLevel.Error, EnmSysLogType.Exception, err.ToString(), Page.User.Identity.Name);
                return(String.Format("{{\"Status\":{0}, \"Msg\":\"{1}\"}}", 0, WebUtility.JsonCharFilter(err.Message)));
            }
            return(String.Empty);
        }
コード例 #8
0
        /// <summary>
        /// Submit Nodes
        /// </summary>
        protected void SubmitNodes(object sender, SubmitEventArgs e)
        {
            try {
                var lscEntity           = new BLsc();
                var lscs                = lscEntity.GetLscs();
                var reportSettingEntity = new BSetting();
                var userData            = UserData;
                foreach (var sNode in e.RootNode.Children)
                {
                    var lsc = lscs.Find(l => { return(l.LscID.ToString().Equals(sNode.NodeID)); });
                    if (lsc == null)
                    {
                        continue;
                    }
                    var lscUser = userData.LscUsers.Find(lu => { return(lu.LscID == lsc.LscID); });
                    if (lscUser == null)
                    {
                        continue;
                    }

                    var sp = new SpeechInfo();
                    sp.SpDisconnect = Boolean.Parse(sNode.Attributes["SpDisconnect"].ToString());
                    sp.AL1Enabled   = Boolean.Parse(sNode.Attributes["AL1Enabled"].ToString());
                    sp.AL2Enabled   = Boolean.Parse(sNode.Attributes["AL2Enabled"].ToString());
                    sp.AL3Enabled   = Boolean.Parse(sNode.Attributes["AL3Enabled"].ToString());
                    sp.AL4Enabled   = Boolean.Parse(sNode.Attributes["AL4Enabled"].ToString());
                    sp.SpDevFilter  = sNode.Attributes["SpDevFilter"].ToString();
                    sp.SpNodeFilter = sNode.Attributes["SpNodeFilter"].ToString();
                    sp.SpLoop       = Boolean.Parse(sNode.Attributes["SpLoop"].ToString());
                    sp.SpArea2      = Boolean.Parse(sNode.Attributes["SpArea2"].ToString());
                    sp.SpArea3      = Boolean.Parse(sNode.Attributes["SpArea3"].ToString());
                    sp.SpStation    = Boolean.Parse(sNode.Attributes["SpStation"].ToString());
                    sp.SpDevice     = Boolean.Parse(sNode.Attributes["SpDevice"].ToString());
                    sp.SpNode       = Boolean.Parse(sNode.Attributes["SpNode"].ToString());
                    sp.SpALDesc     = Boolean.Parse(sNode.Attributes["SpALDesc"].ToString());
                    sp.UpdateTime   = DateTime.Now;

                    var connectionString = WebUtility.CreateLscConnectionString(lsc);
                    var localSpeech      = reportSettingEntity.UpdateLSCSpeechFilter(connectionString, sNode.Attributes["SpUID"].ToString(), sp);
                    reportSettingEntity.UpdateCSCSpeechFilter(lsc.LscID, sNode.Attributes["SpUID"].ToString(), sp);
                    lscUser.AlarmSoundFiterItem = sp;
                }
                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);
            }
        }
コード例 #9
0
        public void Delete(int lscId, string projectId)
        {
            try {
                var lsc = new BLsc().GetLsc(lscId);
                if (lsc == null)
                {
                    WebUtility.ShowMessage(EnmErrType.Warning, "无法获取Lsc信息");
                    return;
                }
                ;

                var connectionString = WebUtility.CreateLscConnectionString(lsc);
                new BAppointment().DeleteProjects(projectId, connectionString);
                var userData = UserData;
                var cacheKey = WebUtility.GetCacheKeyName(userData, "projects");
                HttpRuntime.Cache.Remove(cacheKey);
            } catch (Exception err) {
                WebUtility.WriteLog(EnmSysLogLevel.Error, EnmSysLogType.Exception, err.ToString(), Page.User.Identity.Name);
                WebUtility.ShowMessage(EnmErrType.Error, err.Message);
            }
        }
コード例 #10
0
ファイル: NavMaps.aspx.cs プロジェクト: radtek/PecsSystem
        public void UpdateMarker(int olscId, int ostaId, int lscId, int staId, int mapType, double lng, double lat, string address)
        {
            try {
                var lscEntity = new BLsc();
                var lsc       = lscEntity.GetLsc(lscId);
                if (lsc == null)
                {
                    WebUtility.ShowNotify(EnmErrType.Warning, "无法获取客户端信息,数据更新失败!");
                    return;
                }

                var otherEntity      = new BOther();
                var enmMapType       = Enum.IsDefined(typeof(EnmMapType), mapType) ? (EnmMapType)mapType : EnmMapType.GPS;
                var connectionString = WebUtility.CreateLscConnectionString(lsc);
                otherEntity.UpdateMarker(olscId, ostaId, lscId, staId, enmMapType, lng, lat, address);
                otherEntity.UpdateLocalMarker(connectionString, ostaId, staId, enmMapType, lng, lat, address);
            } catch (Exception err) {
                WebUtility.WriteLog(EnmSysLogLevel.Error, EnmSysLogType.Exception, err.ToString(), Page.User.Identity.Name);
                WebUtility.ShowMessage(EnmErrType.Error, err.Message);
            }
        }
コード例 #11
0
        /// <summary>
        /// Add Data To Cache
        /// </summary>
        private List <AppointmentInfo> AddDataToCache()
        {
            var userData = UserData;
            var cacheKey = WebUtility.GetCacheKeyName(userData, "appointments");

            HttpRuntime.Cache.Remove(cacheKey);

            if (LscsComboBox.SelectedItem.Value == null || LscsComboBox.SelectedItem.Value == String.Empty)
            {
                return(null);
            }
            var ids = WebUtility.ItemSplit(LscsComboBox.SelectedItem.Value);

            if (ids.Length != 2)
            {
                return(null);
            }
            var lscId = Int32.Parse(ids[0]);
            var lsc   = new BLsc().GetLsc(lscId);

            if (lsc == null)
            {
                WebUtility.ShowMessage(EnmErrType.Warning, "无法获取Lsc信息");
                return(null);
            }

            var beginTime = DateTime.Parse(BeginDate.Text);
            var endTime   = DateTime.Parse(EndDate.Text);
            var queryType = Int32.Parse(QueryTypeComboBox.SelectedItem.Value);
            var queryText = QueryContentTextField.Text.Trim();

            var appointmentEntity = new BAppointment();
            var connectionString  = WebUtility.CreateLscConnectionString(lsc);
            var appointments      = appointmentEntity.GetAppointments(lsc.LscID, lsc.LscName, connectionString, beginTime, endTime, queryType, queryText);
            var cacheDuration     = Int32.Parse(WebConfigurationManager.AppSettings["DefaultCacheDuration"]);

            HttpRuntime.Cache.Insert(cacheKey, appointments, null, Cache.NoAbsoluteExpiration, TimeSpan.FromSeconds(cacheDuration), CacheItemPriority.Default, null);
            return(appointments);
        }
コード例 #12
0
        /// <summary>
        /// Add Data To Cache
        /// </summary>
        private List <AppointmentInfo> AddDataToCache()
        {
            var userData = UserData;
            var cacheKey = WebUtility.GetCacheKeyName(userData, "his-appointments");

            HttpRuntime.Cache.Remove(cacheKey);

            if (LscsComboBox.SelectedItem.Value == null || LscsComboBox.SelectedItem.Value == String.Empty)
            {
                return(null);
            }
            var ids = WebUtility.ItemSplit(LscsComboBox.SelectedItem.Value);

            if (ids.Length != 2)
            {
                return(null);
            }
            var lscId = Int32.Parse(ids[0]);
            var lsc   = new BLsc().GetLsc(lscId);

            if (lsc == null)
            {
                WebUtility.ShowMessage(EnmErrType.Warning, "无法获取Lsc信息");
                return(null);
            }

            var beginTime = DateTime.Parse(BeginDate.Text);
            var endTime   = DateTime.Parse(EndDate.Text);
            var queryType = Int32.Parse(QueryTypeComboBox.SelectedItem.Value);
            var queryText = QueryContentTextField.Text.Trim();

            var appointments = new BAppointment().GetHisAppointments(lsc.LscID, lsc.LscName, beginTime, endTime, queryType, queryText);

            if (appointments.Count > 0)
            {
                var users = new BUser().GetUsers(lsc.LscID, lsc.LscName, null, WebUtility.CreateLscConnectionString(lsc));
                if (users.Count > 0)
                {
                    appointments = (from a in appointments
                                    join u in users on new { UserID = a.CreaterId } equals new { UserID = u.UserID } into ug
                                    from ua in ug.DefaultIfEmpty()
                                    select new AppointmentInfo {
                        LscID = a.LscID,
                        LscName = a.LscName,
                        Id = a.Id,
                        StartTime = a.StartTime,
                        EndTime = a.EndTime,
                        LscIncluded = a.LscIncluded,
                        StaIncluded = a.StaIncluded,
                        DevIncluded = a.DevIncluded,
                        ProjectId = a.ProjectId,
                        ProjectName = a.ProjectName,
                        Status = a.Status,
                        CreaterId = a.CreaterId,
                        Creater = ua != null?ua.UserName:a.Creater,
                        ContactPhone = ua != null?ua.MobilePhone:a.ContactPhone,
                        CreatedTime = a.CreatedTime,
                        RecordTime = a.RecordTime
                    }).OrderBy(a => a.Id).ToList();
                }
            }

            var cacheDuration = Int32.Parse(WebConfigurationManager.AppSettings["DefaultCacheDuration"]);

            HttpRuntime.Cache.Insert(cacheKey, appointments, null, Cache.NoAbsoluteExpiration, TimeSpan.FromSeconds(cacheDuration), CacheItemPriority.Default, null);
            return(appointments);
        }
コード例 #13
0
ファイル: AcEvents.aspx.cs プロジェクト: radtek/PecsSystem
        /// <summary>
        /// Add Events To Cache
        /// </summary>
        /// <returns>Operating Events</returns>
        private List <AcEventInfo> AddEventsToCache()
        {
            var userData = UserData;
            var cacheKey = WebUtility.GetCacheKeyName(userData, "netking-events");

            HttpRuntime.Cache.Remove(cacheKey);

            var lscIds = new List <int>();

            if (LscsComboBox.SelectedIndex > 0)
            {
                var ids = WebUtility.ItemSplit(LscsComboBox.SelectedItem.Value);
                if (ids.Length == 2)
                {
                    var lscId   = Int32.Parse(ids[0]);
                    var groupId = Int32.Parse(ids[1]);
                    lscIds.Add(lscId);
                }
            }
            else
            {
                lscIds.AddRange(userData.LscUsers.Select(l => l.LscID));
            }
            if (lscIds.Count == 0)
            {
                return(null);
            }

            var types = new Dictionary <Int32, String>();

            foreach (var dt in EventTypeMultiCombo.SelectedItems)
            {
                types[Int32.Parse(dt.Value)] = dt.Text;
            }

            var ctype    = Convert.ToInt32(CountTypeComboBox.SelectedItem.Value);
            var fromTime = DateTime.Parse(FromDate.Text);
            var toTime   = DateTime.Parse(ToDate.Text);

            var lscEntity   = new BLsc();
            var otherEntity = new BOther();
            var result      = new List <AcEventInfo>();

            foreach (var id in lscIds)
            {
                var lsc = lscEntity.GetLsc(id);
                if (lsc == null)
                {
                    continue;
                }

                List <AcEventInfo> temp = null;
                switch (ctype)
                {
                case 0:
                    temp = otherEntity.GetPubAlertEvent(lsc.LscID, lsc.LscName, WebUtility.CreateLscConnectionString(lsc), fromTime, toTime);
                    break;

                case 1:
                    temp = otherEntity.GetPubGeneralEvent(lsc.LscID, lsc.LscName, WebUtility.CreateLscConnectionString(lsc), fromTime, toTime);
                    break;

                case 2:
                    temp = otherEntity.GetPubInvalidCardEvent(lsc.LscID, lsc.LscName, WebUtility.CreateLscConnectionString(lsc), fromTime, toTime);
                    break;

                case 3:
                    temp = otherEntity.GetPubValidCardEvent(lsc.LscID, lsc.LscName, WebUtility.CreateLscConnectionString(lsc), fromTime, toTime);
                    break;

                default:
                    break;
                }

                if (temp != null)
                {
                    if (types.Count > 0)
                    {
                        temp = temp.FindAll(t => types.ContainsKey(t.MessageID));
                    }

                    result.AddRange(temp);
                }
            }

            var cacheDuration = Int32.Parse(WebConfigurationManager.AppSettings["DefaultCacheDuration"]);

            HttpRuntime.Cache.Insert(cacheKey, result, null, Cache.NoAbsoluteExpiration, TimeSpan.FromSeconds(cacheDuration), CacheItemPriority.Default, null);
            return(result);
        }
コード例 #14
0
        /// <summary>
        /// Add Data To Cache
        /// </summary>
        private List <ProjectReportPageEntity> AddDataToCache()
        {
            var userData = UserData;
            var cacheKey = WebUtility.GetCacheKeyName(userData, "project-report-entities");

            HttpRuntime.Cache.Remove(cacheKey);

            if (LscsComboBox.SelectedItem.Value == null || LscsComboBox.SelectedItem.Value == String.Empty)
            {
                return(null);
            }
            var ids = WebUtility.ItemSplit(LscsComboBox.SelectedItem.Value);

            if (ids.Length != 2)
            {
                return(null);
            }
            var lsc = new BLsc().GetLsc(Int32.Parse(ids[0]));

            if (lsc == null)
            {
                WebUtility.ShowMessage(EnmErrType.Warning, "无法获取Lsc信息");
                return(null);
            }

            var beginTime = DateTime.Parse(BeginDate.Text);
            var endTime   = DateTime.Parse(EndDate.Text);
            var area2Id   = WebUtility.DefaultInt32;
            var area3Id   = WebUtility.DefaultInt32;

            if (Area2ComboBox.SelectedIndex > 0)
            {
                area2Id = Int32.Parse(Area2ComboBox.SelectedItem.Value);
            }
            if (Area3ComboBox.SelectedIndex > 0)
            {
                area3Id = Int32.Parse(Area3ComboBox.SelectedItem.Value);
            }

            var appointmentEntity = new BAppointment();
            var connectionString  = WebUtility.CreateLscConnectionString(lsc);

            var appointments1 = appointmentEntity.GetAppointments(lsc.LscID, lsc.LscName, connectionString, beginTime, endTime, 0, null);
            var appointments2 = appointmentEntity.GetHisAppointments(lsc.LscID, lsc.LscName, beginTime, endTime, 0, null);

            appointments1.AddRange(appointments2);

            var lscappointments = appointments1.FindAll(a => a.LscIncluded == lsc.LscID);
            var nonappointments = appointments1.FindAll(a => a.LscIncluded != lsc.LscID);

            var staSet = new List <IDValuePair <int, AppointmentInfo> >();

            foreach (var apt in nonappointments)
            {
                if (apt.StaIncluded != null && apt.StaIncluded.Trim() != String.Empty)
                {
                    var array = apt.StaIncluded.Split(';');
                    foreach (var id in array)
                    {
                        if (id.Trim() != String.Empty)
                        {
                            staSet.Add(new IDValuePair <int, AppointmentInfo>(Int32.Parse(id), apt));
                        }
                    }
                }
            }

            var devSet = new List <IDValuePair <int, AppointmentInfo> >();

            foreach (var apt in nonappointments)
            {
                if (apt.DevIncluded != null && apt.DevIncluded.Trim() != String.Empty)
                {
                    var array = apt.DevIncluded.Split(';');
                    foreach (var id in array)
                    {
                        if (id.Trim() != String.Empty)
                        {
                            devSet.Add(new IDValuePair <int, AppointmentInfo>(Int32.Parse(id), apt));
                        }
                    }
                }
            }

            var otherEntity = new BOther();
            var stations    = otherEntity.GetStations(lsc.LscID);
            var master1     = from ss in staSet
                              join sta in stations on ss.ID equals sta.StaID
                              select new IDValuePair <int, AppointmentInfo> {
                ID    = sta.Area3ID,
                Value = ss.Value
            };

            var devices = otherEntity.GetDevices(lsc.LscID);
            var master2 = from ds in devSet
                          join dev in devices on ds.ID equals dev.DevID
                          select new IDValuePair <int, AppointmentInfo> {
                ID    = dev.Area3ID,
                Value = ds.Value
            };

            var master = new Dictionary <String, IDValuePair <int, AppointmentInfo> >();

            foreach (var mt in master1)
            {
                master[String.Format("{0}-{1}", mt.ID, mt.Value.Id)] = mt;
            }
            foreach (var mt in master2)
            {
                master[String.Format("{0}-{1}", mt.ID, mt.Value.Id)] = mt;
            }

            var areas = otherEntity.GetAreas(lsc.LscID);

            if (area2Id != WebUtility.DefaultInt32)
            {
                areas = areas.FindAll(a => a.Area2ID == area2Id);
            }
            if (area3Id != WebUtility.DefaultInt32)
            {
                areas = areas.FindAll(a => a.Area3ID == area3Id);
            }

            foreach (var area in areas)
            {
                foreach (var apt in lscappointments)
                {
                    master[String.Format("{0}-{1}", area.Area3ID, apt.Id)] = new IDValuePair <int, AppointmentInfo>(area.Area3ID, apt);
                }
            }

            var a1 = from mt in master.Values
                     group mt by new { AreaId = mt.ID, mt.Value.ProjectId } into g
                select new {
                g.Key.AreaId,
                g.Key.ProjectId,
                Time = g.Sum(a => a.Value.EndTime.Subtract(a.Value.StartTime).TotalSeconds)
            };

            var projects = appointmentEntity.GetProjectItem(lsc.LscID, lsc.LscName, connectionString);
            var a2       = from a in a1
                           join p in projects on a.ProjectId equals p.ProjectId
                           select new {
                AreaId      = a.AreaId,
                Time        = a.Time,
                Project     = p,
                IsExProject = a.Time > p.EndTime.Subtract(p.BeginTime).TotalSeconds
            };

            var a3 = from a in a2
                     group a by new { a.AreaId } into g
                select new {
                g.Key.AreaId,
                Time       = g.Sum(p => p.Time),
                Projects   = g.Select(p => p.Project).ToList(),
                ExProjects = g.Where(p => p.IsExProject).Select(p => p.Project).ToList()
            };

            var a4 = from area in areas
                     join a in a3 on area.Area3ID equals a.AreaId into l
                     from aa in l.DefaultIfEmpty()
                     select new ProjectReportPageEntity {
                Area       = area,
                Time       = aa != null ? aa.Time : 0,
                Projects   = aa != null ? aa.Projects : new List <ProjectInfo>(),
                ExProjects = aa != null ? aa.ExProjects : new List <ProjectInfo>()
            };


            var result        = a4.ToList();
            var cacheDuration = Int32.Parse(WebConfigurationManager.AppSettings["DefaultCacheDuration"]);

            HttpRuntime.Cache.Insert(cacheKey, result, null, Cache.NoAbsoluteExpiration, TimeSpan.FromSeconds(cacheDuration), CacheItemPriority.Default, null);
            return(result);
        }
コード例 #15
0
        /// <summary>
        /// Add data to cache.
        /// </summary>
        private List <Report111Entity> AddDataToCache()
        {
            var userData = UserData;
            var cacheKey = WebUtility.GetCacheKeyName(userData, "kpi-report-111");

            HttpRuntime.Cache.Remove(cacheKey);

            var lscs = new List <LscUserInfo>();

            if (LscsComboBox.SelectedIndex > 0)
            {
                var ids = WebUtility.ItemSplit(LscsComboBox.SelectedItem.Value);
                if (ids.Length != 2)
                {
                    return(null);
                }
                var lscId   = Int32.Parse(ids[0]);
                var groupId = Int32.Parse(ids[1]);
                var lscUser = userData.LscUsers.Find(lu => { return(lu.LscID == lscId); });
                if (lscUser == null)
                {
                    return(null);
                }
                lscs.Add(lscUser);
            }
            else
            {
                lscs.AddRange(userData.LscUsers);
            }

            var fromTime = DateTime.Parse(BeginFromDate.Text);
            var toTime   = DateTime.Parse(BeginToDate.Text);

            var texts      = new List <String>();
            var auxSets    = new List <String>();
            var filterText = WebUtility.StringSplit(NodeText.Text.Trim());

            foreach (var ft in filterText)
            {
                if (String.IsNullOrEmpty(ft.Trim()))
                {
                    continue;
                }
                if (FilterTypeList.SelectedItem.Value.Equals("1"))
                {
                    auxSets.Add(ft.Trim());
                }
                else
                {
                    texts.Add(ft.Trim());
                }
            }

            var staTypes = new Dictionary <Int32, String>();

            foreach (var dt in StaTypeMultiCombo.SelectedItems)
            {
                staTypes[Int32.Parse(dt.Value)] = dt.Text;
            }
            if (staTypes.Count == 0)
            {
                return(null);
            }

            var devTypes = new Dictionary <Int32, String>();

            foreach (var dt in DevTypeMultiCombo.SelectedItems)
            {
                devTypes[Int32.Parse(dt.Value)] = dt.Text;
            }
            if (devTypes.Count == 0)
            {
                return(null);
            }

            var almNames = new List <String>();
            var almIds   = new Dictionary <String, String>();
            var almText  = WebUtility.StringSplit(AlarmNameText.Text.Trim());

            foreach (var at in almText)
            {
                if (String.IsNullOrEmpty(at.Trim()))
                {
                    continue;
                }
                if (AlmNameList.SelectedItem.Value.Equals("1"))
                {
                    almIds[at.Trim()] = null;
                }
                else
                {
                    almNames.Add(at.Trim());
                }
            }

            var nodeEntity  = new BNode();
            var lscEntity   = new BLsc();
            var alarmEntity = new BAlarm();
            var result      = new List <Report111Entity>();

            var virtualData = WebConfigurationManager.AppSettings["Kpi-HeNan-Virtual-Enable"] != null && WebConfigurationManager.AppSettings["Kpi-HeNan-Virtual-Enable"].Equals("1");
            var lscParms    = new List <LscParamInfo>();

            if (virtualData)
            {
                lscParms.AddRange(new BOther().GetLscParam());
            }

            foreach (var l in lscs)
            {
                var lsc = lscEntity.GetLsc(l.LscID);
                if (lsc == null)
                {
                    continue;
                }

                var stations = Report111Entity.GetStations(lsc.LscID, lsc.LscName, WebUtility.CreateLscConnectionString(lsc));
                var nodes    = nodeEntity.GetNodes(lsc.LscID, EnmNodeType.Dic, texts.ToArray(), auxSets.ToArray(), devTypes.Keys.ToArray());
                if (nodes.Count == 0)
                {
                    result.Add(new Report111Entity {
                        LscID     = lsc.LscID,
                        LscName   = lsc.LscName,
                        BeginTime = fromTime,
                        EndTime   = toTime,
                        Alarms    = new List <AlarmInfo>(),
                        NodeCnt   = stations.Count
                    });
                }
                else
                {
                    var alarms = WebUtility.GetUserAlarms(userData).FindAll(alarm => alarm.LscID == lsc.LscID && alarm.StartTime >= fromTime && alarm.StartTime <= toTime);
                    alarms.AddRange(alarmEntity.GetHisAlarms(lsc.LscID, lsc.LscName, userData.StandardProtocol, l.Group.GroupNodes, fromTime, toTime));

                    var ta = alarms.FindAll(alarm => {
                        return((almNames.Count == 0 || almNames.Any(name => alarm.AlarmName.Contains(name))) &&
                               (almIds.Count == 0 || almIds.ContainsKey(alarm.AlarmID.ToString())));
                    });

                    var temp = from alarm in ta
                               join node in nodes on new { alarm.LscID, alarm.NodeID, alarm.NodeType } equals new { node.LscID, node.NodeID, node.NodeType }
                    select alarm;

                    var record = new Report111Entity {
                        LscID     = lsc.LscID,
                        LscName   = lsc.LscName,
                        BeginTime = fromTime,
                        EndTime   = toTime,
                        Alarms    = temp.ToList(),
                        NodeCnt   = stations.Count
                    };

                    if (virtualData)
                    {
                        var parm = lscParms.Find(s => s.LscID == lsc.LscID);
                        if (parm != null && parm.StaTNumber != WebUtility.DefaultInt32)
                        {
                            record.NodeCnt = parm.StaTNumber;
                        }
                    }

                    result.Add(record);
                }
            }

            int cacheDuration = Int32.Parse(WebConfigurationManager.AppSettings["DefaultCacheDuration"]);

            HttpRuntime.Cache.Insert(cacheKey, result, null, Cache.NoAbsoluteExpiration, TimeSpan.FromSeconds(cacheDuration), CacheItemPriority.Default, null);
            return(result);
        }
コード例 #16
0
        /// <summary>
        /// Add data to cache.
        /// </summary>
        private List <Report011Entity> AddDataToCache()
        {
            var userData = UserData;
            var cacheKey = WebUtility.GetCacheKeyName(userData, "kpi-report-011");

            HttpRuntime.Cache.Remove(cacheKey);

            var lscs = new List <LscUserInfo>();

            if (LscsComboBox.SelectedIndex > 0)
            {
                var ids = WebUtility.ItemSplit(LscsComboBox.SelectedItem.Value);
                if (ids.Length == 2)
                {
                    var lscId   = Int32.Parse(ids[0]);
                    var groupId = Int32.Parse(ids[1]);
                    var lscUser = userData.LscUsers.Find(lu => { return(lu.LscID == lscId); });
                    if (lscUser != null)
                    {
                        lscs.Add(lscUser);
                    }
                }
            }
            else
            {
                lscs.AddRange(userData.LscUsers);
            }
            if (lscs.Count == 0)
            {
                return(null);
            }

            var staTypes = new Dictionary <Int32, String>();

            foreach (var dt in StaTypeMultiCombo.SelectedItems)
            {
                staTypes[Int32.Parse(dt.Value)] = dt.Text;
            }
            if (staTypes.Count == 0)
            {
                return(null);
            }

            var fromTime = DateTime.Parse(BeginFromDate.Text);
            var toTime   = DateTime.Parse(BeginToDate.Text);

            var alarmNames = new Dictionary <Int32, String>();

            foreach (var item in AlarmNameMultiCombo.SelectedItems)
            {
                alarmNames[Convert.ToInt32(item.Value)] = item.Text;
            }

            var otherEntity = new BOther();
            var nodeEntity  = new BNode();
            var lscEntity   = new BLsc();
            var alarmEntity = new BAlarm();
            var result      = new List <Report011Entity>();

            foreach (var l in lscs)
            {
                var lsc = lscEntity.GetLsc(l.LscID);
                if (lsc == null)
                {
                    continue;
                }

                var stations = otherEntity.GetStations(lsc.LscID, l.Group.GroupID).FindAll(sta => staTypes.ContainsKey(sta.StaTypeID));
                var alarms   = WebUtility.GetUserAlarms(userData).FindAll(alarm => alarm.LscID == lsc.LscID && alarm.StartTime >= fromTime && alarm.StartTime <= toTime && alarmNames.ContainsKey(alarm.AlarmID) && string.IsNullOrEmpty(alarm.ProjName));
                alarms.AddRange(alarmEntity.GetHisAlarms(lsc.LscID, lsc.LscName, userData.StandardProtocol, l.Group.GroupNodes, fromTime, toTime).FindAll(alarm => {
                    return(alarmNames.ContainsKey(alarm.AlarmID) && string.IsNullOrEmpty(alarm.ProjName));
                }));

                var nalm = from alarm in alarms
                           join sta in stations on alarm.StaName equals sta.StaName
                           select alarm;

                var parm   = Report011Entity.GetLscParam(lsc.LscID, WebUtility.CreateLscConnectionString(lsc));
                var record = new Report011Entity {
                    LscID     = lsc.LscID,
                    LscName   = lsc.LscName,
                    BeginTime = fromTime,
                    EndTime   = toTime,
                    Alarms    = nalm.Any() ? nalm.ToList() : new List <AlarmInfo>(),
                    StaCnt    = parm != null ? parm.StaMNumber : 0,
                };

                result.Add(record);
            }

            if (result.Count > 0)
            {
                result.Add(new Report011Entity {
                    LscID     = -100,
                    LscName   = "汇总(平均值)",
                    BeginTime = fromTime,
                    EndTime   = toTime,
                    Alarms    = new List <AlarmInfo>(),
                    StaCnt    = (Int32)result.Average(r => r.StaCnt)
                });
            }

            int cacheDuration = Int32.Parse(WebConfigurationManager.AppSettings["DefaultCacheDuration"]);

            HttpRuntime.Cache.Insert(cacheKey, result, null, Cache.NoAbsoluteExpiration, TimeSpan.FromSeconds(cacheDuration), CacheItemPriority.Default, null);
            return(result);
        }
コード例 #17
0
        /// <summary>
        /// Add data to cache.
        /// </summary>
        private List <Report010Entity> AddDataToCache()
        {
            var userData = UserData;
            var cacheKey = WebUtility.GetCacheKeyName(userData, "kpi-report-010");

            HttpRuntime.Cache.Remove(cacheKey);

            var lscIds = new List <int>();

            if (LscsComboBox.SelectedIndex > 0)
            {
                var ids = WebUtility.ItemSplit(LscsComboBox.SelectedItem.Value);
                if (ids.Length == 2)
                {
                    var lscId   = Int32.Parse(ids[0]);
                    var groupId = Int32.Parse(ids[1]);
                    lscIds.Add(lscId);
                }
            }
            else
            {
                lscIds.AddRange(userData.LscUsers.Select(l => l.LscID));
            }
            if (lscIds.Count == 0)
            {
                return(null);
            }

            var fromTime = DateTime.Parse(BeginFromDate.Text);
            var toTime   = DateTime.Parse(BeginToDate.Text);
            var devTypes = new Dictionary <Int32, String>();

            foreach (var dt in DevTypeMultiCombo.SelectedItems)
            {
                devTypes[Int32.Parse(dt.Value)] = dt.Text;
            }
            if (devTypes.Count == 0)
            {
                return(null);
            }

            var lscEntity   = new BLsc();
            var otherEntity = new BOther();
            var result      = new List <Report010Entity>();

            foreach (var id in lscIds)
            {
                var lsc = lscEntity.GetLsc(id);
                if (lsc == null)
                {
                    continue;
                }

                var bats    = otherEntity.GetBatStaticCount(lsc.LscID, fromTime, toTime, null, null, 1d / 24d, Int32.MaxValue);
                var devices = otherEntity.GetDevices(lsc.LscID).FindAll(d => devTypes.ContainsKey(d.AlmDevTypeID));
                var batDev  = from dev in devices
                              join bat in bats on new { dev.DevID } equals new { DevID = bat.Value }
                select dev;

                var parm = Report010Entity.GetLscParam(lsc.LscID, WebUtility.CreateLscConnectionString(lsc));
                result.Add(new Report010Entity {
                    LscID     = lsc.LscID,
                    LscName   = lsc.LscName,
                    ThisCount = batDev == null ? 0 : (fRadio.Checked ? batDev.GroupBy(d => d.StaID).Count() : batDev.GroupBy(d => d.Area3ID).Count()),
                    LastCount = parm != null ? parm.StaTNumber : 0
                });
            }

            if (result.Count > 0)
            {
                result.Add(new Report010Entity {
                    LscID     = -100,
                    LscName   = "汇总(平均值)",
                    ThisCount = (Int32)result.Average(r => r.ThisCount),
                    LastCount = (Int32)result.Average(r => r.LastCount)
                });
            }

            int cacheDuration = Int32.Parse(WebConfigurationManager.AppSettings["DefaultCacheDuration"]);

            HttpRuntime.Cache.Insert(cacheKey, result, null, Cache.NoAbsoluteExpiration, TimeSpan.FromSeconds(cacheDuration), CacheItemPriority.Default, null);
            return(result);
        }
コード例 #18
0
        /// <summary>
        /// Add Data To Cache
        /// </summary>
        private List <DevLoadPageEntity> AddDataToCache()
        {
            var userData = UserData;
            var cacheKey = WebUtility.GetCacheKeyName(userData, "dev-load-report");

            HttpRuntime.Cache.Remove(cacheKey);

            if (LscsComboBox.SelectedItem.Value == "")
            {
                return(null);
            }
            var ids = WebUtility.ItemSplit(LscsComboBox.SelectedItem.Value);

            if (ids.Length != 2)
            {
                return(null);
            }
            var lscId   = Int32.Parse(ids[0]);
            var groupId = Int32.Parse(ids[1]);
            var lsc     = new BLsc().GetLsc(lscId);

            if (lsc == null)
            {
                WebUtility.ShowMessage(EnmErrType.Warning, "无法获取Lsc信息");
                return(null);
            }

            var fromTime = DateTime.Parse(BeginDate.Text);
            var toTime   = DateTime.Parse(EndDate.Text);

            var devTypes = new Dictionary <Int32, String>();

            foreach (var dt in DevTypeMultiCombo.SelectedItems)
            {
                devTypes[Int32.Parse(dt.Value)] = dt.Text;
            }
            if (devTypes.Count == 0)
            {
                return(null);
            }

            var devices = new BOther().GetDevices(lsc.LscID, groupId);

            if (Area2ComboBox.SelectedIndex > 0)
            {
                var area2Id = Int32.Parse(Area2ComboBox.SelectedItem.Value);
                devices = devices.FindAll(s => s.Area2ID == area2Id);
            }
            if (Area3ComboBox.SelectedIndex > 0)
            {
                var area3Id = Int32.Parse(Area3ComboBox.SelectedItem.Value);
                devices = devices.FindAll(s => s.Area3ID == area3Id);
            }
            if (StaComboBox.SelectedIndex > 0)
            {
                var staId = Int32.Parse(StaComboBox.SelectedItem.Value);
                devices = devices.FindAll(s => s.StaID == staId);
            }
            if (devTypes.Count > 0)
            {
                devices = devices.FindAll(s => devTypes.ContainsKey(s.DevTypeID));
            }

            var connectionString = WebUtility.CreateLscConnectionString(lsc);
            var sdevs            = new BOther().GetSubDev(lsc.LscID, lsc.LscName, connectionString);
            var values           = new BNode().GetMaxHisAIV(lsc.LscID, fromTime, toTime);

            var temp1 = from sd in sdevs
                        join v in values on sd.AicID equals v.NodeID
                        select new {
                SubDev = sd,
                v.Value
            };

            var result = (from dev in devices
                          join t1 in temp1 on dev.DevID equals t1.SubDev.DevID into lt
                          from dt in lt.DefaultIfEmpty()
                          select new DevLoadPageEntity {
                Device = dev,
                SubDev = dt != null ? dt.SubDev : null,
                Value = dt != null ? dt.Value : 0
            }).ToList();


            var cacheDuration = Int32.Parse(WebConfigurationManager.AppSettings["DefaultCacheDuration"]);

            HttpRuntime.Cache.Insert(cacheKey, result, null, Cache.NoAbsoluteExpiration, TimeSpan.FromSeconds(cacheDuration), CacheItemPriority.Default, null);
            return(result);
        }
コード例 #19
0
        /// <summary>
        /// Add data to cache.
        /// </summary>
        private List <Report014Entity> AddDataToCache()
        {
            var userData = UserData;
            var cacheKey = WebUtility.GetCacheKeyName(userData, "kpi-report-014");

            HttpRuntime.Cache.Remove(cacheKey);

            var lscIds = new List <int>();

            if (LscsComboBox.SelectedIndex > 0)
            {
                var ids = WebUtility.ItemSplit(LscsComboBox.SelectedItem.Value);
                if (ids.Length == 2)
                {
                    var lscId   = Int32.Parse(ids[0]);
                    var groupId = Int32.Parse(ids[1]);
                    lscIds.Add(lscId);
                }
            }
            else
            {
                lscIds.AddRange(userData.LscUsers.Select(l => l.LscID));
            }
            if (lscIds.Count == 0)
            {
                return(null);
            }

            var lscEntity = new BLsc();
            var result    = new List <Report014Entity>();

            foreach (var id in lscIds)
            {
                var lsc = lscEntity.GetLsc(id);
                if (lsc == null)
                {
                    continue;
                }

                var parm   = Report014Entity.GetLscParam(lsc.LscID, WebUtility.CreateLscConnectionString(lsc));
                var record = new Report014Entity {
                    LscID     = lsc.LscID,
                    LscName   = lsc.LscName,
                    ThisCount = parm != null ? parm.StaMNumber : 0,
                    LastCount = parm != null ? parm.StaTNumber : 0,
                };

                result.Add(record);
            }

            if (result.Count > 0)
            {
                result.Add(new Report014Entity {
                    LscID     = -100,
                    LscName   = "汇总(平均值)",
                    ThisCount = (Int32)result.Average(r => r.ThisCount),
                    LastCount = (Int32)result.Average(r => r.LastCount)
                });
            }

            var cacheDuration = Int32.Parse(WebConfigurationManager.AppSettings["DefaultCacheDuration"]);

            HttpRuntime.Cache.Insert(cacheKey, result, null, Cache.NoAbsoluteExpiration, TimeSpan.FromSeconds(cacheDuration), CacheItemPriority.Default, null);
            return(result);
        }
コード例 #20
0
        /// <summary>
        /// Add data to cache.
        /// </summary>
        private List <Report007Entity> AddDataToCache()
        {
            var userData = UserData;
            var cacheKey = WebUtility.GetCacheKeyName(userData, "kpi-report-007");

            HttpRuntime.Cache.Remove(cacheKey);

            var lscIds = new List <int>();

            if (LscsComboBox.SelectedIndex > 0)
            {
                var ids = WebUtility.ItemSplit(LscsComboBox.SelectedItem.Value);
                if (ids.Length == 2)
                {
                    var lscId   = Int32.Parse(ids[0]);
                    var groupId = Int32.Parse(ids[1]);
                    lscIds.Add(lscId);
                }
            }
            else
            {
                lscIds.AddRange(userData.LscUsers.Select(l => l.LscID));
            }
            if (lscIds.Count == 0)
            {
                return(null);
            }

            var devTypes = new Dictionary <Int32, String>();

            foreach (var dt in DevTypeMultiCombo.SelectedItems)
            {
                devTypes[Int32.Parse(dt.Value)] = dt.Text;
            }
            if (devTypes.Count == 0)
            {
                return(null);
            }

            var lscEntity   = new BLsc();
            var otherEntity = new BOther();
            var result      = new List <Report007Entity>();

            foreach (var id in lscIds)
            {
                var lsc = lscEntity.GetLsc(id);
                if (lsc == null)
                {
                    continue;
                }

                var devices = otherEntity.GetDevices(lsc.LscID).FindAll(d => devTypes.ContainsKey(d.AlmDevTypeID));
                var parm    = Report007Entity.GetLscParam(lsc.LscID, WebUtility.CreateLscConnectionString(lsc));
                result.Add(new Report007Entity {
                    LscID     = lsc.LscID,
                    LscName   = lsc.LscName,
                    ThisCount = devices.Count,
                    LastCount = parm != null && parm.ElecDevTNumber != WebUtility.DefaultInt32 ? parm.ElecDevTNumber : 0
                });
            }

            if (result.Count > 0)
            {
                result.Add(new Report007Entity {
                    LscID     = -100,
                    LscName   = "汇总(平均值)",
                    ThisCount = (Int32)result.Average(r => r.ThisCount),
                    LastCount = (Int32)result.Average(r => r.LastCount)
                });
            }

            int cacheDuration = Int32.Parse(WebConfigurationManager.AppSettings["DefaultCacheDuration"]);

            HttpRuntime.Cache.Insert(cacheKey, result, null, Cache.NoAbsoluteExpiration, TimeSpan.FromSeconds(cacheDuration), CacheItemPriority.Default, null);
            return(result);
        }
コード例 #21
0
        public void ShowCmdWindow(string cmd, int lscId, int id)
        {
            try {
                StaIncludedField.Clear();
                DevIncludedField.Clear();
                StartTimeTextField.Clear();
                EndTimeTextField.Clear();
                BookingUserNameTextField.Clear();
                BookingUserPhoneTextField.Clear();
                LscCheckbox.Checked   = false;
                ProjStatusBox.Checked = false;

                WLscsComboBox.Disabled             = false;
                WProjectComboBox.Disabled          = false;
                StaIncludedField.Disabled          = false;
                DevIncludedField.Disabled          = false;
                StartTimeTextField.Disabled        = false;
                EndTimeTextField.Disabled          = false;
                BookingUserPhoneTextField.Disabled = false;
                LscCheckbox.Disabled   = false;
                ProjStatusBox.Disabled = false;
                JsonValueHF.Clear();
                AppointmentStatusBar.ClearStatus();

                var bt = DateTime.Now.AddMinutes(30);
                var et = bt.AddDays(1);
                StartTimeTextField.Text = WebUtility.GetDateString(bt);
                EndTimeTextField.Text   = WebUtility.GetDateString(et);

                switch (cmd)
                {
                case "Add":
                    AppointmentWindow.Title = "新增预约";
                    AppointmentWindow.Icon  = Icon.TagBlueAdd;
                    ProjStatusBox.Hide();

                    WLscsComboBox.GetStore().DataBind();
                    AppointmentWindow.Show();
                    break;

                case "Edit":
                    AppointmentWindow.Title = "编辑预约";
                    AppointmentWindow.Icon  = Icon.TagBlueEdit;
                    ProjStatusBox.Show();

                    var lsc = new BLsc().GetLsc(lscId);
                    if (lsc == null)
                    {
                        WebUtility.ShowMessage(EnmErrType.Warning, "无法获取Lsc信息");
                        return;
                    }

                    var connectionString = WebUtility.CreateLscConnectionString(lsc);
                    var appt             = new BAppointment().GetAppointment(lsc.LscID, lsc.LscName, id, connectionString);
                    if (appt == null)
                    {
                        WebUtility.ShowMessage(EnmErrType.Warning, "无法获取预约信息");
                        return;
                    }

                    if (!UserData.LscUsers.Any(lu => lu.LscID == appt.LscID && lu.UserID == appt.CreaterId))
                    {
                        WebUtility.ShowMessage(EnmErrType.Warning, "无编辑权限,仅预约设置人有此权限。");
                        return;
                    }

                    WLscsComboBox.Disabled    = true;
                    WProjectComboBox.Disabled = true;
                    if (appt.Status == EnmProjStatus.Using)
                    {
                        StaIncludedField.Disabled          = true;
                        DevIncludedField.Disabled          = true;
                        StartTimeTextField.Disabled        = true;
                        EndTimeTextField.Disabled          = true;
                        BookingUserPhoneTextField.Disabled = true;
                        LscCheckbox.Disabled = true;
                    }

                    JsonValueHF.Text = JsonConvert.SerializeObject(appt);
                    WLscsComboBox.SetValueAndFireSelect(appt.LscID);
                    AppointmentWindow.Show();
                    break;

                default:
                    break;
                }
            } catch (Exception err) {
                WebUtility.WriteLog(EnmSysLogLevel.Error, EnmSysLogType.Exception, err.ToString(), Page.User.Identity.Name);
                WebUtility.ShowMessage(EnmErrType.Error, err.Message);
            }
        }
コード例 #22
0
        public void ShowCmdWindow(string cmd, int lscId, string projId)
        {
            try {
                WLscsComboBox.Disabled  = false;
                ProjectIdField.Disabled = false;
                ProjectIdField.Clear();
                ProjNameField.Clear();
                StartTimeField.Clear();
                EndTimeField.Clear();
                ResponsibleField.Clear();
                PhoneField.Clear();
                CompanyField.Clear();
                CommentField.Clear();
                EnabledCheckbox.Checked = true;
                TipsStatusBar.ClearStatus();

                switch (cmd)
                {
                case "Add":
                    ProjectWindow.Title = "新增工程";
                    ProjectWindow.Icon  = Icon.TagBlueAdd;
                    WLscsComboBox.GetStore().DataBind();
                    ProjectIdField.Text    = Guid.NewGuid().ToString("D").ToUpper();
                    StartTimeField.Text    = WebUtility.GetDateString(DateTime.Today);
                    EndTimeField.Text      = WebUtility.GetDateString(DateTime.Today.AddMonths(1).AddSeconds(-1));
                    OperationWindowHF.Text = "Add";
                    ProjectWindow.Show();
                    break;

                case "Edit":
                    ProjectWindow.Title     = "编辑工程";
                    ProjectWindow.Icon      = Icon.TagBlueEdit;
                    WLscsComboBox.Disabled  = true;
                    ProjectIdField.Disabled = true;
                    OperationWindowHF.Text  = "Edit";

                    var lsc = new BLsc().GetLsc(lscId);
                    if (lsc == null)
                    {
                        WebUtility.ShowMessage(EnmErrType.Warning, "无法获取Lsc信息");
                        return;
                    }

                    var connectionString = WebUtility.CreateLscConnectionString(lsc);
                    var project          = new BAppointment().GetProject(lsc.LscID, lsc.LscName, projId, connectionString);
                    if (project == null)
                    {
                        WebUtility.ShowMessage(EnmErrType.Warning, "无法获取工程信息");
                        return;
                    }

                    WLscsComboBox.SetValueAndFireSelect(lsc.LscID);
                    ProjectIdField.Text     = project.ProjectId;
                    ProjNameField.Text      = project.ProjectName;
                    StartTimeField.Text     = WebUtility.GetDateString(project.BeginTime);
                    EndTimeField.Text       = WebUtility.GetDateString(project.EndTime);
                    ResponsibleField.Text   = project.Responsible;
                    PhoneField.Text         = project.ContactPhone;
                    CompanyField.Text       = project.Company;
                    CommentField.Text       = project.Comment;
                    EnabledCheckbox.Checked = project.Enabled;
                    ProjectWindow.Show();
                    break;

                case "Del":
                    X.Msg.Confirm("确认对话框", "您确定要删除吗?", new MessageBoxButtonsConfig {
                        Yes = new MessageBoxButtonConfig {
                            Handler = String.Format(@"
                                X.ProjectManager.Delete({0},'{1}',{{
                                success: function(result) {{
                                    MainGridPagingToolbar.doRefresh();
                                }},
                                eventMask: {{
                                    showMask: true,
                                    target: 'customtarget',
                                    msg: '正在删除中...',
                                    customTarget: MainGridPanel.body.up('div')
                                }}}});", lscId, projId),
                            Text    = "确定"
                        },
                        No = new MessageBoxButtonConfig {
                            Text = "取消"
                        }
                    }).Show();
                    break;

                default:
                    break;
                }
            } catch (Exception err) {
                WebUtility.WriteLog(EnmSysLogLevel.Error, EnmSysLogType.Exception, err.ToString(), Page.User.Identity.Name);
                WebUtility.ShowMessage(EnmErrType.Error, err.Message);
            }
        }
コード例 #23
0
ファイル: report117.aspx.cs プロジェクト: radtek/PecsSystem
        /// <summary>
        /// Add data to cache.
        /// </summary>
        private List <Report117Entity> AddDataToCache()
        {
            var userData  = UserData;
            var cacheKey1 = WebUtility.GetCacheKeyName(userData, "kpi-report-117");
            var cacheKey2 = WebUtility.GetCacheKeyName(userData, "kpi-report-117-02");

            HttpRuntime.Cache.Remove(cacheKey1);
            HttpRuntime.Cache.Remove(cacheKey2);

            var lscIds = new List <int>();

            if (LscsComboBox.SelectedIndex > 0)
            {
                var ids = WebUtility.ItemSplit(LscsComboBox.SelectedItem.Value);
                if (ids.Length == 2)
                {
                    var lscId   = Int32.Parse(ids[0]);
                    var groupId = Int32.Parse(ids[1]);
                    lscIds.Add(lscId);
                }
            }
            else
            {
                lscIds.AddRange(userData.LscUsers.Select(l => l.LscID));
            }
            if (lscIds.Count == 0)
            {
                return(null);
            }

            var fromTime = DateTime.Parse(BeginFromDate.Text);
            var toTime   = DateTime.Parse(BeginToDate.Text);

            var staTypes = new Dictionary <Int32, String>();

            foreach (var dt in StaTypeMultiCombo.SelectedItems)
            {
                staTypes[Int32.Parse(dt.Value)] = dt.Text;
            }
            if (staTypes.Count == 0)
            {
                return(null);
            }

            var devTypes = new Dictionary <Int32, String>();

            foreach (var dt in DevTypeMultiCombo.SelectedItems)
            {
                devTypes[Int32.Parse(dt.Value)] = dt.Text;
            }
            if (devTypes.Count == 0)
            {
                return(null);
            }

            var otherEntity = new BOther();
            var lscEntity   = new BLsc();
            var source1     = new List <Report117Entity>();
            var source2     = new Dictionary <String, List <StationInfo> >();

            foreach (var id in lscIds)
            {
                var lsc = lscEntity.GetLsc(id);
                if (lsc == null)
                {
                    continue;
                }

                var stations = new Dictionary <Int32, String>();
                var bats     = otherEntity.GetBatStaticCount(lsc.LscID, fromTime, toTime, null, null, 1d / 24d, Int32.MaxValue);
                if (bats != null && bats.Count > 0)
                {
                    var devices = otherEntity.GetDevices(lsc.LscID).FindAll(d => staTypes.ContainsKey(d.StaTypeID) && devTypes.ContainsKey(d.DevTypeID));
                    var temp    = from dev in devices
                                  join bat in bats on new { dev.LscID, dev.DevID } equals new { LscID = bat.ID, DevID = bat.Value }
                    select dev;

                    foreach (var t in temp)
                    {
                        stations[t.StaID] = t.StaName;
                    }
                }

                var stations1 = otherEntity.GetStations(lsc.LscID).FindAll(s => stations.ContainsKey(s.StaID));
                var stations2 = Report117Entity.GetStations(lsc.LscID, lsc.LscName, WebUtility.CreateLscConnectionString(lsc));

                var record = new Report117Entity {
                    LscID     = lsc.LscID,
                    LscName   = lsc.LscName,
                    ThisCount = stations1.Count,
                    LastCount = stations2.Count
                };

                source1.Add(record);
                source2[String.Format("{0}-ThisCount", lsc.LscID)] = stations1;
                source2[String.Format("{0}-LastCount", lsc.LscID)] = stations2;
            }

            if (source1.Count > 0)
            {
                source1.Add(new Report117Entity {
                    LscID     = -100,
                    LscName   = "汇总",
                    ThisCount = (Int32)source1.Sum(r => r.ThisCount),
                    LastCount = (Int32)source1.Sum(r => r.LastCount)
                });
            }

            int cacheDuration = Int32.Parse(WebConfigurationManager.AppSettings["DefaultCacheDuration"]);

            HttpRuntime.Cache.Insert(cacheKey1, source1, null, Cache.NoAbsoluteExpiration, TimeSpan.FromSeconds(cacheDuration), CacheItemPriority.Default, null);
            HttpRuntime.Cache.Insert(cacheKey2, source2, null, Cache.NoAbsoluteExpiration, TimeSpan.FromSeconds(cacheDuration), CacheItemPriority.Default, null);
            return(source1);
        }
コード例 #24
0
        public string Save()
        {
            try {
                if (WLscsComboBox.SelectedItem.Value != null && WLscsComboBox.SelectedItem.Value != String.Empty)
                {
                    var lscId = Int32.Parse(WLscsComboBox.SelectedItem.Value);
                    var lsc   = new BLsc().GetLsc(lscId);
                    if (lsc == null)
                    {
                        return(String.Format("{{\"Status\":{0}, \"Msg\":\"{1}\"}}", 0, "无法获取客户端信息,数据保存失败。"));
                    }
                    var lscUser = UserData.LscUsers.Find(lui => { return(lui.LscID == lsc.LscID); });
                    if (lscUser == null)
                    {
                        return(String.Format("{{\"Status\":{0}, \"Msg\":\"{1}\"}}", 0, "无法获取用户信息,数据保存失败。"));
                    }

                    var appointment = new AppointmentInfo();
                    appointment.LscID        = lsc.LscID;
                    appointment.LscName      = lsc.LscName;
                    appointment.Id           = 0;
                    appointment.StartTime    = Convert.ToDateTime(StartTimeTextField.Text);
                    appointment.EndTime      = Convert.ToDateTime(EndTimeTextField.Text);
                    appointment.LscIncluded  = LscCheckbox.Checked ? lsc.LscID : 0;
                    appointment.StaIncluded  = StaIncludedField.Text.Trim();
                    appointment.DevIncluded  = DevIncludedField.Text.Trim();
                    appointment.ProjectId    = WProjectComboBox.SelectedItem.Value;
                    appointment.ProjectName  = WProjectComboBox.SelectedItem.Text;
                    appointment.Status       = ProjStatusBox.Checked ? EnmProjStatus.End : EnmProjStatus.Start;
                    appointment.CreaterId    = lscUser.UserID;
                    appointment.Creater      = lscUser.UserName;
                    appointment.ContactPhone = BookingUserPhoneTextField.Text.Trim();
                    appointment.CreatedTime  = DateTime.Now;

                    var value = JsonValueHF.Text;
                    if (!String.IsNullOrEmpty(value))
                    {
                        var temp = JsonConvert.DeserializeObject <AppointmentInfo>(value);
                        if (temp == null)
                        {
                            return(String.Format("{{\"Status\":{0}, \"Msg\":\"{1}\"}}", 0, "格式转换错误,数据保存失败。"));
                        }

                        appointment.Id = temp.Id;
                    }

                    var connectionString = WebUtility.CreateLscConnectionString(lsc);
                    new BAppointment().SaveAppointment(new List <AppointmentInfo>()
                    {
                        appointment
                    }, connectionString);
                    var cacheKey = WebUtility.GetCacheKeyName(UserData, "appointments");
                    HttpRuntime.Cache.Remove(cacheKey);
                    return(String.Format("{{\"Status\":{0}, \"Msg\":\"{1}\"}}", 200, "数据保存成功"));
                }
            } catch (Exception err) {
                WebUtility.WriteLog(EnmSysLogLevel.Error, EnmSysLogType.Exception, err.ToString(), Page.User.Identity.Name);
                return(String.Format("{{\"Status\":{0}, \"Msg\":\"{1}\"}}", 0, err.Message));
            }
            return(String.Empty);
        }
コード例 #25
0
        /// <summary>
        /// Add data to cache.
        /// </summary>
        private List <Report113Entity> AddDataToCache()
        {
            var userData  = UserData;
            var cacheKey1 = WebUtility.GetCacheKeyName(userData, "kpi-report-113");
            var cacheKey2 = WebUtility.GetCacheKeyName(userData, "kpi-report-113-02");

            HttpRuntime.Cache.Remove(cacheKey1);
            HttpRuntime.Cache.Remove(cacheKey2);

            var lscIds = new List <int>();

            if (LscsComboBox.SelectedIndex > 0)
            {
                var ids = WebUtility.ItemSplit(LscsComboBox.SelectedItem.Value);
                if (ids.Length == 2)
                {
                    var lscId   = Int32.Parse(ids[0]);
                    var groupId = Int32.Parse(ids[1]);
                    lscIds.Add(lscId);
                }
            }
            else
            {
                lscIds.AddRange(userData.LscUsers.Select(l => l.LscID));
            }
            if (lscIds.Count == 0)
            {
                return(null);
            }

            var staTypes = new Dictionary <Int32, String>();

            foreach (var dt in StaTypeMultiCombo.SelectedItems)
            {
                staTypes[Int32.Parse(dt.Value)] = dt.Text;
            }
            if (staTypes.Count == 0)
            {
                return(null);
            }

            var devTypes = new Dictionary <Int32, String>();

            foreach (var dt in DevTypeMultiCombo.SelectedItems)
            {
                devTypes[Int32.Parse(dt.Value)] = dt.Text;
            }
            if (devTypes.Count == 0)
            {
                return(null);
            }

            var otherEntity = new BOther();
            var lscEntity   = new BLsc();
            var source1     = new List <Report113Entity>();
            var source2     = new Dictionary <String, List <DeviceInfo> >();

            var virtualData = WebConfigurationManager.AppSettings["Kpi-HeNan-Virtual-Enable"] != null && WebConfigurationManager.AppSettings["Kpi-HeNan-Virtual-Enable"].Equals("1");
            var lscParms    = new List <LscParamInfo>();

            if (virtualData)
            {
                lscParms.AddRange(otherEntity.GetLscParam());
            }

            foreach (var id in lscIds)
            {
                var lsc = lscEntity.GetLsc(id);
                if (lsc == null)
                {
                    continue;
                }

                var devices1 = otherEntity.GetDevices(lsc.LscID).FindAll(d => staTypes.ContainsKey(d.StaTypeID) && devTypes.ContainsKey(d.DevTypeID));
                var devices2 = Report113Entity.GetDevices(lsc.LscID, lsc.LscName, WebUtility.CreateLscConnectionString(lsc));

                var record = new Report113Entity {
                    LscID     = lsc.LscID,
                    LscName   = lsc.LscName,
                    ThisCount = devices1.Count,
                    LastCount = devices2.Count
                };

                if (virtualData)
                {
                    var parm = lscParms.Find(l => l.LscID == lsc.LscID);
                    if (parm != null && parm.ElecDevTNumber != WebUtility.DefaultInt32)
                    {
                        record.ThisCount = parm.ElecDevTNumber;
                    }
                }

                source1.Add(record);
                source2[String.Format("{0}-ThisCount", lsc.LscID)] = devices1;
                source2[String.Format("{0}-LastCount", lsc.LscID)] = devices2;
            }

            if (source1.Count > 0)
            {
                source1.Add(new Report113Entity {
                    LscID     = -100,
                    LscName   = "汇总",
                    ThisCount = (Int32)source1.Sum(r => r.ThisCount),
                    LastCount = (Int32)source1.Sum(r => r.LastCount)
                });
            }

            int cacheDuration = Int32.Parse(WebConfigurationManager.AppSettings["DefaultCacheDuration"]);

            HttpRuntime.Cache.Insert(cacheKey1, source1, null, Cache.NoAbsoluteExpiration, TimeSpan.FromSeconds(cacheDuration), CacheItemPriority.Default, null);
            HttpRuntime.Cache.Insert(cacheKey2, source2, null, Cache.NoAbsoluteExpiration, TimeSpan.FromSeconds(cacheDuration), CacheItemPriority.Default, null);
            return(source1);
        }
コード例 #26
0
ファイル: AlmMasking.aspx.cs プロジェクト: radtek/PecsSystem
        /// <summary>
        /// Add Data To Cache
        /// </summary>
        private List <AlmMaskEntity> AddDataToCache()
        {
            var userData = UserData;
            var cacheKey = WebUtility.GetCacheKeyName(userData, "alarm-masking-report");

            HttpRuntime.Cache.Remove(cacheKey);

            var lscs = new List <LscUserInfo>();

            if (LscsComboBox.SelectedIndex > 0)
            {
                var ids = WebUtility.ItemSplit(LscsComboBox.SelectedItem.Value);
                if (ids.Length != 2)
                {
                    return(null);
                }
                var lscId   = Int32.Parse(ids[0]);
                var groupId = Int32.Parse(ids[1]);
                var lscUser = userData.LscUsers.Find(lu => { return(lu.LscID == lscId); });
                if (lscUser == null)
                {
                    return(null);
                }
                lscs.Add(lscUser);
            }
            else
            {
                lscs.AddRange(userData.LscUsers);
            }

            var fromTime = DateTime.Parse(BeginDate.Text);
            var toTime   = DateTime.Parse(EndDate.Text);
            var maskType = MaskTypeList.SelectedItem.Value;

            var otherEntity = new BOther();
            var masks       = new List <MaskingInfo>();

            foreach (var lsc in lscs)
            {
                var _current         = new BLsc().GetLsc(lsc.LscID);
                var connectionString = WebUtility.CreateLscConnectionString(_current);
                var _masks           = otherEntity.GetMaskings(lsc.LscID, lsc.LscName, connectionString, fromTime, toTime);
                if ("1".Equals(maskType))
                {
                    _masks = _masks.FindAll(m => m.MaskType == EnmNodeType.Sta);
                }
                if ("2".Equals(maskType))
                {
                    _masks = _masks.FindAll(m => m.MaskType == EnmNodeType.Dev);
                }
                if ("3".Equals(maskType))
                {
                    _masks = _masks.FindAll(m => m.MaskType == EnmNodeType.Dic || m.MaskType == EnmNodeType.Aic);
                }
                masks.AddRange(_masks);
            }

            if (Area2ComboBox.SelectedIndex > 0)
            {
                var area2Id = Int32.Parse(Area2ComboBox.SelectedItem.Value);
                masks = masks.FindAll(s => s.Area2ID == area2Id);
            }

            if (Area3ComboBox.SelectedIndex > 0)
            {
                var area3Id = Int32.Parse(Area3ComboBox.SelectedItem.Value);
                masks = masks.FindAll(s => s.Area3ID == area3Id);
            }

            var result = new List <AlmMaskEntity>();
            var index  = 0;

            foreach (var mask in masks)
            {
                result.Add(new AlmMaskEntity {
                    ID        = ++index,
                    LscName   = mask.LscName,
                    Area1Name = mask.Area1Name,
                    Area2Name = mask.Area2Name,
                    Area3Name = mask.Area3Name,
                    StaName   = mask.StaName,
                    MaskName  = mask.MaskName,
                    MaskType  = WebUtility.GetNodeTypeName(mask.MaskType),
                    MaskTime  = WebUtility.GetDateString(mask.OpTime)
                });
            }

            var cacheDuration = Int32.Parse(WebConfigurationManager.AppSettings["DefaultCacheDuration"]);

            HttpRuntime.Cache.Insert(cacheKey, result, null, Cache.NoAbsoluteExpiration, TimeSpan.FromSeconds(cacheDuration), CacheItemPriority.Default, null);
            return(result);
        }