/// <summary>
        /// Repository példányosítása session-el
        /// </summary>
        /// <param name="session"></param>
        public Repository(NHibernate.ISession session)
        {
            if (session == null)
            {
                throw new ArgumentNullException("session");
            }

            this.session = session;
        }
Example #2
0
 /// <summary>
 /// Main form that the Bumbershoot GUI runs from
 /// </summary>
 public QueueForm()
 {
     try
     {
         InitializeComponent();
         var sessionFactory = SessionManager.CreateSessionFactory();
         _session = sessionFactory.OpenSession();
     }
     catch (Exception error)
     {
         MessageBox.Show("BumberDash could not initilize:" + error.Message + Environment.NewLine + error.StackTrace);
         throw;
     }
 }
Example #3
0
        /// <summary>
        /// Closes the session provider and cleans everything up
        /// </summary>
        public void Close()
        {
            if (this.SessionInThread != null)
            {
                //flush anything to the datastore
                this.SessionInThread.Flush();

                //if the session is open, close it
                if (this.SessionInThread.IsOpen)
                    this.SessionInThread.Close();

                this.SessionInThread.Dispose();
                this.SessionInThread = null;
            }
        }
        private static void LoadHandlingEventData(ISession session)
        {
            const string handlingEventSql =
                "insert into HandlingEvent (completionTime, registrationTime, type, location_id, voyage_id, cargo_id) " +
                "values (?, ?, ?, ?, ?, ?)";

            var handlingEventArgs = new[]
                                        {
                                            //XYZ (SESTO-FIHEL-DEHAM-CNHKG-JPTOK-AUMEL)
                                            new object[] {Ts(0), Ts((0)), "RECEIVE", 1, null, 1},
                                            new object[] {Ts((4)), Ts((5)), "LOAD", 1, 1, 1},
                                            new object[] {Ts((14)), Ts((14)), "UNLOAD", 5, 1, 1},
                                            new object[] {Ts((15)), Ts((15)), "LOAD", 5, 1, 1},
                                            new object[] {Ts((30)), Ts((30)), "UNLOAD", 6, 1, 1},
                                            new object[] {Ts((33)), Ts((33)), "LOAD", 6, 1, 1},
                                            new object[] {Ts((34)), Ts((34)), "UNLOAD", 3, 1, 1},
                                            new object[] {Ts((60)), Ts((60)), "LOAD", 3, 1, 1},
                                            new object[] {Ts((70)), Ts((71)), "UNLOAD", 4, 1, 1},
                                            new object[] {Ts((75)), Ts((75)), "LOAD", 4, 1, 1},
                                            new object[] {Ts((88)), Ts((88)), "UNLOAD", 2, 1, 1},
                                            new object[] {Ts((100)), Ts((102)), "CLAIM", 2, null, 1},
                                            //ZYX (AUMEL - USCHI - DEHAM -)
                                            new object[] {Ts((200)), Ts((201)), "RECEIVE", 2, null, 3},
                                            new object[] {Ts((202)), Ts((202)), "LOAD", 2, 2, 3},
                                            new object[] {Ts((208)), Ts((208)), "UNLOAD", 7, 2, 3},
                                            new object[] {Ts((212)), Ts((212)), "LOAD", 7, 2, 3},
                                            new object[] {Ts((230)), Ts((230)), "UNLOAD", 6, 2, 3},
                                            new object[] {Ts((235)), Ts((235)), "LOAD", 6, 2, 3},
                                            //ABC
                                            new object[] {Ts((20)), Ts((21)), "CLAIM", 2, null, 2},
                                            //CBA
                                            new object[] {Ts((0)), Ts((1)), "RECEIVE", 2, null, 4},
                                            new object[] {Ts((10)), Ts((11)), "LOAD", 2, 2, 4},
                                            new object[] {Ts((20)), Ts((21)), "UNLOAD", 7, 2, 4},
                                            //FGH
                                            new object[] {Ts(100), Ts(160), "RECEIVE", 3, null, 5},
                                            new object[] {Ts(150), Ts(110), "LOAD", 3, 3, 5},
                                            //JKL
                                            new object[] {Ts(200), Ts(220), "RECEIVE", 6, null, 6},
                                            new object[] {Ts(300), Ts(330), "LOAD", 6, 3, 6},
                                            new object[] {Ts(400), Ts(440), "UNLOAD", 5, 3, 6} // Unexpected event
                                        };

            ExecuteUpdate(session, handlingEventSql, handlingEventArgs);
        }
Example #5
0
        public void SetData(NHibernate.ISession session, DataFilter viewFilter)
        {
            this.session = session;
            this.viewFilter = viewFilter;

            ClearData();
            dataGridView.Rows.Clear();

            foreach (var filter in session.Query<PersistentDataFilter>().OrderByDescending(o => o.Id).ToList())
            {
                dataGridView.Rows.Add(filter.Id,
                                      filter.MaximumQValue,
                                      filter.MinimumDistinctPeptides,
                                      filter.MinimumSpectra,
                                      filter.MinimumAdditionalPeptides,
                                      filter.GeneLevelFiltering,
                                      filter.DistinctMatchFormat,
                                      filter.MinimumSpectraPerDistinctMatch,
                                      filter.MinimumSpectraPerDistinctPeptide,
                                      filter.MaximumProteinGroupsPerPeptide,
                                      filter.TotalCounts.Clusters,
                                      filter.TotalCounts.ProteinGroups,
                                      filter.TotalCounts.Proteins,
                                      filter.TotalCounts.GeneGroups,
                                      filter.TotalCounts.Genes,
                                      filter.TotalCounts.DistinctPeptides,
                                      filter.TotalCounts.DistinctMatches,
                                      filter.TotalCounts.FilteredSpectra,
                                      filter.TotalCounts.ProteinFDR * 100,
                                      filter.TotalCounts.PeptideFDR * 100,
                                      filter.TotalCounts.SpectrumFDR * 100);

                dataGridView.Rows[dataGridView.RowCount - 1].Tag = filter;
            }

            dataGridView.Rows[0].Tag = viewFilter;

            dataGridView.Enabled = true;
            dataGridView.Refresh();
        }
        /// <sugetAllFacebookAccountsOfUsermmary>
        /// Get all Facebook Account of User by UserId(Guid).
        /// </summary>
        /// <param name="UserId">UserId of User(Guid)</param>
        /// <returns>Retutn all FacebookAccount in form of ArrayList</returns>
        //public ArrayList getAllFacebookAccountsOfUser(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())
        //        {

        //            //Proceed action, to Get all FacebookAccount by UserId(Guid).
        //            NHibernate.IQuery query = session.CreateQuery("from FacebookAccount where UserId = :userid");
        //            query.SetParameter("userid", UserId);
        //            ArrayList alstFBAccounts = new ArrayList();

        //            foreach (var item in query.Enumerable())
        //            {
        //                alstFBAccounts.Add(item);
        //            }
        //            return alstFBAccounts;
        //        }//End Transaction
        //    }//End session
        //}
        public List <Domain.Socioboard.Domain.FacebookAccount> getAllFacebookAccountsOfUser(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())
                {
                    //Proceed action, to Get all FacebookAccount by UserId(Guid).
                    NHibernate.IQuery query = session.CreateQuery("from FacebookAccount where UserId = :userid");
                    query.SetParameter("userid", UserId);
                    //ArrayList alstFBAccounts = new ArrayList();
                    List <Domain.Socioboard.Domain.FacebookAccount> alstFBAccounts = new List <Domain.Socioboard.Domain.FacebookAccount>();

                    foreach (var item in query.Enumerable())
                    {
                        alstFBAccounts.Add((Domain.Socioboard.Domain.FacebookAccount)item);
                    }
                    return(alstFBAccounts);
                } //End Transaction
            }     //End session
        }
