Beispiel #1
0
        public JsonResult GetGroupDevicePara(int id, string serverid, string communicateid, string deviceid)
        {
            DeviceGroupModel    deviceModel = DeviceGroupService.GetById(id);
            List <SelectOption> _select     = new List <SelectOption>();


            if (deviceModel != null)
            {
                string[] titles  = deviceModel.IOPARATITLES.Split(',');
                string[] ionames = deviceModel.IOPARANAMES.Split(',');
                string[] ioids   = deviceModel.IOPARAS.Split(',');
                for (int i = 0; i < titles.Length; i++)
                {
                    SelectOption _option = new SelectOption
                    {
                        id     = ioids[i],
                        name   = titles[i],
                        value  = ioids[i],
                        value1 = "/" + deviceModel.GroupId + "/" + deviceModel.IO_SERVER_ID + "/" + deviceModel.IO_COMM_ID + "/" + deviceModel.IO_DEVICE_ID + "/" + ioids[i] + "/" + deviceModel.UpdateCycle,
                    };
                    _select.Add(_option);
                }
            }

            return(Json(_select, JsonRequestBehavior.AllowGet));
        }
        public string SelectAddress(string address)
        {
            SelectOption list = cboAddresses.SelectElement();

            list.SelectByText(address);
            return(list.GetSelectedOptionText());
        }
    public HttpResponseMessage Update([FromBody] SelectOption item)
    {
        try
        {
            if (!Security.IsAuthorizedTo(BlogEngine.Core.Rights.AccessAdminSettingsPages))
            {
                throw new System.UnauthorizedAccessException();
            }

            var bs = BlogSettings.Instance;
            bs.GalleryFeedUrl = item.OptionValue;
            bs.Save();

            // remove gallery packages from the cache
            BlogEngine.Core.Blog.CurrentInstance.Cache.Remove(Constants.CacheKey);

            // remove resources from the cache to force refresh
            var cacheKey = "admin.resource.axd - " + BlogSettings.Instance.Culture;
            BlogEngine.Core.Blog.CurrentInstance.Cache.Remove(cacheKey);

            return(Request.CreateResponse(HttpStatusCode.OK));
        }
        catch (UnauthorizedAccessException)
        {
            return(Request.CreateResponse(HttpStatusCode.Unauthorized));
        }
        catch (Exception)
        {
            return(Request.CreateResponse(HttpStatusCode.InternalServerError));
        }
    }
Beispiel #4
0
        /// <summary>
        /// Get page converted to json
        /// </summary>
        /// <param name="page">Page</param>
        /// <returns>Json page</returns>
        public static PageItem GetPage(Page page)
        {
            Page         parent       = null;
            SelectOption parentOption = null;

            if (page.Parent != Guid.Empty)
            {
                parent       = Page.Pages.FirstOrDefault(p => p.Id.Equals(page.Parent));
                parentOption = new SelectOption {
                    IsSelected = false, OptionName = parent.Title, OptionValue = parent.Id.ToString()
                };
            }
            return(new PageItem
            {
                Id = page.Id,
                ShowInList = page.ShowInList,
                Title = page.Title,
                Slug = page.Slug,
                Parent = parentOption,
                Keywords = page.Keywords,
                DateCreated = page.DateCreated.ToString("yyyy-MM-dd HH:mm", CultureInfo.InvariantCulture),
                HasChildren = page.HasChildPages,
                IsPublished = page.IsPublished,
                IsFrontPage = page.IsFrontPage,
                SortOrder = page.SortOrder,
            });
        }
        // GET: Appointment/PlaceInfo
        public ActionResult Index()
        {
            List <SelectOption> dutyModelList = SelectOption.CreateList(this.CreateService <IUserAppService>().GetSimpleModels());

            this.ViewBag.UserList = dutyModelList;
            return(View());
        }
    public HttpResponseMessage Post([FromBody] SelectOption item)
    {
        try
        {
            if (!Security.IsAuthorizedTo(BlogEngine.Core.Rights.AccessAdminSettingsPages))
            {
                throw new System.UnauthorizedAccessException();
            }

            var feedSets = ExtensionManager.GetSettings(_metaExtension, _galleryFeeds);

            if (feedSets == null)
            {
                return(Request.CreateResponse(HttpStatusCode.NotFound));
            }

            feedSets.AddValues(new[] { item.OptionName, item.OptionValue });
            ExtensionManager.SaveSettings(feedSets);

            return(Request.CreateResponse(HttpStatusCode.Created));
        }
        catch (UnauthorizedAccessException)
        {
            return(Request.CreateResponse(HttpStatusCode.Unauthorized));
        }
        catch (Exception)
        {
            return(Request.CreateResponse(HttpStatusCode.InternalServerError));
        }
    }
