Пример #1
0
 /// <getGoogelAnalyticsAccountHomeDetailsById>
 /// Get Googel Analytics Account Home Details By Id and Google account id.
 /// </summary>
 /// <param name="gauserid">Google account id (String)</param>
 /// <param name="userId">Id of user(Guid)</param>
 /// <returns>Return object of Google analytic class.(Domein.GoogleAnalyticsAccount)</returns>
 public GoogleAnalyticsAccount getGoogelAnalyticsAccountHomeDetailsById(string gauserid, Guid userId)
 {
     //Creates a database connection and opens up a session
     using (NHibernate.ISession session = SessionFactory.GetNewSession())
     {
         //After Session creation, start Transaction.
         using (NHibernate.ITransaction transaction = session.BeginTransaction())
         {
             try
             {
                 //Proceed action, to get details of account.
                 NHibernate.IQuery query = session.CreateQuery("from GoogleAnalyticsAccount where GaAccountId = :GaAccountId and UserId=:userId");
                 query.SetParameter("GaAccountId", gauserid);
                 query.SetParameter("userId", userId);
                 GoogleAnalyticsAccount result = query.UniqueResult <GoogleAnalyticsAccount>();
                 return(result);
             }
             catch (Exception ex)
             {
                 Console.WriteLine(ex.StackTrace);
                 return(null);
             }
         } //End Transaction
     }     //End session
 }
Пример #2
0
 /// <getGoogelAnalyticsAccountHomeDetailsById>
 /// Get the Googel Analytics Account Home Details By Id and google account id.
 /// </summary>
 /// <param name="gauserid">Google account id (String)</param>
 /// <param name="userId">Id of user(Guid)</param>
 /// <returns>Return object of Google analytic class.(Domein.GoogleAnalyticsAccount)</returns>
 public GoogleAnalyticsAccount getGoogelAnalyticsAccountHomeDetailsById(Guid userId, string gauserid)
 {
     //Creates a database connection and opens up a session
     using (NHibernate.ISession session = SessionFactory.GetNewSession())
     {
         //After Session creation, start Transaction.
         using (NHibernate.ITransaction transaction = session.BeginTransaction())
         {
             try
             {
                 NHibernate.IQuery query = session.CreateQuery("from GoogleAnalyticsAccount where GaAccountId = :GaAccountId and UserId=:userId");
                 query.SetParameter("GaAccountId", gauserid);
                 query.SetParameter("userId", userId);
                 GoogleAnalyticsAccount result = new GoogleAnalyticsAccount();
                 foreach (GoogleAnalyticsAccount item in query.Enumerable <GoogleAnalyticsAccount>())
                 {
                     result = item;
                     break;
                 }
                 return(result);
             }
             catch (Exception ex)
             {
                 Console.WriteLine(ex.StackTrace);
                 return(null);
             }
         } //End Transaction
     }     //End session
 }
 /// <getGoogelAnalyticsAccountHomeDetailsById>
 /// Get the Googel Analytics Account Home Details By Id and google account id.
 /// </summary>
 /// <param name="gauserid">Google account id (String)</param>
 /// <param name="userId">Id of user(Guid)</param>
 /// <returns>Return object of Google analytic class.(Domein.GoogleAnalyticsAccount)</returns>
 public GoogleAnalyticsAccount getGoogelAnalyticsAccountHomeDetailsById(Guid userId, string gauserid)
 {
     //Creates a database connection and opens up a session
     using (NHibernate.ISession session = SessionFactory.GetNewSession())
     {
         //After Session creation, start Transaction.
         using (NHibernate.ITransaction transaction = session.BeginTransaction())
         {
             try
             {
                 NHibernate.IQuery query = session.CreateQuery("from GoogleAnalyticsAccount where GaAccountId = :GaAccountId and UserId=:userId");
                 query.SetParameter("GaAccountId", gauserid);
                 query.SetParameter("userId", userId);
                 GoogleAnalyticsAccount result = new GoogleAnalyticsAccount();
                 foreach (GoogleAnalyticsAccount item in query.Enumerable<GoogleAnalyticsAccount>())
                 {
                     result = item;
                     break;
                 }
                 return result;
             }
             catch (Exception ex)
             {
                 Console.WriteLine(ex.StackTrace);
                 return null;
             }
         }//End Transaction
     }//End session
 }