Example #7
0
        /// <getFacebookInsightStatsAgeWiseById>
        /// Get all FacebookinsightStats of user from Database by UserId(Guid) and FbUserId(string) and Age wise.
        /// </summary>
        /// <param name="Fbuserid">FbUserId FacebookInsightStats(String).</param>
        /// <param name="userId">UserId FacebookInsightStats(Guid).</param>
        /// <param name="days">Integer Days.</param>
        /// <returns>Return all Facebookinsight Stats by Age wise in form of Array List.</returns>
        public ArrayList getFacebookInsightStatsAgeWiseById(string Fbuserid, int days)
        {
            //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())
                {
                    //Proceed action to get all FacebookinsightStats of user from Database by UserId(Guid) and FbUserId(string) and Age wise.
                    NHibernate.IQuery query = session.CreateSQLQuery("Select * from FacebookInsightStats where FbUserId = :Fbuserid and AgeDiff is not null and CountDate<=DATE_SUB(NOW(),INTERVAL " + days + " DAY) Group BY Week(CountDate)");
                    query.SetParameter("Fbuserid", Fbuserid);
                    ArrayList alstFBInsightStats = new ArrayList();

                    foreach (var item in query.List())
                    {
                        alstFBInsightStats.Add(item);
                    }

                    return(alstFBInsightStats);
                } //End Transaction
            }     //End session
        }
Example #8
0
        /// <CheckUserId>
        /// Get all Business Setting by UserId
        /// </summary>
        /// <param name="businessSetting">Set Values in a BusinessSetting Class Property and Pass the same Object of BusinessSetting Class.(Domain.BusinessSetting)</param>
        /// <returns>List of BusinessSetting Data Objects.</returns>
        public List <Domain.Myfashion.Domain.BusinessSetting> CheckUserId(Guid UserId, Guid GroupId, string GroupName)
        {
            List <Domain.Myfashion.Domain.BusinessSetting> lstBusinessSetting = new List <Domain.Myfashion.Domain.BusinessSetting>();

            //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())
                {
                    //Proceed action, to get BusinessSetting By UserId
                    lstBusinessSetting = session.CreateQuery("From BusinessSetting where UserId = :userid and groupId=:groupId and BusinessName=:GroupName")
                                         .SetParameter("userid", UserId)
                                         .SetParameter("groupId", GroupId)
                                         .SetParameter("GroupName", GroupName)
                                         .List <Domain.Myfashion.Domain.BusinessSetting>()
                                         .ToList <Domain.Myfashion.Domain.BusinessSetting>();
                } //End Transaction
            }     //End session

            return(lstBusinessSetting);
        }
        public YoutubeChannel getYoutubeChannelDetailsById(string youtubeId)
        {
            YoutubeChannel result = new YoutubeChannel();

            //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())
                {
                    // proceed action, to get all Facebook Account of User by UserId(Guid) and FbUserId(string).
                    List <YoutubeChannel> objlstfb = session.CreateQuery("from YoutubeChannel where Googleplususerid = :youtubeId ")
                                                     .SetParameter("youtubeId", youtubeId)
                                                     .List <YoutubeChannel>().ToList <YoutubeChannel>();
                    if (objlstfb.Count > 0)
                    {
                        result = objlstfb[0];
                    }
                    return(result);
                } //End Transaction
            }     //End session
        }
 public int GetDirrectMessageReceiveCountByProfileIdAndUserId(Guid UserId, string profileids, int Days)
 {
     //Creates a database connection and opens up a session
     using (NHibernate.ISession session = SessionFactory.GetNewSession())
     {
         try
         {
             string[] arrsrt = profileids.Split(',');
             DateTime date   = DateTime.Now.AddDays(-Days);
             List <Domain.Socioboard.Domain.TwitterDirectMessages> results = session.CreateQuery("from TwitterDirectMessages where UserId=:UserId and CreatedDate >= :Days and RecipientId=:RecipientId and Type =:Type")
                                                                             .SetParameter("UserId", UserId)
                                                                             .SetParameter("Days", date)
                                                                             .SetParameter("RecipientId", arrsrt[0]).SetParameter("Type", "twt_directmessages_receive").List <Domain.Socioboard.Domain.TwitterDirectMessages>().ToList();
             return(Int16.Parse(results.Count.ToString()));
         }
         catch (Exception ex)
         {
             Console.WriteLine(ex.StackTrace);
             return(0);
         }
     }// End session
 }
