当前位置: 首页>>代码示例>>C#>>正文


C# DataAccess.ReadInto方法代码示例

本文整理汇总了C#中DataAccess.ReadInto方法的典型用法代码示例。如果您正苦于以下问题:C# DataAccess.ReadInto方法的具体用法?C# DataAccess.ReadInto怎么用?C# DataAccess.ReadInto使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在DataAccess的用法示例。


在下文中一共展示了DataAccess.ReadInto方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: GetRandomHero

 public Hero GetRandomHero(int languageId)
 {
     using (var db = new DataAccess())
     {
         db.CreateStoredProcCommand("dbo.GetRandomHero");
         db.AddInputParameter("@LanguageId", DbType.Int32, languageId);
         var hero = new Hero();
         try
         {
             db.ReadInto(hero, hero.MilitaryGroup, hero.MilitaryRank, hero.MilitaryAward, hero.Photos);
             GetBlobs(hero, new CloudDataAccess());
         }
         catch (Exception ex)
         {
             Logger.Error("Error while getting random hero", ex);
             throw;
         }
         return hero;
     }
 }
开发者ID:August2008,项目名称:August2008.org,代码行数:20,代码来源:HeroRepository.cs

示例2: RefundDonation

 public Donation RefundDonation(string externalId, string externalStatus)
 {
     using (var db = new DataAccess())
     {
         db.CreateStoredProcCommand("dbo.RefundDonation");
         db.AddInputParameter("@ExternalId", externalId);
         db.AddInputParameter("@ExternalStatus", externalStatus);
         try
         {
             var donation = new Donation();
             db.ReadInto(donation);
             return donation;
         }
         catch (Exception ex)
         {
             Log.Error("Error while refunding donation.", ex);
             throw;
         }
     }
 }
开发者ID:August2008,项目名称:August2008.org,代码行数:20,代码来源:DonationRepository.cs

示例3: GetLanguages

 public IEnumerable<Language> GetLanguages()
 {
     List<Language> languages;
     if (!Cache.TryGetObject("Languages", out languages))
     {
         using (var db = new DataAccess())
         {
             db.CreateStoredProcCommand("dbo.GetLanguages");
             languages = new List<Language>();
             try
             {
                 db.ReadInto(languages);
             }
             catch (Exception)
             {
                 throw;
             }
         }
     }
     return languages;
 }
开发者ID:August2008,项目名称:August2008.org,代码行数:21,代码来源:MetadataRepository.cs

示例4: GetMilitaryGroups

 public IEnumerable<MilitaryGroup> GetMilitaryGroups(int languageId)
 {
     List<MilitaryGroup> groups;
     if (!Cache.TryGetObject("MilitaryGroups" + languageId, out groups))
     {
         using (var db = new DataAccess())
         {
             db.CreateStoredProcCommand("dbo.GetMilitaryGroups");
             db.AddInputParameter("@LanguageId", DbType.Int32, languageId);
             groups = new List<MilitaryGroup>();
             try
             {
                 db.ReadInto(groups);
             }
             catch (Exception)
             {
                 throw;
             }
         }
     }
     return groups;
 }
开发者ID:August2008,项目名称:August2008.org,代码行数:22,代码来源:MetadataRepository.cs

示例5: GetUser

 public User GetUser(int userId)
 {
     var user = new User();
     using (var db = new DataAccess())
     {
         db.CreateStoredProcCommand("dbo.GetUserByUserId");
         db.AddInputParameter("@UserId", DbType.Int32, userId);
         try
         {
             db.ReadInto(user,
                         user.Profile,
                         user.Profile.Lang,
                         user.OAuth,
                         user.Roles);
         }
         catch (Exception ex)
         {
             Logger.Error("Error while getting user.", ex);
             throw;
         }
     }
     return user;
 }
开发者ID:August2008,项目名称:August2008.org,代码行数:23,代码来源:AccountRepository.cs

