public Task <ExecuteResultEntity <ICollection <Manufacturers> > > GetManufacturersWithBusinessItemAsync(Guid MaterialCategoriesId, string BusinessItem)
        {
            try
            {
                ManufacturersRepository repo = RepositoryHelper.GetManufacturersRepository();
                database = repo.UnitOfWork;

                var matchedresult = (from q in repo.All()
                                     from s in q.ManufacturersBussinessItems
                                     where s.MaterialCategoriesId == MaterialCategoriesId &&
                                     s.Name.Contains(BusinessItem)
                                     select q).Distinct().ToList();

                return(Task.FromResult(ExecuteResultEntity <ICollection <Manufacturers> > .CreateResultEntity(
                                           new Collection <Manufacturers>(matchedresult))));
            }
            catch (Exception ex)
            {
                return(Task.FromResult(ExecuteResultEntity <ICollection <Manufacturers> > .CreateErrorResultEntity(ex)));
            }
        }
        /// <summary>
        /// 取得廠商代碼流水號
        /// </summary>
        /// <param name="Code"></param>
        /// <returns></returns>
        private string GetNextProjectSerialNumber()
        {
            string Code = string.Empty;
            ManufacturersRepository repo = RepositoryHelper.GetManufacturersRepository(database);
            var lastitem = repo.All()
                           .OrderByDescending(s => s.Code)
                           .FirstOrDefault();

            if (lastitem != null)
            {
                int numif = 0;
                if (int.TryParse(lastitem.Code, out numif))
                {
                    if (numif <= 99)
                    {
                        Code = string.Format("{0:00}", (numif + 1));
                        return(Code);
                    }
                }

                Dictionary <int, string> dict = new Dictionary <int, string>();
                dict.Add(0, "0");
                dict.Add(1, "1");
                dict.Add(2, "2");
                dict.Add(3, "3");
                dict.Add(4, "4");
                dict.Add(5, "5");
                dict.Add(6, "6");
                dict.Add(7, "7");
                dict.Add(8, "8");
                dict.Add(9, "9");
                dict.Add(10, "A");
                dict.Add(11, "B");
                dict.Add(12, "C");
                dict.Add(13, "D");
                dict.Add(14, "E");
                dict.Add(15, "F");
                dict.Add(16, "G");
                dict.Add(17, "H");
                dict.Add(18, "I");
                dict.Add(19, "J");
                dict.Add(20, "K");
                dict.Add(21, "L");
                dict.Add(22, "M");
                dict.Add(23, "N");
                dict.Add(24, "O");
                dict.Add(25, "P");
                dict.Add(26, "Q");
                dict.Add(27, "R");
                dict.Add(28, "S");
                dict.Add(29, "T");
                dict.Add(30, "U");
                dict.Add(31, "V");
                dict.Add(32, "W");
                dict.Add(33, "X");
                dict.Add(34, "Y");
                dict.Add(35, "Z");

                string hignchar = lastitem.Code.Substring(0, 1);
                string lowchar  = lastitem.Code.Substring(1, 1);

                int lowint  = dict.Where(w => w.Value == lowchar).Select(s => s.Key).Single();
                int highint = dict.Where(w => w.Value == hignchar).Select(s => s.Key).Single();

                if (lowint == 35)
                {
                    lowint   = 0;
                    highint += 1;
                }
                else
                {
                    lowint += 1;
                }

                Code = dict[highint] + dict[lowint];
            }
            else
            {
                Code = "01";
            }

            return(string.Format("{0:00}", Code));
        }