Example #11
0
        /// <getAllFacebookPagesOfUser>
        /// Get all Facebook Account of User by UserId(Guid) and Type.
        /// </summary>
        /// <param name="UserId">UserId of User(Guid)</param>
        /// <returns>Retutn all FacebookAccount in form of ArrayList</returns>
        public ArrayList getAllFacebookPagesOfUser(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())
                {
                    //Proceed action, to Get all FacebookAccount by UserId(Guid) and Type.
                    NHibernate.IQuery query = session.CreateQuery("from FacebookAccount where UserId = :userid And Type=:page");
                    query.SetParameter("userid", UserId);
                    query.SetParameter("page", "page");
                    ArrayList alstFBAccounts = new ArrayList();

                    foreach (var item in query.Enumerable())
                    {
                        alstFBAccounts.Add(item);
                    }
                    return(alstFBAccounts);
                } //End Transaction
            }     //End session
        }
 public int DeleteFacebookStatsByUserid(Guid userid)
 {
     using (NHibernate.ISession session = SessionFactory.GetNewSession())
     {
         using (NHibernate.ITransaction transaction = session.BeginTransaction())
         {
             try
             {
                 NHibernate.IQuery query = session.CreateQuery("delete from FacebookStats where UserId = :userid")
                                           .SetParameter("userid", userid);
                 int isUpdated = query.ExecuteUpdate();
                 transaction.Commit();
                 return(isUpdated);
             }
             catch (Exception ex)
             {
                 Console.WriteLine(ex.StackTrace);
                 return(0);
             }
         }
     }
 }
        public bool IsShareathonExist(Guid Userid, Guid Facebookaccountid, string Facebookpageid)
        {
            using (NHibernate.ISession session = SessionFactory.GetNewSession())
            {
                bool ret = session.Query <Shareathon>().Any(t => t.Userid == Userid && t.Facebookaccountid == Facebookaccountid && t.Facebookpageid.Contains(Facebookpageid));
                //List<Shareathon> objlstfb = session.CreateQuery("from Shareathon where UserId = :UserId and FacebookAccountId =: FacebookAccountId and FacebookPageId =: Facebookpageid and IsHidden = false ")
                //        .SetParameter("UserId", Userid)
                //        .SetParameter("FacebookAccountId", Facebookaccountid)
                //        .SetParameter("Facebookpageid", Facebookpageid)
                //   .List<Shareathon>().ToList<Shareathon>();

                //if (objlstfb.Count() > 0)
                //{
                //    return true;
                //}
                //else
                //{
                //    return false;
                //}
                return(ret);
            }//End session
        }
Example #14
0
 /// <UpdateStatus>
 /// Update Status of Rss reader.
 /// </summary>
 /// <param name="Id">Id of rss reader.(Guid)</param>
 public void UpdateStatus(Guid Id)
 {
     //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 rss reader by id.
                 int i = session.CreateQuery("update RssReader set Status= 1 where Id = :id")
                         .SetParameter("id", Id)
                         .ExecuteUpdate();
             }
             catch (Exception ex)
             {
                 Console.WriteLine(ex.StackTrace);
             }
         } //End Transaction
     }     //End Session
 }
Example #15
0
        /// <GetBlogId>
        /// Get all blog Data from blog post id.
        /// </summary>
        /// <param name="objBlog_Posts">Set the blog post id in a blog posts Class Property and Pass the same Object of blog posts Class.(Domain.Blog_Posts)</param>
        /// <returns>Its is returns Icollection of blog post property class objects.(ICollection<Blog_Posts>)</returns>
        public ICollection <Blog_Posts> GetBlogId(Blog_Posts objBlog_Posts)
        {
            ICollection <Blog_Posts> iCol = null;

            // ICollection<Blog_Comments> iColById = null;
            try
            {
                //Creates a database connection and opens up a session.
                using (NHibernate.ISession session = SessionFactory.GetNewSession())
                {
                    //Proceed action, to get all blog data by blog id.
                    iCol = session.CreateCriteria(typeof(Blog_Posts)).List <Blog_Posts>()
                           .Where <Blog_Posts>(x => x.Id == objBlog_Posts.Id).ToList <Blog_Posts>();
                    //  iColById = iCol.Where<Blog_Comments>(x => x.CommentPostId == objBlog_Posts.Id).ToList<Blog_Comments>();
                }//End session
            }
            catch (Exception ex)
            {
                Console.WriteLine("Error : " + ex.StackTrace);
            }
            return(iCol);
        }
 public List <Domain.Myfashion.Domain.InboxMessages> getInboxMessageByGroup(Guid UserId, string profileids, string noOfDataToSkip, string noOfResultsFromTop)
 {
     //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
             {
                 string[] arrsrt = profileids.Split(',');
                 List <Domain.Myfashion.Domain.InboxMessages> results = session.Query <Domain.Myfashion.Domain.InboxMessages>().Where(U => U.UserId.Equals(UserId) && arrsrt.Contains(U.ProfileId)).OrderByDescending(x => x.CreatedTime).Skip(Convert.ToInt32(noOfDataToSkip)).Take(Convert.ToInt32(noOfResultsFromTop)).ToList <Domain.Myfashion.Domain.InboxMessages>();
                 return(results);
             }
             catch (Exception ex)
             {
                 Console.WriteLine(ex.StackTrace);
                 return(new List <Domain.Myfashion.Domain.InboxMessages>());
             }
         } //End using transaction
     }     //End using session
 }
        public bool IsPostExist(string Facebookaccountid, string Facebookpageid, string PostId)
        {
            using (NHibernate.ISession session = SessionFactory.GetNewSession())
            {
                bool ret = session.Query <SharethonPost>().Any(t => t.Facebookaccountid == Facebookaccountid && t.Facebookpageid == Facebookpageid && t.PostId == PostId);
                return(ret);
                //List<SharethonPost> objlstfb = session.CreateQuery("from SharethonPost where Facebookpageid = :Facebookpageid and Facebookaccountid =: Facebookaccountid and PostId =: PostId ")
                //        .SetParameter("Facebookaccountid", Facebookaccountid)
                //        .SetParameter("Facebookpageid", Facebookpageid)
                //        .SetParameter("PostId", PostId)
                //   .List<SharethonPost>().ToList<SharethonPost>();

                //if (objlstfb.Count() > 0)
                //{
                //    return true;
                //}
                //else
                //{
                //    return false;
                //}
            }//End session
        }