示例6: SearchHeros

        public HeroSearchCriteria SearchHeros(HeroSearchCriteria criteria)
        {
            var heros = new List<Hero>();
            var photos = new List<HeroPhoto>();

            using (var db = new DataAccess())
            {
                db.CreateStoredProcCommand("dbo.GetHeros");
                db.AddInputParameter("@PageNo", DbType.Int32, criteria.PageNo);
                db.AddInputParameter("@Name", DbType.String, criteria.Name);
                db.AddInputParameter("@PageSize", DbType.Int32, criteria.PageSize);
                db.AddInputParameter("@LanguageId", DbType.Int32, criteria.LanguageId);
                db.AddOutputParameter("@TotalCount", DbType.Int32);
                try
                {
                    db.ReadInto(heros, photos);
                    heros.ForEach(x => x.Photos = photos.Where(y => y.HeroId == x.HeroId));
                    GetBlobs(heros, new CloudDataAccess());
                    criteria.Result = heros;
                    criteria.TotalCount = db.GetParameterValue<int>("@TotalCount");
                }
                catch (Exception ex)
                {
                    Logger.Error("Error while searching hero", ex);
                    throw;
                }
                return criteria;
            }
        }
开发者ID:August2008,项目名称:August2008.org,代码行数:29,代码来源:HeroRepository.cs

示例7: DeletePhoto

 public HeroPhoto DeletePhoto(int heroPhotoId)
 {
     using (var db = new DataAccess())
     {
         db.CreateStoredProcCommand("dbo.DeleteHeroPhoto");
         db.AddInputParameter("@HeroPhotoId", DbType.Int32, heroPhotoId);
         var photo = new HeroPhoto();
         try
         {
             db.ReadInto(photo);
             DeleteBlob(photo);
         }
         catch (Exception ex)
         {
             Logger.Error("Error while deleting hero", ex);
             throw;
         }
         return photo;
     }
 }
开发者ID:August2008,项目名称:August2008.org,代码行数:20,代码来源:HeroRepository.cs

示例8: GetDonationSubscription

 public DonationSubscription GetDonationSubscription(string subscriptionId)
 {
     using (var db = new DataAccess())
     {
         db.CreateStoredProcCommand("dbo.GetDonationSubscription");
         db.AddInputParameter("@SubscriptionId", subscriptionId);
         try
         {
             var subscription = new DonationSubscription();
             db.ReadInto(subscription);
             return subscription;
         }
         catch (Exception ex)
         {
             Log.Error("Error while gettng subscription.", ex);
             throw;
         }
     }
 }
开发者ID:August2008,项目名称:August2008.org,代码行数:19,代码来源:DonationRepository.cs

示例9: GetDonationLocations

 private List<MapPoint> GetDonationLocations(string sproc, MapPoint northwest, MapPoint southeast)  
 {            
     using (var db = new DataAccess())
     {
         db.CreateStoredProcCommand(sproc);
         db.AddInputParameter("@NwLat", DbType.Double, northwest.Latitude);
         db.AddInputParameter("@NwLng", DbType.Double, northwest.Longitude);
         db.AddInputParameter("@SeLat", DbType.Double, southeast.Latitude);
         db.AddInputParameter("@SeLng", DbType.Double, southeast.Longitude);
         try
         {
             var points = new List<MapPoint>();
             db.ReadInto(points);
             return points;
         }
         catch (Exception ex)
         {
             Log.Error("Error while searching donations.", ex);
             throw;
         }
     }  
 }
开发者ID:August2008,项目名称:August2008.org,代码行数:22,代码来源:DonationRepository.cs

