Exemple #1
0
        private List <(string, string, string)> GetGuns(string vehicleCn)
        {
            var typeId = _articleTypeCache.GetList().First(m => m.Cn == "A").Id;
            var guns   = _articleCache.GetList().FindAll(m => m.ArticleTypeId == typeId &&
                                                         !string.IsNullOrEmpty(m.BindInfo) && m.BindInfo.Length >= 3 && m.BindInfo.Substring(0, 3) == vehicleCn);

            List <(string, string, string)> list = new List <(string, string, string)>();

            Regex reg = new Regex(@"\d{8}");

            foreach (var gun in guns)
            {
                MatchCollection mc       = reg.Matches(gun.Name);
                var             gunIps   = gun.GunIp.Split(',');
                string          gunIp    = null;
                string          bulletNo = null;
                if (gunIps.Length == 1)
                {
                    gunIp = gunIps[0];
                }

                if (gunIps.Length == 2)
                {
                    gunIp    = gunIps[0].Trim();
                    bulletNo = gunIps[1].Trim();
                }

                if (mc.Count == 1)
                {
                    list.Add((mc[0].Groups[0].Value, gunIp, bulletNo));
                }
            }

            return(list);
        }
Exemple #2
0
        public Task <List <ComboboxItemDto> > GetComboItems(string typeName)
        {
            var lst = new List <ComboboxItemDto>();

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

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

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

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

            case "TaskTypeFee":
                foreach (TaskType t in _taskTypeCache.GetList().FindAll(x => x.isTemporary == true))
                {
                    lst.Add(new ComboboxItemDto {
                        Value = t.Id.ToString(), DisplayText = t.Name
                    });
                }
                break;

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

            case "AskOpenStyle":
                foreach (string t in _askOpenStyleItems)
                {
                    lst.Add(new ComboboxItemDto {
                        Value = t, DisplayText = t
                    });
                }
                break;

            case "BindStyle":
                foreach (string t in _bindStyleItems)
                {
                    lst.Add(new ComboboxItemDto {
                        Value = t, DisplayText = t
                    });
                }
                break;

            case "Sex":
                foreach (string t in _sexItems)
                {
                    lst.Add(new ComboboxItemDto {
                        Value = t, DisplayText = t
                    });
                }
                break;

            case "PoliticalStatus":
                foreach (string t in _politicalStatusItems)
                {
                    lst.Add(new ComboboxItemDto {
                        Value = t, DisplayText = t
                    });
                }
                break;

            case "Education":
                foreach (string t in _educationItems)
                {
                    lst.Add(new ComboboxItemDto {
                        Value = t, DisplayText = t
                    });
                }
                break;

            case "MaritalStatus":
                foreach (string t in _maritalStatusItems)
                {
                    lst.Add(new ComboboxItemDto {
                        Value = t, DisplayText = t
                    });
                }
                break;

            case "LicenseType":
                foreach (string t in _licenseTypeItems)
                {
                    lst.Add(new ComboboxItemDto {
                        Value = t, DisplayText = t
                    });
                }
                break;

            case "Status":
                foreach (string t in _statusItems)
                {
                    lst.Add(new ComboboxItemDto {
                        Value = t, DisplayText = t
                    });
                }
                break;

            case "ProcessStyle":
                foreach (string t in _processStyleItems)
                {
                    lst.Add(new ComboboxItemDto {
                        Value = t, DisplayText = t
                    });
                }
                break;

            case "Category":
                foreach (string t in _categoryItems)
                {
                    lst.Add(new ComboboxItemDto {
                        Value = t, DisplayText = t
                    });
                }
                break;

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

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

            default:
                break;
            }
            return(Task.FromResult <List <ComboboxItemDto> >(lst));
        }