Beispiel #7
0
        public static List <SelectOption> GetCollectionData(WidgetContext context, List <int> values = null)
        {
            if (context.ControlDefinition != null && context.ControlDefinition.CollectionId > 0)
            {
                var collInfo = context.ControlDefinition.CollectionInfo;

                if (collInfo.SourceType == DataSourceType.Enum)
                {
                    return(CollectionService.GetCollectionDataEnum(collInfo, values));
                }

                var data = CollectionService.GetCollectionData(context.ControlDefinition.CollectionId, values);
                var list = new List <SelectOption>();
                foreach (var o in data)
                {
                    if (o != null)
                    {
                        var d = new SelectOption();
                        d.Add("Value", o.Get("Value", 0));
                        d.Add("Text", o.Get("Text", ""));
                        list.Add(d);
                    }
                }

                return(list);
            }

            return(null);
        }
Beispiel #8
0
        public CreateSelectResponse Create(CreateSelectRequest request)
        {
            var response = new CreateSelectResponse();

            try
            {
                var select = request.MapTo <Select>();
                DataContext.Selects.Add(select);
                if (request.ParentId != 0)
                {
                    var parent = new Select {
                        Id = request.ParentId
                    };
                    DataContext.Selects.Attach(parent);
                    select.Parent = parent;
                }
                if (request.ParentOptionId != 0)
                {
                    var parentOption = new SelectOption {
                        Id = request.ParentOptionId
                    };
                    DataContext.SelectOptions.Attach(parentOption);
                    select.ParentOption = parentOption;
                }
                DataContext.SaveChanges();
                response.IsSuccess = true;
                response.Message   = "Select has been added successfully";
            }
            catch (DbUpdateException dbUpdateException)
            {
                response.Message = dbUpdateException.Message;
            }

            return(response);
        }
    private void Start()
    {
        _select             = GetComponent <SelectOption>();
        _select.OnSelected += AudioHandle;

        _select.InitialState(SoundManager.Instance.activeSave);
    }
Beispiel #10
0
        /// <summary>
        /// 符合种族条件
        /// </summary>
        /// <param name="minion"></param>
        /// <param name="SelectOpt"></param>
        /// <returns></returns>
        public static Boolean 符合选择条件(Card.MinionCard minion, SelectOption SelectOpt)
        {
            String strCondition = SelectOpt.EffectTargetSelectCondition;

            if (String.IsNullOrEmpty(strCondition))
            {
                return(true);
            }
            foreach (var 种族名称 in Enum.GetNames(typeof(种族Enum)))
            {
                if (种族名称 == strCondition)
                {
                    return(strCondition == minion.种族.ToString());
                }
                if (("非" + 种族名称) == strCondition)
                {
                    return(strCondition != minion.种族.ToString());
                }
            }
            switch (strCondition.Substring(1, 1))
            {
            case "+":
                return(minion.实际攻击力 >= int.Parse(strCondition.Substring(0, 1)));

            case "-":
                return(minion.实际攻击力 <= int.Parse(strCondition.Substring(0, 1)));
            }
            return(true);
        }
