private void GetPricingItemCategories(string pricingItemCategory = "0", bool forSearch = false) { var list = new List <ItemTextValueModel <string, string> >(); list.Add(new ItemTextValueModel <string, string> { Key = (forSearch ? LocalMessage.All : LocalMessage.PleaseSelect), Value = "0" }); var result = EnumConvertor.GetEnumElements <PricingItemCategory>().ToList(); result.ForEach(item => { list.Add(new ItemTextValueModel <string, string>() { Key = item.Description, Value = item.Name }); }); ViewBag.PricingItemCategories = list.Select(s => new SelectListItem { Text = s.Key, Value = s.Value.ToString(), Selected = s.Value == pricingItemCategory }).ToList(); }
private List <SelectListItem> GetTypes() => EnumConvertor.GetEnumElements <MessagingType>() .Select(x => new SelectListItem { Text = x.Description, Value = x.Name }).ToList();
private void GetMessageTypes(string messageType = nameof(LocalMessage.PleaseSelect)) { var list = new List <ItemTextValueModel <string, string> >(); list.Add(new ItemTextValueModel <string, string> { Key = LocalMessage.PleaseSelect, Value = nameof(LocalMessage.PleaseSelect) }); var result = EnumConvertor.GetEnumElements <MessagingType>().ToList(); result.ForEach(item => { if (item.Name != nameof(MessagingType.RoboTele)) { list.Add(new ItemTextValueModel <string, string>() { Key = item.Description, Value = item.Name }); } }); ViewBag.MessageTypes = list.Select(s => new SelectListItem { Text = s.Key, Value = s.Value.ToString(), Selected = s.Value == messageType }).ToList(); }
private void GetTabelName(string tabelName = nameof(LocalMessage.PleaseSelect)) { var list = new List <ItemTextValueModel <string, string> >(); list.Add(new ItemTextValueModel <string, string> { Key = LocalMessage.PleaseSelect, Value = nameof(LocalMessage.PleaseSelect) }); var result = EnumConvertor.GetEnumElements <EntityName>().ToList(); result.ForEach(item => { list.Add(new ItemTextValueModel <string, string>() { Key = ((EntityName)Enum.Parse(typeof(EntityName), item.Name)).GetLocalizeDescription(), Value = item.Name }); }); ViewBag.TabelsName = list.Select(s => new SelectListItem { Text = s.Key, Value = s.Value.ToString(), Selected = s.Value == tabelName }).ToList(); }
private List <SelectListItem> GetKeys() => EnumConvertor.GetEnumElements <ConcreteKey>() .Select(x => new SelectListItem { Text = x.Description, Value = x.Name }).ToList();
private void GetDeliverTyps(DeliveryType?deliverType = null) { var list = new List <ItemTextValueModel <string, DeliveryType?> >(); list.Add(new ItemTextValueModel <string, DeliveryType?> { Value = null, Key = LocalMessage.PleaseSelect }); var result = EnumConvertor.GetEnumElements <DeliveryType>().ToList(); result.ForEach(item => { list.Add(new ItemTextValueModel <string, DeliveryType?>() { Key = item.Description, Value = (DeliveryType)Enum.Parse(typeof(DeliveryType), item.Name) }); }); ViewBag.DeliverPaymentByMyselfStatus = list.Select(s => new SelectListItem { Text = s.Key, Value = s.Value.ToString(), Selected = (s.Value == deliverType) }).ToList(); }
private void GetOrderStatuses(OrderStatus?orderStatus = null) { var list = new List <ItemTextValueModel <string, OrderStatus?> >(); list.Add(new ItemTextValueModel <string, OrderStatus?> { Key = LocalMessage.PleaseSelect, Value = null }); var result = EnumConvertor.GetEnumElements <OrderStatus>().ToList(); result.ForEach(item => { list.Add(new ItemTextValueModel <string, OrderStatus?>() { Key = item.Description, Value = (OrderStatus)Enum.Parse(typeof(OrderStatus), item.Name) }); }); ViewBag.OrderStatuses = list.Select(s => new SelectListItem { Text = s.Key, Value = s.Value.ToString(), Selected = s.Value == orderStatus }).ToList(); }
public void PrepareRover(RoverModel model) { if (model.ErrorTracer == null) { _rover = Rover.CreateRover(this); _rover.X = model.X; _rover.Y = model.Y; _rover.Direction = EnumConvertor.ConvertCharToDirection(model); _rover.Plateau = _plateaus; if (model.X < 0 || model.X < 0) { _rover.ErrorMessage = MessageConstant.RoverPlateauCoordinateFail; } if (model.Plateau.UpperRight < model.X || model.Plateau.LowerLeft < model.X) { _rover.ErrorMessage = MessageConstant.RoverPlateauCoordinateFail; } if (model.Plateau.UpperRight < model.Y || model.Plateau.LowerLeft < model.Y) { _rover.ErrorMessage = MessageConstant.RoverPlateauCoordinateFail; } } }
public virtual ViewResult AddOrder() { ViewBag.TranslateTypes = EnumConvertor.GetEnumElements <TranslateType>() .Select(x => new SelectListItem { Text = x.Description, Value = x.Name }).ToList(); return(View(new AddOrderModel())); }
internal XbimBuildingElementProxy(XbimDocument document, XbimBuildingElementProxyType xbimBuildingElementProxyType, XbimLayerSetDirectionEnum MaterialLayersDirection, XbimDirectionSenseEnum MaterialLayersDirectionSense, float MaterialLayersOffsett) : base(document) { BaseInit(xbimBuildingElementProxyType); EnumConvertor<XbimLayerSetDirectionEnum, IfcLayerSetDirectionEnum> conv1 = new EnumConvertor<XbimLayerSetDirectionEnum, IfcLayerSetDirectionEnum>(); IfcLayerSetDirectionEnum direction = conv1.Conversion(MaterialLayersDirection); EnumConvertor<XbimDirectionSenseEnum, IfcDirectionSenseEnum> conv2 = new EnumConvertor<XbimDirectionSenseEnum, IfcDirectionSenseEnum>(); IfcDirectionSenseEnum sense = conv2.Conversion(MaterialLayersDirectionSense); _ifcBuildingElement.SetMaterialLayerSetUsage(xbimBuildingElementProxyType.IfcMaterialLayerSet, direction, sense, MaterialLayersOffsett); }
internal XbimSlabType(XbimDocument document, string name, string description, XbimSlabTypeEnum predefinedType) : base(document) { BaseInit(name); _ifcTypeProduct.Description = description; EnumConvertor<XbimSlabTypeEnum, IfcSlabTypeEnum> convertor = new EnumConvertor<XbimSlabTypeEnum, IfcSlabTypeEnum>(); IfcSlabTypeEnum type = convertor.Conversion(predefinedType); IfcSlabType.PredefinedType = type; _document.SlabTypes.Add(this); }
private static void FillValueToObject(PropertyInfo propertyInfo, object objectData, string attribute) { Type propertyType = propertyInfo.PropertyType; object value = null; if (propertyType.IsEnum) { value = EnumConvertor.ReadData(propertyType, attribute); } else { value = ValueConvertor.ReadData(propertyType, attribute); } if (null != value) { propertyInfo.SetValue(objectData, value); } }
public SerializableMap(SerializationInfo info, StreamingContext context) { this._innerCollection = new Dictionary <TKey, TValue>(UtilityConstants.DefaultEntityCount); SerializationInfoEnumerator enumerator = info.GetEnumerator(); while (enumerator.MoveNext()) { TKey key; Type keyType = typeof(TKey); if (keyType.IsEnum) { key = (TKey)EnumConvertor.ReadData(keyType, enumerator.Name); } else { key = (TKey)ValueConvertor.ReadData(keyType, enumerator.Name); } this._innerCollection.Add(key, (TValue)enumerator.Value); } }
private void GetBankName(string bankName = "PlesaseSelect") { var list = new List <ItemTextValueModel <string, string> >(); var result = EnumConvertor.GetEnumElements <BankNames>().ToList(); result.ForEach(item => { list.Add(new ItemTextValueModel <string, string>() { Key = item.Description, Value = item.Name }); }); ViewBag.BankNames = list.Select(s => new SelectListItem { Text = s.Key, Value = s.Value.ToString(), Selected = s.Value == bankName }).ToList(); }
public void SetMaterialLayerSetUsage(XbimLayerSetDirectionEnum MaterialLayersDirection, XbimDirectionSenseEnum MaterialLayersDirectionSense, float MaterialLayersOffsett) { EnumConvertor<XbimLayerSetDirectionEnum, IfcLayerSetDirectionEnum> conv1 = new EnumConvertor<XbimLayerSetDirectionEnum, IfcLayerSetDirectionEnum>(); IfcLayerSetDirectionEnum direction = conv1.Conversion(MaterialLayersDirection); EnumConvertor<XbimDirectionSenseEnum, IfcDirectionSenseEnum> conv2 = new EnumConvertor<XbimDirectionSenseEnum, IfcDirectionSenseEnum>(); IfcDirectionSenseEnum sense = conv2.Conversion(MaterialLayersDirectionSense); _ifcBuildingElement.SetMaterialLayerSetUsage(ElementType.IfcMaterialLayerSet, direction, sense, MaterialLayersOffsett); }
private IEnumerable <SelectListItem> GetOrderStatusList() => EnumConvertor.GetEnumElements <OrderStatus>().Select(x => new SelectListItem { Text = x.Description, Value = x.Name });
public void SetSlabType(XbimSlabTypeEnum slabType) { EnumConvertor<IfcSlabTypeEnum, XbimSlabTypeEnum> conv = new EnumConvertor<IfcSlabTypeEnum, XbimSlabTypeEnum>(); IfcSlabTypeEnum type = conv.Conversion(slabType); IfcSlab.PredefinedType = type; }