コード例 #1
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);
            }
        }
コード例 #2
0
        /// <summary>
        /// Event Type ComboBox Refresh
        /// </summary>
        protected void OnEventTypeRefresh(object sender, StoreRefreshDataEventArgs e)
        {
            var data = new List <object>();

            data.Add(new { Id = 0, Name = WebUtility.GetOpEventTypeName(0) });
            data.Add(new { Id = 1, Name = WebUtility.GetOpEventTypeName(1) });
            data.Add(new { Id = 2, Name = WebUtility.GetOpEventTypeName(2) });
            data.Add(new { Id = 3, Name = WebUtility.GetOpEventTypeName(3) });
            data.Add(new { Id = 4, Name = WebUtility.GetOpEventTypeName(4) });
            data.Add(new { Id = 5, Name = WebUtility.GetOpEventTypeName(5) });

            EventTypeStore.DataSource = data;
            EventTypeStore.DataBind();
        }