Example #18
0
 public int DeleteUser(Guid id)
 {
     using (NHibernate.ISession session = SessionFactory.GetNewSession())
     {
         using (NHibernate.ITransaction transaction = session.BeginTransaction())
         {
             try
             {
                 int i = session.CreateQuery("Delete from User where Id = :userid")
                         .SetParameter("userid", id)
                         .ExecuteUpdate();
                 transaction.Commit();
                 return(i);
             }
             catch (Exception ex)
             {
                 Console.WriteLine(ex.StackTrace);
                 return(0);
             }
         }
     }
 }
Example #19
0
 /// <Add>
 /// Add a new admin in DataBase.
 /// </summary>
 /// <param name="user">Set Values in a Admin Class Property and Pass the Object of Admin Class (Domain.Socioboard.Domain.Admin).</param>
 public void Add(Domain.Socioboard.Domain.TwitterEngagement user)
 {
     //Creates a database connection and opens up a session
     using (NHibernate.ISession session = SessionFactory.GetNewSession())
     {
         //After Session creation, start and open Transaction.
         using (NHibernate.ITransaction transaction = session.BeginTransaction())
         {
             //Proceed action to save data.
             try
             {
                 session.Save(user);
                 transaction.Commit();
             }
             catch (Exception ex)
             {
                 Console.WriteLine(ex.StackTrace);
                 logger.Error(ex.StackTrace);
             }
         } //End Using trasaction
     }     //End Using session
 }
Example #20
0
        public ContatoEntitis Get(int id)
        {
            try
            {
                ContatoEntitis retorno = new ContatoEntitis();

                using (NHibernate.ISessionFactory sessionFactory = SessionFactoryBuilder.BuildSessionFactory())
                {
                    using (NHibernate.ISession session = sessionFactory.OpenSession())
                    {
                        retorno = session.Get <ContatoEntitis>(id);
                        session.Flush();
                    }
                }

                return(retorno);
            }
            catch (Exception exs)
            {
                throw;
            }
        }
Example #21
0
        }    //End session

        public int deletepageshraethonpostByFacebookId(string facebookaccountId)
        {
            //Creates a database connection and opens up a session
            using (NHibernate.ISession session = SessionFactory.GetNewSession())
            {
                try
                {
                    List <Guid> lstids = session.Query <Domain.Socioboard.Domain.SharethonPost>().Where(t => t.Facebookaccountid == facebookaccountId).Select(t => t.Id).ToList();
                    //After Session creation, start Transaction.
                    if (lstids.Count > 0)
                    {
                        using (NHibernate.ITransaction transaction = session.BeginTransaction())
                        {
                            try
                            {
                                int isUpdated = session.CreateQuery("Delete from SharethonPost where Id in (:ids)")
                                                .SetParameterList("ids", lstids)
                                                .ExecuteUpdate();
                                transaction.Commit();
                                return(isUpdated);
                            }
                            catch (Exception ex)
                            {
                                Console.WriteLine(ex.StackTrace);
                                return(0);
                            }
                        }
                    }//End Transaction
                    else
                    {
                        return(0);
                    }
                }
                catch
                {
                    return(0);
                }
            }
        }
Example #22
0
        /// if obj.IsNew, returns any database generated PK, or else the already-assigned PK
        private object SaveOrUpdateThroughORM(NHibernate.ISession session, IDataObject obj, bool isMainEntity = false)
        {
            object newPK = null;

            var toSave = obj.ToORMEntity();

            if (obj.IsNew)
            {
                var pk = session.Save(toSave);

                if (isMainEntity)
                {
                    newPK = pk;
                }
            }
            else
            {
                session.Update(toSave);
            }

            return(newPK);
        }
Example #23
0
 public List <Domain.Socioboard.Domain.WordpressFeeds> GetAllSiteFeedBySiteId(Guid UserId, string SiteId)
 {
     using (NHibernate.ISession session = SessionFactory.GetNewSession())
     {
         //Begin session trasaction and opens up.
         using (NHibernate.ITransaction transaction = session.BeginTransaction())
         {
             try
             {
                 List <Domain.Socioboard.Domain.WordpressFeeds> query = session.CreateQuery("from WordpressFeeds where UserId = :userid and SiteId = : SiteId")
                                                                        .SetParameter("userid", UserId)
                                                                        .SetParameter("SiteId", SiteId)
                                                                        .List <Domain.Socioboard.Domain.WordpressFeeds>().ToList <Domain.Socioboard.Domain.WordpressFeeds>();
                 return(query);
             }
             catch (Exception ex)
             {
                 return(new List <Domain.Socioboard.Domain.WordpressFeeds>());
             }
         }
     }
 }
 public List <Domain.Socioboard.Domain.WordpressSites> GetAllSitesFromWPUserId(Guid UserId, string WPUserId)
 {
     //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
             {
                 List <Domain.Socioboard.Domain.WordpressSites> lstmsg = session.CreateQuery("from WordpressSites where UserId = :userid and WPUserId = :WPUserId")
                                                                         .SetParameter("userid", UserId)
                                                                         .SetParameter("WPUserId", WPUserId).List <Domain.Socioboard.Domain.WordpressSites>().ToList <Domain.Socioboard.Domain.WordpressSites>();
                 return(lstmsg);
             }
             catch (Exception ex)
             {
                 return(new List <Domain.Socioboard.Domain.WordpressSites>());
             }
         }
     }
 }