Beispiel #11
0
        internal static IEnumerable <T> Select <T, T1, T2, T3>(Expression <Func <T, T1, bool> > join1, Expression <Func <T1, T2, bool> > join2, Expression <Func <T2, T3, bool> > join3,
                                                               Expression <Func <T, bool> > predicate = null, string connectionName = null, DbConnection connection = null, DialectProvider provider = null, int page = 0, int pageSize = 0, int skipCount = 0, bool?cached = null,
                                                               SelectOption selectOption = SelectOption.All, IConfiguration config  = null, params Sorting <T>[] orderBy)
            where T : class
            where T1 : class
            where T2 : class
            where T3 : class
        {
            if (provider == null)
            {
                string providerName = null;
                if (connection == null)
                {
                    providerName = DbFactory.GetProviderInvariantName(connectionName, typeof(T), config);
                    connection   = DbFactory.CreateConnection(connectionName, typeof(T), config);
                }

                provider = DialectFactory.GetProvider(connection, providerName);
            }

            var sqlRoot  = SqlBuilder.GetSelectStatement(predicate, page, pageSize, skipCount, selectOption != SelectOption.All, provider, orderBy);
            var sqlJoin1 = SqlBuilder.GetSelectStatement(predicate, join1, 0, 0, 0, false, provider, orderBy);
            var sqlJoin2 = SqlBuilder.GetSelectStatement(predicate, join1, join2, 0, 0, 0, false, provider, orderBy);
            var sqlJoin3 = SqlBuilder.GetSelectStatement(predicate, join1, join2, join3, 0, 0, 0, false, provider, orderBy);

            var result = new EagerLoadEnumerable <T>(new[] { sqlRoot, sqlJoin1, sqlJoin2, sqlJoin3 }, new[] { typeof(T), typeof(T1), typeof(T2), typeof(T3) },
                                                     (s, t) => ((IMultiResult)RetrieveImplemenation <T>(s, OperationType.Sql, null, OperationReturnType.MultiResult, connectionName, connection, types: t, cached: cached, config: config)).Aggregate <T>(config), predicate, provider, selectOption, connectionName, connection, page, pageSize, skipCount, config);

            return(result);
        }
    public List <SelectOption> Get()
    {
        var    items = new List <SelectOption>();
        string url   = "https://blogengine.io/news.xml";

        try
        {
            var cnt    = 0;
            var reader = XmlReader.Create(url);
            var feed   = SyndicationFeed.Load(reader);
            reader.Close();

            foreach (SyndicationItem item in feed.Items)
            {
                var option = new SelectOption();
                option.OptionName  = item.Title.Text;
                option.OptionValue = item.Id;
                items.Add(option);
                cnt++;
                if (cnt > 5)
                {
                    break;
                }
            }
        }
        catch (Exception ex)
        {
            BlogEngine.Core.Utils.Log("Dashboard news feed", ex);
        }
        return(items);
    }
Beispiel #13
0
        public SelectStatement(SelectOption option, IDictionary <IExpression, string> selectExprList,
                               TableReferences tables, IExpression where, GroupByFragment group,
                               IExpression having, OrderByFragment order, LimitFragment limit)
        {
            if (option == null)
            {
                throw new ArgumentNullException("option");
            }
            if (selectExprList == null || selectExprList.Count == 0)
            {
                this.SelectExpressionList = new Dictionary <IExpression, string>();
            }
            else
            {
                this.SelectExpressionList = selectExprList;
            }

            this.Table  = tables;
            this.Option = option;
            this.Where  = where;
            this.Order  = order;
            this.Having = having;
            this.Group  = group;
            this.Limit  = limit;
        }
Beispiel #14
0
        private static IAsyncEnumerable <T> SelectAsync <T, T1>(Expression <Func <T, T1, bool> > join, Expression <Func <T, bool> > predicate = null, string connectionName = null, DbConnection connection = null, DialectProvider provider = null, int page = 0, int pageSize = 0,
                                                                bool?cached = null, SelectOption selectOption = SelectOption.All, params Sorting <T>[] orderBy)
            where T : class
            where T1 : class
        {
            if (provider == null)
            {
                string providerName = null;
                if (connection == null)
                {
                    providerName = DbFactory.GetProviderInvariantName(connectionName, typeof(T));
                    connection   = DbFactory.CreateConnection(connectionName, typeof(T));
                }

                provider = DialectFactory.GetProvider(connection, providerName);
            }

            var sqlRoot = SqlBuilder.GetSelectStatement(predicate, page, pageSize, selectOption != SelectOption.All, provider, orderBy);
            var sqlJoin = SqlBuilder.GetSelectStatement(predicate, join, 0, 0, false, provider, orderBy);

            var result = new EagerLoadEnumerableAsync <T>(new[] { sqlRoot, sqlJoin }, new[] { typeof(T), typeof(T1) },
                                                          (s, t) => RetrieveImplemenationAsync <T>(s, OperationType.Sql, null, OperationReturnType.MultiResult, connectionName, connection, types: t, cached: cached), predicate, provider, selectOption);

            return(result);
        }
