示例#1
0
        public IEnumerable <Contractor> SearchContractors(TypeSearchContractor type, string text)
        {
            switch (type)
            {
            case TypeSearchContractor.LastName:
            {
                return(_logic.GetContractors().Where(x => x.LastName.Contains(text)).ToList());
            }

            case TypeSearchContractor.Inn:
            {
                return(_logic.GetContractors().Where(x => x.LegalPerson.Inn.Contains(text)).ToList());
            }

            case TypeSearchContractor.Organization:
            {
                return(_logic.GetContractors().Where(x => x.LegalPerson.Name.Contains(text)).ToList());
            }

            case TypeSearchContractor.Empty:
            {
                return(_logic.GetContractors().ToList());
            }

            default:
                throw new NotImplementedException($"Not Implemented search for{type}");
            }
        }
示例#2
0
        public IEnumerable <IContractor> SearchContractors(TypeSearchContractor type, string text)
        {
            try
            {
                using (var context = IoC.Resolve <IAimpContext>())
                {
                    switch (type)
                    {
                    case TypeSearchContractor.LastName:
                    {
                        return(context.Contractors
                               .All(x => x.LegalPerson, x => x.City, x => x.Region)
                               .Where(x => x.LastName.Contains(text)).ToList());
                    }

                    case TypeSearchContractor.Inn:
                    {
                        return(context.Contractors
                               .All(x => x.LegalPerson, x => x.City, x => x.Region)
                               .Where(x => x.LegalPerson.Inn.Contains(text)).ToList());
                    }

                    case TypeSearchContractor.Organization:
                    {
                        return(context.Contractors
                               .All(x => x.LegalPerson, x => x.City, x => x.Region)
                               .Where(x => x.LegalPerson.Name.Contains(text)).ToList());
                    }

                    case TypeSearchContractor.Empty:
                    {
                        return(context.Contractors
                               .All(x => x.LegalPerson, x => x.City, x => x.Region).ToList());
                    }

                    default:
                        throw new NotImplementedException($"Not Implemented search for type: {type}");
                    }
                }
            }
            catch (Exception ex)
            {
                LoggerProvider.Logger.Log(ex);
                throw;
            }
        }
示例#3
0
 public SearchContractorResult SearchContractors(TypeSearchContractor type, string text)
 {
     try
     {
         _WriteLineConsole($"Search contractor where {text}");
         using (var helper = new TransactionInfoHelper())
             return new SearchContractorResult()
                    {
                        Contractors = helper.SearchContractors(type, text)
                    };
     }
     catch (Exception ex)
     {
         _WriteLineError($"Search contractor where {text}", ex.Message);
         return(new SearchContractorResult()
         {
             Error = true,
             Message = ex.Message
         });
     }
 }
示例#4
0
 public IEnumerable <IContractor> SearchContractors(TypeSearchContractor type, string text)
 {
     throw new NotImplementedException();
 }