Example #25
0
        // Added by Antima[5/1/2015]
        public int UpdateEmailIdbyGroupId(Guid UserId, Guid GroupId, string NewEmailId)
        {
            int i = 0;

            using (NHibernate.ISession session = SessionFactory.GetNewSession())
            {
                using (NHibernate.ITransaction transaction = session.BeginTransaction())
                {
                    try
                    {
                        i = session.CreateQuery("Update Team set EmailId=:NewEmailId  where UserId = :UserId and GroupId = :GroupId")
                            .SetParameter("UserId", UserId)
                            .SetParameter("GroupId", GroupId)
                            .SetParameter("NewEmailId", NewEmailId)
                            .ExecuteUpdate();
                        transaction.Commit();
                    }
                    catch { }
                }
            }
            return(i);
        }
        public void Insert(FanPageStatus acc)
        {
            try
            {
                lock (lockerInsert)
                {
                    using (NHibernate.ISession session = SessionFactory.GetNewSession())
                    {
                        using (NHibernate.ITransaction transaction = session.BeginTransaction())
                        {
                            session.Save(acc);

                            transaction.Commit();
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                GlobusLogHelper.log.Error("Error : " + ex.StackTrace);
            }
        }
 /// <getGooglePlusAccountDetailsById>
 /// Get the details of Google account By Id.
 /// </summary>
 /// <param name="gpuserid">Google Plus user id(string).</param>
 /// <param name="userId">User id(Guid)</param>
 /// <returns>Return the object of group where we get all values from object.(Domain.GooglePlusAccount)</returns>
 public Domain.Socioboard.Domain.GooglePlusAccount getGooglePlusAccountDetailsById(string gpuserid, 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())
         {
             //Proceed action, to get Details of account by user id and Google plus id.
             NHibernate.IQuery query = session.CreateQuery("from GooglePlusAccount where GpUserId = :gpuserid and UserId=:userId");
             query.SetParameter("gpuserid", gpuserid);
             query.SetParameter("userId", userId);
             ArrayList alstFBAccounts = new ArrayList();
             foreach (var item in query.Enumerable())
             {
                 alstFBAccounts.Add(item);
             }
             Domain.Socioboard.Domain.GooglePlusAccount result = (Domain.Socioboard.Domain.GooglePlusAccount)query.UniqueResult();
             return(result);
         } //End Transaction
     }     //End Session
 }
Example #28
0
 public Domain.Socioboard.Domain.YoutubeAccount getYoutubeAccountDetailsById(string youtubeId, Guid userid)
 {
     Domain.Socioboard.Domain.YoutubeAccount result = new Domain.Socioboard.Domain.YoutubeAccount();
     //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())
         {
             // proceed action, to get all Facebook Account of User by UserId(Guid) and FbUserId(string).
             List <Domain.Socioboard.Domain.YoutubeAccount> objlstfb = session.CreateQuery("from YoutubeAccount where YtUserId = :Fbuserid and UserId=:userid")
                                                                       .SetParameter("Fbuserid", youtubeId)
                                                                       .SetParameter("userid", userid)
                                                                       .List <Domain.Socioboard.Domain.YoutubeAccount>().ToList <Domain.Socioboard.Domain.YoutubeAccount>();
             if (objlstfb.Count > 0)
             {
                 result = objlstfb[0];
             }
             return(result);
         } //End Transaction
     }     //End session
 }
        public SequenceCoverageForm(NHibernate.ISession session, DataModel.Protein protein, DataFilter viewFilter)
        {
            StartPosition = FormStartPosition.CenterParent;
            ShowIcon      = false;
            WindowState   = FormWindowState.Maximized;
            Text          = protein.Accession;

            ResizeRedraw   = true;
            DoubleBuffered = true;

            BackColor = SystemColors.Window;

            control = new SequenceCoverageControl(session, protein, viewFilter)
            {
                Dock      = DockStyle.Fill,
                BackColor = this.BackColor
            };

            control.SequenceCoverageFilter += (s, e) => OnSequenceCoverageFilter(e);

            Controls.Add(control);
        }
Example #30
0
 public User GetUserInfo(string EmailId, string Password)
 {
     using (NHibernate.ISession session = SessionFactory.GetNewSession())
     {
         using (NHibernate.ITransaction transaction = session.BeginTransaction())
         {
             try
             {
                 NHibernate.IQuery query = session.CreateQuery("from User u where u.EmailId = : email and u.Password= :password");
                 query.SetParameter("email", EmailId);
                 query.SetParameter("password", Password);
                 User result = (User)query.UniqueResult();
                 return(result);
             }
             catch (Exception ex)
             {
                 Console.WriteLine(ex.StackTrace);
                 return(null);
             }
         }
     }
 }
Example #31
0
 public static void Update(UserActivation user)
 {
     using (NHibernate.ISession session = SessionFactory.GetNewSession())
     {
         using (NHibernate.ITransaction transaction = session.BeginTransaction())
         {
             try
             {
                 int i = session.CreateQuery("Update UserActivation set ActivationStatus =:ActivationStatus where UserId = :userid and ID=:id")
                         .SetParameter("id", user.Id)
                         .SetParameter("userid", user.UserId)
                         .SetParameter("ActivationStatus", user.ActivationStatus)
                         .ExecuteUpdate();
                 transaction.Commit();
             }
             catch (Exception ex)
             {
                 Console.WriteLine(ex.StackTrace);
             }
         }
     }
 }
        public List <string> getCompanyNames()
        {
            List <string> companyNames = new List <string>();

            //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())
                {
                    //Proceed action, to Get all FacebookAccount.
                    NHibernate.IQuery query = session.CreateQuery("from CompanyProfiles");

                    foreach (Domain.Myfashion.Domain.CompanyProfiles Profile in query.Enumerable())
                    {
                        companyNames.Add(Profile.Companyname);
                    }
                } //End Transaction
            }     //End session

            return(companyNames);
        }
        public List <Domain.Myfashion.Domain.NewsLetter> getAllNewsLetters()
        {
            using (NHibernate.ISession session = SessionFactory.GetNewSession())
            {
                using (NHibernate.ITransaction transaction = session.BeginTransaction())
                {
                    try
                    {
                        List <Domain.Myfashion.Domain.NewsLetter> alst = session.CreateQuery("from NewsLetter where  SendDate< now() and SendStatus=0")
                                                                         .List <Domain.Myfashion.Domain.NewsLetter>()
                                                                         .ToList <Domain.Myfashion.Domain.NewsLetter>();

                        return(alst);
                    }
                    catch (Exception ex)
                    {
                        Console.WriteLine(ex.StackTrace);
                        return(null);
                    }
                }
            }
        }