Beispiel #15
0
 /// <exception cref="System.SqlSyntaxErrorException" />
 public DmlSelectStatement(SelectOption option,
                           IList <Pair <IExpression, string> > selectExprList,
                           TableReferences tables,
                           IExpression where,
                           GroupBy group,
                           IExpression having,
                           OrderBy order,
                           Limit limit)
 {
     if (option == null)
     {
         throw new ArgumentException("argument 'option' is null");
     }
     Option = option;
     if (selectExprList == null || selectExprList.IsEmpty())
     {
         this.selectExprList = new List <Pair <IExpression, string> >(0);
     }
     else
     {
         this.selectExprList = EnsureListType(selectExprList);
     }
     Tables = tables;
     Where  = where;
     Group  = group;
     Having = having;
     Order  = order;
     Limit  = limit;
 }
        public JsonResult Change(string Charge_Dept, string Charge_Sect)
        {
            var All = new SelectOption()
            {
                Text = "All", Value = "All"
            };
            var Empty = new SelectOption()
            {
                Text = "直屬於部", Value = " "
            };
            var result = ItemChargeUnit.DialogSelectedChange(Charge_Dept, Charge_Sect);

            if (Charge_Dept != "All")
            {
                result.Item1.Insert(0, Empty);
            }
            if (result.Item1.Count > 0)
            {
                result.Item1.Insert(0, All);
            }

            if (result.Item2.Count > 0)
            {
                result.Item2.Insert(0, All);
            }

            return(Json(result));
        }
        /// <summary>
        /// 畫面初始
        /// </summary>
        /// <returns></returns>
        public ActionResult Index()
        {
            ViewBag.opScope = GetopScope("~/ItemChargeUnit/");
            List <SelectOption> dCharge_Dept     = new List <SelectOption>();
            List <SelectOption> dCharge_Dept_MOD = new List <SelectOption>();
            List <SelectOption> dTrea_Item       = new List <SelectOption>();
            var All = new SelectOption()
            {
                Text = "All", Value = "All"
            };
            var Empty = new SelectOption()
            {
                Text = "", Value = ""
            };

            var dResult_MOD = ItemChargeUnit.FirstDropDown();
            var dResult     = ItemChargeUnit.FirstDropDown();

            dCharge_Dept = dResult.Item1;
            dTrea_Item   = dResult.Item2;
            dCharge_Dept.Insert(0, All);
            dTrea_Item.Insert(0, All);

            ViewBag.dTREA_ITEM       = new SelectList(dTrea_Item, "Value", "Text");
            ViewBag.dTREA_ITEM_MOD   = new SelectList(dResult_MOD.Item2, "Value", "Text");
            ViewBag.dCHARGE_DEPT     = new SelectList(dCharge_Dept, "Value", "Text");
            ViewBag.dCHARGE_DEPT_MOD = new SelectList(dResult_MOD.Item1, "Value", "Text");
            ViewBag.dYN_FLAG_MOD     = new SelectList(new Service.Actual.Common().GetSysCode("YN_FLAG"), "Value", "Text");
            ViewBag.dIS_DISABLED_MOD = new SelectList(new Service.Actual.Common().GetSysCode("IS_DISABLED"), "Value", "Text");
            return(View());
        }
        /// <summary>
        /// Adds an option to the list of options.
        /// </summary>
        /// <param name="p_sopOption">The option to add.</param>
        private void AddOption(SelectOption p_sopOption)
        {
            string       strName   = p_sopOption.Name;
            ListViewItem lviOption = null;

            foreach (ListViewItem lviExistingOption in lvwOptions.Items)
            {
                if (lviExistingOption.Text.Equals(strName))
                {
                    lviOption = lviExistingOption;
                    break;
                }
            }
            if (lviOption == null)
            {
                lviOption = new ListViewItem();
                lvwOptions.Items.Add(lviOption);
            }

            lviOption.Text    = strName;
            lviOption.Tag     = p_sopOption;
            lviOption.Checked = (lvwOptions.CheckBoxes && p_sopOption.IsDefault);
            if (!lvwOptions.CheckBoxes && p_sopOption.IsDefault)
            {
                lviOption.Selected = true;
            }
        }
