Пример #1
0
        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();
        }
Пример #2
0
        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();
        }
Пример #3
0
        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();
        }
Пример #4
0
        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 List <SelectListItem> GetKeys()
 => EnumConvertor.GetEnumElements <ConcreteKey>()
 .Select(x => new SelectListItem
 {
     Text  = x.Description,
     Value = x.Name
 }).ToList();
Пример #7
0
        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();
        }
Пример #8
0
 public virtual ViewResult AddOrder()
 {
     ViewBag.TranslateTypes = EnumConvertor.GetEnumElements <TranslateType>()
                              .Select(x => new SelectListItem
     {
         Text  = x.Description,
         Value = x.Name
     }).ToList();
     return(View(new AddOrderModel()));
 }
Пример #9
0
        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();
        }
 private IEnumerable <SelectListItem> GetOrderStatusList() =>
 EnumConvertor.GetEnumElements <OrderStatus>().Select(x => new SelectListItem
 {
     Text  = x.Description,
     Value = x.Name
 });