Exemplo n.º 1
0
 public static int GetNumberOfPartners(string datubaze)
 {
     int result;
     using (TildesJumisFinancialDBContext dbContext = new TildesJumisFinancialDBContext())
     {
         dbContext.ChangeDatabase(datubaze, "", "admin", "is ri itldes ajuna aprole", false, "");
         List<Partner> partners = (from x in dbContext.Partners
                                   select x into d
                                   orderby d.PartnerName
                                   select d).ToList<Partner>();
         if (!partners.Any<Partner>())
         {
             result = 0;
         }
         else
         {
             result = partners.Count;
         }
     }
     return result;
 }
Exemplo n.º 2
0
 public static List<PartnerCustomModel> GetSelectListPartners(string datubaze, string searchTerm)
 {
     List<PartnerCustomModel> partnerCustomModels = new List<PartnerCustomModel>();
     List<PartnerCustomModel> result;
     using (TildesJumisFinancialDBContext dbContext = new TildesJumisFinancialDBContext())
     {
         dbContext.ChangeDatabase(datubaze, "", "admin", "is ri itldes ajuna aprole", false, "");
         List<Partner> partners;
         if (string.IsNullOrEmpty(searchTerm))
         {
             partners = (from x in dbContext.Partners
                         select x into d
                         orderby d.PartnerName
                         select d).ToList<Partner>();
         }
         else
         {
             partners = (from x in dbContext.Partners
                         where x.PartnerName.Contains(searchTerm) || x.PhysicalPersonFirstName.Contains(searchTerm) || x.PartnerTitle.Contains(searchTerm)
                         select x into d
                         orderby d.PartnerName
                         select d).ToList<Partner>();
         }
         if (!partners.Any<Partner>())
         {
             result = null;
         }
         else
         {
             Mapper.CreateMap<Partner, PartnerCustomModel>();
             partnerCustomModels = Mapper.Map<List<Partner>, List<PartnerCustomModel>>(partners);
             partnerCustomModels.ForEach(delegate(PartnerCustomModel x)
             {
                 x.SelectedDatabaseName = datubaze;
             });
             result = partnerCustomModels;
         }
     }
     return result;
 }