Beispiel #19
0
        public static List <SelectOption> ToSelectOptions(this IEnumerable <BaseEntity> enumerable, bool showId = false)
        {
            bool hasPriority = true;
            var  options     = enumerable.Select(e =>
            {
                var index = 100;
                try
                {
                    if (hasPriority && (!(e.Data.Priority is DBNull) && e.Data.Priority != null))
                    {
                        index = e.Data.Priority;
                    }
                }
                catch (RuntimeBinderException)
                {
                    hasPriority = false;
                }
                string text = showId ? $"{e.Data.Name} - {e.Data.Id}" : $"{e.Data.Name}";
                var option  = new SelectOption(text, e.Data.Id.ToString())
                {
                    Index = index
                };
                return(option);
            }).ToList();

            return(options);
        }
        public Dictionary <string, object> FindByID(string pkId, SelectOption option = SelectOption.NOLOCK, bool includeArchiveTable = true)
        {
            List <string> mainTableNames = this.tableHelper.GetAllHotTableNames();//拿到所有可能的表名

            foreach (var tableName in mainTableNames)
            {
                Dictionary <string, object> results = this.tableHelper.SelectSingleInTable(tableName, pkId, option);
                if (results != null && results.Count > 0)
                {
                    return(results);
                }
            }

            if (includeArchiveTable)
            {
                List <string> archiveTableNames = this.tableHelper.GetAllArchiveTableNames();
                foreach (var tableName in archiveTableNames)
                {
                    Dictionary <string, object> results = this.tableHelper.SelectSingleInTable(tableName, pkId, option);
                    if (results != null && results.Count > 0)
                    {
                        return(results);
                    }
                }
            }

            return(null);
        }
Beispiel #21
0
        public override object ResolveDbValue(DbObject db)
        {
            List <SelectOption> v = null;
            var d       = db.Get <int[]>(this.DBName, null);
            var reldata = db.Get <string[]>(this.DBName + "__data", null);

            if (d != null)
            {
                v = new List <SelectOption>();
                for (int i = 0; i < d.Length; i++)
                {
                    var option = new SelectOption();
                    if (this.ControlInfo.CollectionInfo.SourceType == DataSourceType.Enum)
                    {
                        option = GetEnumValue(d[i]);
                    }
                    else
                    {
                        option.Add("Value", d[i]);
                        option.Add("Text", reldata[i]);
                    }
                    v.Add(option);
                }
            }

            return(v);
        }
Beispiel #22
0
        public JsonResult GetItemType(string EnCode)
        {
            ItemsModel          Item    = ItemServer.GetItemByEnCode(EnCode);
            List <SelectOption> _select = new List <SelectOption>();


            IEnumerable <ItemsDetailModel> detailList = ItemDetailServer.GetByWhere(" where ItemId=" + Item.Id, null, " ItemCode,ItemName");

            if (detailList != null && detailList.Count() > 0)
            {
                foreach (var detail in detailList)
                {
                    SelectOption _option = new SelectOption
                    {
                        id    = detail.ItemCode.ToString(),
                        name  = detail.ItemName,
                        value = detail.ItemName
                    };
                    _select.Add(_option);
                }
            }


            return(Json(_select, JsonRequestBehavior.AllowGet));
        }
Beispiel #23
0
            public static List <SelectOption> GetOptionsFromSelectNode(HtmlNode selectNode)
            {
                var options = new List <SelectOption>();

                // to get options and their values, we have to go through all of this <select>'s child nodes.
                // <option> text shows up in text nodes following <option> nodes.
                // we build up a list of SelectOptions that we can use to determine the value;
                foreach (var childNode in selectNode.ChildNodes)
                {
                    // add <option> to list
                    if (childNode.Name == "option")
                    {
                        var option = new SelectOption();
                        option.IsSelected = (childNode.Attributes.Contains("selected") && childNode.Attributes["selected"].Value != "false");
                        option.Node       = childNode;
                        if (childNode.Attributes.Contains("value") && childNode.Attributes["value"].Value.Trim().Length > 0)
                        {
                            option.Value = childNode.Attributes["value"].Value;
                        }
                        options.Add(option);

                        // add this text to the last <option> in the list
                    }
                    else if (childNode.NodeType == HtmlNodeType.Text && options.Count > 0)
                    {
                        options[options.Count - 1].Text += childNode.InnerText;
                    }
                }

                return(options);
            }