Example #34
0
 public bool checkdailymotionpostExists(string Url)
 {
     //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
             {
                 bool exist = session.Query <Domain.Socioboard.Domain.dailymotionpost>()
                              .Any(x => x.Url.Contains(Url));
                 return(exist);
             }
             catch (Exception ex)
             {
                 Console.WriteLine(ex.StackTrace);
                 return(true);
             }
         } //End Transaction
     }     //End session
 }
 /// <Add>
 /// Add logging details of user
 /// </Add>
 /// <param name="loginLogs">Set Values in a LoginLogs Class Property and Pass the Object of LoginLogs Class (SocioBoard.Domain.LoginLogs).</param>
 public void Add(LoginLogs loginLogs)
 {
     try
     {
         //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())
             {
                 //Proceed action, to save details.
                 session.Save(loginLogs);
                 transaction.Commit();
             } //End Transaction
         }     //End Session
     }
     catch (Exception ex)
     {
         Console.WriteLine(ex.Message);
         logger.Error(ex.StackTrace);
     }
 }
        private static void LoadCarrierMovementData(ISession session)
        {
            const string voyageSql = "insert into Voyage (id, voyage_number) values (?, ?)";
            var voyageArgs = new[]
                                 {
                                     new object[] {1, "0101"},
                                     new object[] {2, "0202"},
                                     new object[] {3, "0303"}
                                 };
            ExecuteUpdate(session, voyageSql, voyageArgs);

            const string carrierMovementSql =
                "insert into CarrierMovement (id, voyage_id, departure_location_id, arrival_location_id, departure_time, arrival_time, cm_index) " +
                "values (?,?,?,?,?,?,?)";

            var carrierMovementArgs = new[]
                                          {
                                              // SESTO - FIHEL - DEHAM - CNHKG - JPTOK - AUMEL (voyage 0101)
                                              new object[] {1, 1, 1, 5, Ts(1), Ts(2), 0},
                                              new object[] {2, 1, 5, 6, Ts(1), Ts(2), 1},
                                              new object[] {3, 1, 6, 3, Ts(1), Ts(2), 2},
                                              new object[] {4, 1, 3, 4, Ts(1), Ts(2), 3},
                                              new object[] {5, 1, 4, 2, Ts(1), Ts(2), 4},
                                              // AUMEL - USCHI - DEHAM - SESTO - FIHEL (voyage 0202)
                                              new object[] {7, 2, 2, 7, Ts(1), Ts(2), 0},
                                              new object[] {8, 2, 7, 6, Ts(1), Ts(2), 1},
                                              new object[] {9, 2, 6, 1, Ts(1), Ts(2), 2},
                                              new object[] {6, 2, 1, 5, Ts(1), Ts(2), 3},
                                              // CNHKG - AUMEL - FIHEL - DEHAM - SESTO - USCHI - JPTKO (voyage 0303)
                                              new object[] {10, 3, 3, 2, Ts(1), Ts(2), 0},
                                              new object[] {11, 3, 2, 5, Ts(1), Ts(2), 1},
                                              new object[] {12, 3, 6, 1, Ts(1), Ts(2), 2},
                                              new object[] {13, 3, 1, 7, Ts(1), Ts(2), 3},
                                              new object[] {14, 3, 7, 4, Ts(1), Ts(2), 4}
                                          };
            ExecuteUpdate(session, carrierMovementSql, carrierMovementArgs);
        }
Example #37
0
 public void TestInitialize ()
 {
     var sessionFactory = SessionFactoryFactory.CreateSessionFactory("testQueryReader.idpDB", false, false);
     session = sessionFactory.OpenSession();
 }
