示例#1
0
        public List <ComboboxItemDto> GetComboItems(string name)
        {
            var lst = new List <ComboboxItemDto>();

            switch (name)
            {
            case "Depot":
                foreach (Depot t in _depotCache.GetList())
                {
                    lst.Add(new ComboboxItemDto {
                        Value = t.Id.ToString(), DisplayText = t.Name
                    });
                }
                break;

            case "DepotWithCn":
                foreach (Depot t in _depotCache.GetList())
                {
                    lst.Add(new ComboboxItemDto {
                        Value = t.Id.ToString(), DisplayText = string.Format("{0} {1}", t.Cn, t.Name)
                    });
                }
                break;

            case "GasStation":
                foreach (GasStation t in _gasStationCache.GetList())
                {
                    lst.Add(new ComboboxItemDto {
                        Value = t.Id.ToString(), DisplayText = t.Name
                    });
                }
                break;

            default:
                break;
            }
            return(lst);
        }
示例#2
0
 public Depot GetDepotByName(string name)
 {
     return(_depotCache.GetList().Find(x => x.Name == name));
 }