Beispiel #24
0
        static void Main()
        {
            Console.SetWindowSize(120, 41);
            Console.CursorVisible = false;
            Interfaz.BarraCarga();

            SelectOption leer = MainMenu.Menu();

            switch (leer)
            {
            case SelectOption.Jugar:
                Console.WriteLine(leer);
                break;

            case SelectOption.Personalizar:
                Console.WriteLine(leer);
                break;

            case SelectOption.Ayuda:
                Console.WriteLine(leer);
                break;

            case SelectOption.Salir:

                return;
            }

            Console.ReadKey();
        }
        public override object ResolveDbValue(DbObject db)
        {
            List <SelectOption> v = null;
            var d       = db.Get <int[]>(this.Name, null);
            var reldata = db.Get <string[]>(this.Name + "__data", null);

            if (d != null)
            {
                v = new List <SelectOption>();
                for (int i = 0; i < d.Length; i++)
                {
                    var option = new SelectOption();
                    option.Add("Value", d[i]);
                    option.Add("Text", reldata[i]);
                    v.Add(option);
                }
            }
            // var relData = db.Get<IEnumerable<DbObject>>(this.DBName + "__data", null);

            // if (relData != null)
            // {
            //     v = new List<SelectOption>();
            //     foreach(DbObject obj in relData)
            //     {
            //         var option = new SelectOption();
            //         option.Add("Value", obj.Get("ID", 0));
            //         option.Add("Text", obj.Get("NAME", ""));
            //         v.Add(option);
            //     }
            // }

            return(v);
        }
Beispiel #26
0
        /// <summary>
        /// 畫面初始
        /// </summary>
        /// <returns></returns>
        public ActionResult Index()
        {
            ViewBag.opScope = GetopScope("~/ItemMaintain/");
            var empty = new SelectOption()
            {
                Text = " ", Value = " "
            };

            ViewBag.dITEM_OP_TYPE = new SelectList(new Service.Actual.Common().GetSysCode("ITEM_OP_TYPE", true), "Value", "Text");
            ViewBag.dISDO_PERDAY  = new SelectList(new Service.Actual.Common().GetSysCode("YN_FLAG", true), "Value", "Text");
            ViewBag.dIS_DISABLED  = new SelectList(new Service.Actual.Common().GetSysCode("IS_DISABLED", true), "Value", "Text");

            var _TREA_ITEM_TYPE = new Service.Actual.Common().GetSysCode("TREA_ITEM_TYPE");

            _TREA_ITEM_TYPE.Insert(0, empty);
            var _TREA_ITEM_NAME = new Service.Actual.Common().GetSysCode("TREA_ITEM_NAME");

            _TREA_ITEM_NAME.Insert(0, empty);

            ViewBag.dITEM_OP_TYPE_MOD   = new SelectList(new Service.Actual.Common().GetSysCode("ITEM_OP_TYPE"), "Value", "Text");
            ViewBag.dYN_FLAG_MOD        = new SelectList(new Service.Actual.Common().GetSysCode("YN_FLAG"), "Value", "Text");
            ViewBag.dTREA_ITEM_TYPE_MOD = new SelectList(_TREA_ITEM_TYPE, "Value", "Text");
            ViewBag.dTREA_ITEM_NAME_MOD = new SelectList(_TREA_ITEM_NAME, "Value", "Text");
            ViewBag.dIS_DISABLED_MOD    = new SelectList(new Service.Actual.Common().GetSysCode("IS_DISABLED"), "Value", "Text");
            return(View());
        }
 /// <exception cref="System.SqlSyntaxErrorException" />
 public DmlSelectStatement(SelectOption option,
                           IList<Pair<IExpression, string>> selectExprList,
                           TableReferences tables,
                           IExpression where,
                           GroupBy group,
                           IExpression having,
                           OrderBy order,
                           Limit limit)
 {
     if (option == null)
     {
         throw new ArgumentException("argument 'option' is null");
     }
     Option = option;
     if (selectExprList == null || selectExprList.IsEmpty())
     {
         this.selectExprList = new List<Pair<IExpression, string>>(0);
     }
     else
     {
         this.selectExprList = EnsureListType(selectExprList);
     }
     Tables = tables;
     Where = where;
     Group = group;
     Having = having;
     Order = order;
     Limit = limit;
 }
        public static List <SelectOption> GetCollectionDataEnum(CollectionInfo collectionInfo, List <int> values = null)
        {
            Type enumType = Type.GetType(collectionInfo.SourceExp);

            FieldInfo[] fields = enumType.GetFields();
            var         list   = new List <SelectOption>();

            foreach (var field in fields)
            {
                if (field.Name.Equals("value__"))
                {
                    continue;
                }

                var v = (int)field.GetRawConstantValue();
                if (values != null)
                {
                    if (!values.Contains(v))
                    {
                        continue;
                    }
                }

                var d = new SelectOption();
                d.Add("Value", v);
                d.Add("Text", field.Name);
                list.Add(d);
            }

            return(list);
        }
        static PageDetail ToJsonDetail(Page page)
        {
            Page         parent       = null;
            SelectOption parentOption = null;

            if (page.Parent != Guid.Empty)
            {
                parent       = Page.Pages.FirstOrDefault(p => p.Id.Equals(page.Parent));
                parentOption = new SelectOption {
                    IsSelected = false, OptionName = parent.Title, OptionValue = parent.Id.ToString()
                };
            }
            return(new PageDetail
            {
                Id = page.Id,
                ShowInList = page.ShowInList,
                Title = page.Title,
                Slug = page.Slug,
                RelativeLink = page.RelativeLink,
                Content = page.Content,
                Parent = parentOption,
                Description = page.Description,
                Keywords = page.Keywords,
                DateCreated = page.DateCreated.ToString("yyyy-MM-dd HH:mm"),
                HasChildren = page.HasChildPages,
                IsPublished = page.IsPublished,
                IsFrontPage = page.IsFrontPage,
                IsDeleted = page.IsDeleted,
                SortOrder = page.SortOrder,
            });
        }