示例10: SearchDonations

 public DonationSearchCriteria SearchDonations(DonationSearchCriteria criteria)
 {
     using (var db = new DataAccess())
     {
         db.CreateStoredProcCommand("dbo.SearchDonations");
         db.AddInputParameter("@UserId", DbType.Int32, criteria.UserId);
         db.AddInputParameter("@Name", DbType.String, criteria.Name);
         db.AddInputParameter("@FromDate", DbType.DateTime, criteria.FromDate.ToFromDate());
         db.AddInputParameter("@ToDate", DbType.DateTime, criteria.ToDate.ToToDate());
         try
         {
             criteria.Result = new List<Donation>();
             db.ReadInto(criteria.Result);
         }
         catch (Exception ex)
         {
             Log.Error("Error while searching donations.", ex);
             throw;
         }
         return criteria;
     }   
 }
开发者ID:August2008,项目名称:August2008.org,代码行数:22,代码来源:DonationRepository.cs

示例11: TryGetCity

 public bool TryGetCity(string city, string state, string postalCode, string country, out City match)
 {
     using (var db = new DataAccess())
     {
         db.CreateStoredProcCommand("dbo.TryGetCity");
         db.AddInputParameter("@City", DbType.String, city);
         db.AddInputParameter("@State", DbType.String, state);
         db.AddInputParameter("@PostalCode", DbType.String, postalCode);
         db.AddInputParameter("@Country", DbType.String, country);
         db.AddReturnParameter();
         try
         {
             db.ReadInto(match = new City());
             return Convert.ToBoolean(db.GetReturnValue());
         }
         catch (Exception ex)
         {
             Logger.Error("Error while getting country.", ex);
         }
     }
     match = default(City);
     return false;
 }
开发者ID:August2008,项目名称:August2008.org,代码行数:23,代码来源:MetadataRepository.cs

示例12: GetUserRoles

 public IEnumerable<Role> GetUserRoles(int userId)
 {
     using (var db = new DataAccess())
     {
         try
         {
             db.CreateStoredProcCommand("dbo.GetUserRoles");
             db.AddInputParameter("@UserId", DbType.Int32, userId);
             var roles = new List<Role>();
             db.ReadInto(roles);
             return roles;
         }
         catch (Exception ex)
         {
             Logger.Error("Error while getting user roles.", ex);
             throw;
         }
     }
 }
开发者ID:August2008,项目名称:August2008.org,代码行数:19,代码来源:AccountRepository.cs

示例13: SearchUsers

 public IEnumerable<User> SearchUsers(string name = null)
 {
     using (var db = new DataAccess())
     {
         db.CreateStoredProcCommand("dbo.SearchUsers");
         db.AddInputParameter("@StartsWith", DbType.String, name);
         try
         {
             var users = new List<User>();
             db.ReadInto(users);
             return users;
         }
         catch (Exception ex)
         {
             Logger.Error("Error while searching users.", ex);
             throw;
         }
     }
 }
开发者ID:August2008,项目名称:August2008.org,代码行数:19,代码来源:AccountRepository.cs

示例14: GetUsers

 public IEnumerable<User> GetUsers()
 {
     using (var db = new DataAccess())
     {
         try
         {
             db.CreateStoredProcCommand("dbo.GetUsers");
             var users = new List<User>();
             db.ReadInto(users);
             return users;
         }
         catch (Exception ex)
         {
             Logger.Error("Error while getting user.", ex);
             throw;
         }
     }
 }
开发者ID:August2008,项目名称:August2008.org,代码行数:18,代码来源:AccountRepository.cs

示例15: GetAlphabet

 public IEnumerable<string> GetAlphabet(int languageId)
 {
     using (var db = new DataAccess())
     {
         db.CreateStoredProcCommand("dbo.GetHeroAlphabet");
         db.AddInputParameter("@LanguageId", DbType.String, languageId);
         try
         {
             var alphabet = new List<string>();
             db.ReadInto(alphabet);
             return alphabet;
         }
         catch (Exception ex)
         {
             Logger.Error("Error while getting alphabet", ex);
             throw;
         }
     }
 }
开发者ID:August2008,项目名称:August2008.org,代码行数:19,代码来源:HeroRepository.cs


注:本文中的DataAccess.ReadInto方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。