Example #38
0
        /// <summary>
        /// Gets an open session if it exists, or creates a new one with the specified interceptor.
        /// </summary>
        /// <param name="interceptor">The interceptor to associate with the session</param>
        /// <returns>NHibernate session</returns>
        public NHibernate.ISession GetOpenSession(NHibernate.IInterceptor interceptor)
        {
            NHibernate.ISession session = this.SessionInThread;
            if (session == null)
            {
                if (interceptor != null)
                {
                    session = this.sessionFactory.OpenSession(interceptor);
                }
                else
                {
                    session = this.sessionFactory.OpenSession();
                }
                this.SessionInThread = session;
            }

            return session;
        }
        private static void LoadLocationData(ISession session)
        {
            const string locationSql = "insert into Location (id, unlocode, name) " +
                                       "values (?, ?, ?)";

            var locationArgs = new[]
                                   {
                                       new object[] {1, "SESTO", "Stockholm"},
                                       new object[] {2, "AUMEL", "Melbourne"},
                                       new object[] {3, "CNHKG", "Hongkong"},
                                       new object[] {4, "JPTOK", "Tokyo"},
                                       new object[] {5, "FIHEL", "Helsinki"},
                                       new object[] {6, "DEHAM", "Hamburg"},
                                       new object[] {7, "USCHI", "Chicago"}
                                   };
            ExecuteUpdate(session, locationSql, locationArgs);
        }
        //TODO:atrosin Revise where and how is used the method
        public static void LoadHibernateData(ISession session, HandlingEventFactory handlingEventFactory,
                                             IHandlingEventRepository handlingEventRepository)
        {
            Console.WriteLine("*** Loading Hibernate data ***");           

            foreach (Location location  in SampleLocations.GetAll())
            {
                session.Save(location);
            }

            foreach (Voyage voyage in SampleVoyages.GetAll())
            {
                session.Save(voyage);
            }

            /*session.Save(SampleVoyages.HONGKONG_TO_NEW_YORK);
            session.Save(SampleVoyages.NEW_YORK_TO_DALLAS);
            session.Save(SampleVoyages.DALLAS_TO_HELSINKI);
            session.Save(SampleVoyages.HELSINKI_TO_HONGKONG);
            session.Save(SampleVoyages.DALLAS_TO_HELSINKI_ALT);*/
             
            var routeSpecification = new RouteSpecification(SampleLocations.HONGKONG,
                                                            SampleLocations.HELSINKI,
                                                            DateUtil.ToDate("2009-03-15"));
            var trackingId = new TrackingId("ABC123");
            var abc123 = new Cargo(trackingId, routeSpecification);

            var itinerary = new Itinerary(
                new List<Leg>
                    {
                        new Leg(SampleVoyages.HONGKONG_TO_NEW_YORK, SampleLocations.HONGKONG, SampleLocations.NEWYORK,
                                DateUtil.ToDate("2009-03-02"), DateUtil.ToDate("2009-03-05")),
                        new Leg(SampleVoyages.NEW_YORK_TO_DALLAS, SampleLocations.NEWYORK, SampleLocations.DALLAS,
                                DateUtil.ToDate("2009-03-06"), DateUtil.ToDate("2009-03-08")),
                        new Leg(SampleVoyages.DALLAS_TO_HELSINKI, SampleLocations.DALLAS, SampleLocations.HELSINKI,
                                DateUtil.ToDate("2009-03-09"), DateUtil.ToDate("2009-03-12"))
                    });
            abc123.AssignToRoute(itinerary);

            session.Save(abc123);


            HandlingEvent event1 = handlingEventFactory.CreateHandlingEvent(
                new DateTime(), DateUtil.ToDate("2009-03-01"), trackingId, null, SampleLocations.HONGKONG.UnLocode,
                HandlingType.RECEIVE
                );
            session.Save(event1);

            HandlingEvent event2 = handlingEventFactory.CreateHandlingEvent(
                new DateTime(), DateUtil.ToDate("2009-03-02"), trackingId,
                SampleVoyages.HONGKONG_TO_NEW_YORK.VoyageNumber, SampleLocations.HONGKONG.UnLocode,
                HandlingType.LOAD
                );
            session.Save(event2);

            HandlingEvent event3 = handlingEventFactory.CreateHandlingEvent(
                new DateTime(), DateUtil.ToDate("2009-03-05"), trackingId,
                SampleVoyages.HONGKONG_TO_NEW_YORK.VoyageNumber, SampleLocations.NEWYORK.UnLocode,
                HandlingType.UNLOAD
                );
            session.Save(event3);


            HandlingHistory handlingHistory = handlingEventRepository.LookupHandlingHistoryOfCargo(trackingId);
            abc123.DeriveDeliveryProgress(handlingHistory);

            session.Update(abc123);

            // Cargo JKL567

            var routeSpecification1 = new RouteSpecification(SampleLocations.HANGZOU,
                                                             SampleLocations.STOCKHOLM,
                                                             DateUtil.ToDate("2009-03-18"));
            var trackingId1 = new TrackingId("JKL567");
            var jkl567 = new Cargo(trackingId1, routeSpecification1);

            var itinerary1 = new Itinerary(new List<Leg>
                                               {
                                                   new Leg(SampleVoyages.HONGKONG_TO_NEW_YORK,
                                                           SampleLocations.HANGZOU, SampleLocations.NEWYORK,
                                                           DateUtil.ToDate("2009-03-03"),
                                                           DateUtil.ToDate("2009-03-05")),
                                                   new Leg(SampleVoyages.NEW_YORK_TO_DALLAS,
                                                           SampleLocations.NEWYORK, SampleLocations.DALLAS,
                                                           DateUtil.ToDate("2009-03-06"),
                                                           DateUtil.ToDate("2009-03-08")),
                                                   new Leg(SampleVoyages.DALLAS_TO_HELSINKI,
                                                           SampleLocations.DALLAS, SampleLocations.STOCKHOLM,
                                                           DateUtil.ToDate("2009-03-09"),
                                                           DateUtil.ToDate("2009-03-11"))
                                               });
            jkl567.AssignToRoute(itinerary1);

            session.Save(jkl567);


            HandlingEvent event21 = handlingEventFactory.CreateHandlingEvent(
                new DateTime(), DateUtil.ToDate("2009-03-01"), trackingId1, null, SampleLocations.HANGZOU.UnLocode,
                HandlingType.RECEIVE);

            session.Save(event21);

            HandlingEvent event22 = handlingEventFactory.CreateHandlingEvent(
                new DateTime(), DateUtil.ToDate("2009-03-03"), trackingId1,
                SampleVoyages.HONGKONG_TO_NEW_YORK.VoyageNumber, SampleLocations.HANGZOU.UnLocode,
                HandlingType.LOAD
                );
            session.Save(event22);

            HandlingEvent event23 = handlingEventFactory.CreateHandlingEvent(
                new DateTime(), DateUtil.ToDate("2009-03-05"), trackingId1,
                SampleVoyages.HONGKONG_TO_NEW_YORK.VoyageNumber, SampleLocations.NEWYORK.UnLocode,
                HandlingType.UNLOAD
                );
            session.Save(event23);

            HandlingEvent event24 = handlingEventFactory.CreateHandlingEvent(
                new DateTime(), DateUtil.ToDate("2009-03-06"), trackingId1,
                SampleVoyages.HONGKONG_TO_NEW_YORK.VoyageNumber, SampleLocations.NEWYORK.UnLocode,
                HandlingType.LOAD
                );
            session.Save(event24);


            HandlingHistory handlingHistory1 = handlingEventRepository.LookupHandlingHistoryOfCargo(trackingId1);
            jkl567.DeriveDeliveryProgress(handlingHistory1);

            session.Update(jkl567);
        }
 public UnitOfWorkImpl(NHibernate.ISession session)
 {
     session.FlushMode = NHibernate.FlushMode.Commit;
     this.session = session;
 }
        private static void ExecuteUpdate(ISession session, string sql, object[][] dataTable)
        {
            for (int i = 0; i < dataTable.GetLength(0); i++)
            {
                IQuery query = session.CreateSQLQuery(sql);

                for (int j = 0; j < dataTable[i].GetLength(0); j++)
                {
                    object objValue = dataTable[i][j];

                    if (objValue == null)
                    {
                        //Workaround: cant set NULL value for int type 
                        query.SetBinary(j, null);
                    }
                    else
                    {
                        query.SetParameter(j, objValue);
                    }
                }

                query.ExecuteUpdate();
            }
        }
Example #43
0
 ////use basicFilter to process all source files and PSMs in session
 public void SetData(NHibernate.ISession session, DataFilter basicFilter)
 {
     this.session = session;
     basicDataFilter = basicFilter;
     ResetForm();
 }
 public void Setup()
 {
     DatabaseSetUp();
     session = sessionManager.GetSession();
     provider = new PreferencesProvider(session);
 }
Example #45
0
        public void ClearSession()
        {
            ClearData();
            if (session != null && session.IsOpen)
            {
                dataGridView.Rows.Clear();

                session.Close();
                session.Dispose();
                session = null;
            }
        }
 /// <summary>
 /// Initializes a new instance of the <see cref="StationsService"/> class.
 /// </summary>
 public StationsService()
 {
     this.log = LogManager.GetLogger(this.GetType());
     this.databaseSession = NHibernateHelper.OpenSession();
     this.logic = new StationsLogic(this.databaseSession);
 }