Beispiel #30
0
        public ActionResult Action(string id)
        {
            ActionModel act = new ActionModel();

            List <SelectOption> actionList = SelectOption.CreateList(IdalCommon.IactionEx.getEntityList(), "id", "actionname");

            this.ViewBag.ActionList = actionList;

            this.ViewBag.ActionListString = actionList.ToJson();
            if (id != null)
            {
                var aa = IdalCommon.IactionEx.getEntityById(int.Parse(id));
                act.id            = aa.id.ToString();
                act.actionname    = aa.actionname;
                act.actioncode    = aa.actioncode;
                act.controlername = aa.controlername;
                act.actionurl     = aa.actionurl;
                act.actionparam   = aa.actionparam;
                act.actionowner   = aa.actionowner;
                act.MarkdownCode  = null;
            }
            this.ViewBag.Act = act;

            return(View());
        }
Beispiel #31
0
        /// <summary>
        /// 实现圆选择查询
        /// </summary>
        /// <param name="control">地图视图控件</param>
        /// <param name="dataType">选择数据时的数据类型过滤</param>
        /// <param name="attctr">属性视图控件</param>
        /// <param name="seltype">查询选择方式:圆查询 </param>
        public CirSelectToolClass(MapGIS.GISControl.MapControl control, SelectDataType dataType, AttControl attctr, SelectType seltype)
            : base()
        {
            this.mapCtrl    = control;
            this.dataType   = dataType;
            this.attCtrl    = attctr;
            this.selectType = seltype;

            //查询选择项
            SelectOption selOpt = new SelectOption();

            selOpt.DataType  = dataType;               //选择数据时的类型过滤类型
            selOpt.SelMode   = SelectMode.Multiply;    //选择模式
            selOpt.UnMode    = UnionMode.Xor;          //结果数据合并模式
            selOpt.LayerCtrl = SelectLayerControl.All; //选择数据时的图层过滤类型

            //创建圆交互工具
            selTool           = new SelectTool(control, selectType, selOpt, SpaQueryMode.MBRIntersect, control.Transformation);
            selTool.Selected += new SelectTool.SelectHandler(selTool_Selected);
            this.Active      += new ToolEventHandler(CirSelectToolClass_Active);
            this.Unactive    += new ToolEventHandler(CirSelectToolClass_Unactive);
            this.Cancel      += new ToolEventHandler(CirSelectToolClass_Cancel);
            this.PreRefresh  += new ToolEventHandler(CirSelectToolClass_PreRefresh);
            this.PostRefresh += new ToolEventHandler(CirSelectToolClass_PostRefresh);
        }
        public ActionResult Index()
        {
            DateTime dt = DateTime.Now;
            DateTime startMonth = dt.AddDays(1 - dt.Day);
            DateTime endMonth = startMonth.AddMonths(1).AddDays(-1);
            ViewData["mStart"] = startMonth.ToString("yyyy-MM-dd");
            ViewData["mEnd"] = endMonth.ToString("yyyy-MM-dd");

            List<SelectOption> cc_list = new List<SelectOption>();
            var slist = DbContext.STOREINFO.ToList();
            foreach (var item in slist)
            {
                SelectOption temp = new SelectOption(item.GUID.ToString(), item.STORENAME);
                cc_list.Add(temp);
            }

            ViewData["StoreInfo"] = cc_list;
            return View();
        }
		/// <summary>
		/// Adds an option to the list of options.
		/// </summary>
		/// <param name="p_sopOption">The option to add.</param>
		private void AddOption(SelectOption p_sopOption)
		{
			string strName = p_sopOption.Name;
			ListViewItem lviOption = null;
			foreach (ListViewItem lviExistingOption in lvwOptions.Items)
				if (lviExistingOption.Text.Equals(strName))
				{
					lviOption = lviExistingOption;
					break;
				}
			if (lviOption == null)
			{
				lviOption = new ListViewItem();
				lvwOptions.Items.Add(lviOption);
			}

			lviOption.Text = strName;
			lviOption.Tag = p_sopOption;
			lviOption.Checked = (lvwOptions.CheckBoxes && p_sopOption.IsDefault);
			if (!lvwOptions.CheckBoxes && p_sopOption.IsDefault)
				lviOption.Selected = true;
		}
Beispiel #34
0
            public static List<SelectOption> GetOptionsFromSelectNode(HtmlNode selectNode)
            {
                var options = new List<SelectOption>();

                // to get options and their values, we have to go through all of this <select>'s child nodes.
                // <option> text shows up in text nodes following <option> nodes.
                // we build up a list of SelectOptions that we can use to determine the value;
                foreach (var childNode in selectNode.ChildNodes) {
                    // add <option> to list
                    if (childNode.Name == "option") {
                        var option        = new SelectOption();
                        option.IsSelected = (childNode.Attributes.Contains("selected") && childNode.Attributes["selected"].Value != "false");
                        option.Node       = childNode;
                        if (childNode.Attributes.Contains("value") && childNode.Attributes["value"].Value.Trim().Length > 0)
                            option.Value = childNode.Attributes["value"].Value;
                        options.Add(option);

                        // add this text to the last <option> in the list
                    } else if (childNode.NodeType == HtmlNodeType.Text && options.Count > 0) {
                        options[options.Count - 1].Text += childNode.InnerText;
                    }
                }

                return options;
            }
 public static MvcHtmlString UxSelectOption(this HtmlHelper htmlHelper, string text, string value, bool selected = false, IconType iconType = null, string subText = null, bool divider = false, bool disabled = false, string clientId = null)
 {
     var option = new SelectOption(text, value, selected, iconType, subText, divider, disabled, clientId);
     return UxSelectOption(htmlHelper, option);
 }
 public static MvcHtmlString UxSelectOption(this HtmlHelper htmlHelper, SelectOption option)
 {
     return htmlHelper.RenderUxControl(option);
 }
Beispiel #37
0
        public bool QPHONEMS_SaharaOpenPortWithChipValidation(int Index, int Port, SelectOption EnableValidation, ulong MsmIdReferenceVal, out ulong MSM_ID, out ulong Version, SaharaDownloadMode mode, ulong timeout)
        {
            //ulong version = 0x00; ;
            Version = 0x00;
            MSM_ID = 0x00;
            string pkhash = "";
            SetText(TextMessage[Index], Index, "QPHONEMS_SaharaOpenPortWithChipValidation \r\n");
            try
            {
                //phone[Index].SetLibraryMode(LibraryModeEnum.QPhoneMS);
                SetText(TextMessage[Index], Index, "Connecting to phone " + Port.ToString());
                phone[Index].ConnectToServer_Sahara((uint)Port, ref Version, ref MsmIdReferenceVal, ref MSM_ID, ref pkhash, (int)mode, timeout);
                SetText(TextMessage[Index], Index, "Sahara protocol version supported by the device = " + Version);
                SetText(TextMessage[Index], Index, "MSM ID = " + MSM_ID);

                if (EnableValidation == SelectOption.Yes && MsmIdReferenceVal != MSM_ID)
                {
                    SetText(TextMessage[Index], Index, "Reference ID " + MsmIdReferenceVal + " is not matched with MSM_ID " + MSM_ID);
                    return false;
                }
                return true;

            }
            catch (Exception ex)
            {
                SetText(TextMessage[Index], Index, ex.Message);
                return false;
            }
        }
 public static MvcHtmlString UxSelectDivider(this HtmlHelper htmlHelper)
 {
     var option = new SelectOption(null, null, false, null, null, true, false);
     return UxSelectOption(htmlHelper, option);
 }