Example #47
0
        public EmbedderForm (NHibernate.ISession session)
        {
            this.session = session.SessionFactory.OpenSession();

            InitializeComponent();
        }
        private static void LoadItineraryData(ISession session)
        {
            const string legSql =
                "insert into Leg (id, cargo_id, voyage_id, load_location_id, unload_location_id, load_time, unload_time, leg_index) " +
                "values (?,?,?,?,?,?,?,?)";

            var legArgs = new[]
                              {
                                  // Cargo 5: Hongkong - Melbourne - Stockholm - Helsinki
                                  new object[] {1, 5, 1, 3, 2, Ts(1), Ts(2), 0},
                                  new object[] {2, 5, 1, 2, 1, Ts(3), Ts(4), 1},
                                  new object[] {3, 5, 1, 1, 5, Ts(4), Ts(5), 2},
                                  // Cargo 6: Hamburg - Stockholm - Chicago - Tokyo
                                  new object[] {4, 6, 2, 6, 1, Ts(1), Ts(2), 0},
                                  new object[] {5, 6, 2, 1, 7, Ts(3), Ts(4), 1},
                                  new object[] {6, 6, 2, 7, 4, Ts(5), Ts(6), 2}
                              };
            ExecuteUpdate(session, legSql, legArgs);
        }
 public void Init()
 {
     session = DataService.GetSession();
     repo = new Repository<LonglineCatch>(session);
 }
        public void SetData(NHibernate.ISession session, DataModel.Protein protein, DataFilter viewFilter)
        {
            if (session == null)
                return;

            this.session = session.SessionFactory.OpenSession();
            this.viewFilter = viewFilter;

            var workerThread = new BackgroundWorker()
            {
                WorkerReportsProgress = true,
                WorkerSupportsCancellation = true
            };

            workerThread.DoWork += setData;
            if (protein == Protein)
                workerThread.RunWorkerCompleted += refreshFilter;
            else
                workerThread.RunWorkerCompleted += renderData;
            workerThread.RunWorkerAsync(protein);
        }
 /// <summary>
 /// Initializes a new instance of the <see cref="CurrentUserService"/> class.
 /// </summary>
 public CurrentUserService()
 {
     this.databaseSession = NHibernateHelper.OpenSession();
     this.rightsHelper = new RightsHelper(new Repository<UserRolesInfo>(this.databaseSession), new Repository<RoleRightsInfo>(this.databaseSession));
 }
        private static void LoadCargoData(ISession session)
        {
            const string cargoSql =
                "insert into Cargo (id, tracking_id, origin_id, spec_origin_id, spec_destination_id, spec_arrival_deadline, transport_status, current_voyage_id, last_known_location_id, is_misdirected, routing_status, calculated_at, unloaded_at_dest) " +
                "values (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)";

            var cargoArgs = new[]
                                {
                                    new object[]
                                        {
                                            1, "XYZ", 1, 1, 2, Ts(10), "IN_PORT", null, 1, false, "ROUTED", Ts(100),
                                            false
                                        },
                                    new object[]
                                        {
                                            2, "ABC", 1, 1, 5, Ts(20), "IN_PORT", null, 1, false, "ROUTED", Ts(100),
                                            false
                                        },
                                    new object[]
                                        {
                                            3, "ZYX", 2, 2, 1, Ts(30), "IN_PORT", null, 1, false, "NOT_ROUTED", Ts(100),
                                            false
                                        },
                                    new object[]
                                        {
                                            4, "CBA", 5, 5, 1, Ts(40), "IN_PORT", null, 1, false, "MISROUTED", Ts(100),
                                            false
                                        },
                                    new object[]
                                        {
                                            5, "FGH", 1, 3, 5, Ts(50), "IN_PORT", null, 1, false, "ROUTED", Ts(100),
                                            false
                                        }, // Cargo origin differs from spec origin
                                    new object[]
                                        {
                                            6, "JKL", 6, 6, 4, Ts(60), "IN_PORT", null, 1, true, "ROUTED", Ts(100),
                                            false
                                        }
                                };
            ExecuteUpdate(session, cargoSql, cargoArgs);
        }
Example #53
0
        public void SetData (NHibernate.ISession session, DataFilter dataFilter)
        {
            if (session == null)
                return;

            if (StartingSetData != null)
                StartingSetData(this, EventArgs.Empty);

            this.session = session;
            viewFilter = dataFilter;
            this.dataFilter = new DataFilter(dataFilter) { Analysis = null };

            ClearData();

            Text = TabText = "Loading analysis view...";

            var workerThread = new BackgroundWorker()
            {
                WorkerReportsProgress = true,
                WorkerSupportsCancellation = true
            };

            workerThread.DoWork += new DoWorkEventHandler(setData);
            workerThread.RunWorkerCompleted += new RunWorkerCompletedEventHandler(renderData);
            workerThread.RunWorkerAsync();
        }
 public void Setup()
 {
     DatabaseSetUp();
     session = sessionManager.GetSession();
     provider = new CourseProvider(session);
 }
 // dependency injection
 public AuthenticationManager(HttpSessionStateBase session,NHibernate.ISession nhibernateSession)
 {
     _session = session;
     _nhibernateSession = nhibernateSession;
 }
Example #56
0
 /// <summary>
 /// Informs the layout manager how to access the database in current use
 /// </summary>
 /// <param name="newSession"></param>
 public void SetSession(NHibernate.ISession newSession)
 {
     _session = newSession;
 }
 public void ClearSession ()
 {
     ClearData();
     if (session != null && session.IsOpen)
     {
         session.Dispose();
         session = null;
     }
 }
Example #58
0
 /// <summary>
 /// Initializes a new instance of the <see cref="BoardController" /> class.
 /// </summary>
 /// <param name="session">The session.</param>
 /// <param name="messageService">The message service.</param>
 public BoardController(ISession session, IMessageService messageService)
 {
     _session = session;
     _messageService = messageService;
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="CompetitionsService"/> class.
 /// </summary>
 public CompetitionsService()
 {
     this.databaseSession = NHibernateHelper.OpenSession();
     this.logic = new CompetitionsLogic(this.databaseSession);
 }
 //private static Course BuildInvalidCourse()
 //{
 //    //course name is assigned a string with more than 50 chars length
 //    return new Course() { CourseName = A60_CHAR_STRING };
 //}
 private void ResetSessionForProvider()
 {
     session = sessionManager.GetSession();
     provider.Session = session;
 }