private void defaultXICSettingsButton_Click(object sender, EventArgs e) { var maxQValue = 0.05; var mostRecentFilter = session.Query <PersistentDataFilter>().OrderByDescending(o => o.Id).FirstOrDefault(); if (mostRecentFilter != null) { maxQValue = mostRecentFilter.MaximumQValue; } var quantitationSettingsForm = new QuantitationSettingsForm(_defaultXicConfig, _defaultIsobaricConfig, maxQValue); if (quantitationSettingsForm.ShowDialog() == DialogResult.OK) { foreach (DataGridViewRow row in dataGridView.Rows) { var method = QuantitationMethodForRow(row.Index); if (IsLabelFree(method)) { row.Cells[quantitationSettingsColumn.Index].Value = quantitationSettingsForm.XicConfig; } else if (IsIsobaric(method)) { row.Cells[quantitationSettingsColumn.Index].Value = quantitationSettingsForm.IsobaricConfig; } else { row.Cells[quantitationSettingsColumn.Index].Value = "n/a"; } } _defaultIsobaricConfig = quantitationSettingsForm.IsobaricConfig; _defaultXicConfig = quantitationSettingsForm.XicConfig; } }
void CreateUser(NHibernate.ISession s, string Name, string Pass, string RoleName) { if (!AConst.Roles.Contains(RoleName)) { throw new Exception("Unkown role" + RoleName); } var newUserRole = (from role in s.Query <GlRole>() where role.Name == RoleName select role).ToList().FirstOrDefault(); if (newUserRole == null) { throw new Exception("Unable to find role " + RoleName + " in databases"); } s.SaveOrUpdate(new GlUser() { Name = Name, Password = Pass }); var createdUser = (from item in s.Query <GlUser>() where item.Name == Name select item).ToList().FirstOrDefault(); if (createdUser == null) { throw new Exception("Unable to create user " + Name + " with role " + RoleName); } createdUser.UserRoles = new List <GlUserRole>() { new GlUserRole() { CurrentUser = createdUser, CurrentRole = newUserRole } }; s.SaveOrUpdate(createdUser); }
public string SaveFacebookId(string userId, string password) { Domain.Socioboard.Domain.FacebookLoginId _FacebookLoginId = new FacebookLoginId(); _FacebookLoginId.UserId = userId; _FacebookLoginId.Password = password; _FacebookLoginId.UpdatedAt = DateTime.UtcNow; using (NHibernate.ISession session = SessionFactory.GetNewSession()) { if (session.Query <FacebookLoginId>().Any(t => t.UserId == userId)) { using (NHibernate.ITransaction transaction = session.BeginTransaction()) { int i = session.CreateQuery("Update FacebookLoginId set Password =: Password, UpdatedAt = : UpdatedAt where UserId =: UserId") .SetParameter("UserId", _FacebookLoginId.UserId) .SetParameter("Password", _FacebookLoginId.Password) .SetParameter("UpdatedAt", DateTime.UtcNow) .ExecuteUpdate(); transaction.Commit(); } } else { using (NHibernate.ITransaction transaction = session.BeginTransaction()) { session.Save(_FacebookLoginId); transaction.Commit(); } } } return("success"); }
public void InsertTwitterRecentDetails(Domain.Socioboard.Domain.TwitterRecentDetails data) { bool exists = false; using (NHibernate.ISession session = SessionFactory.GetNewSession()) { exists = session.Query <Domain.Socioboard.Domain.TwitterRecentDetails>() .Any(x => x.TwitterId == data.TwitterId); } using (NHibernate.ISession session = SessionFactory.GetNewSession()) { using (NHibernate.ITransaction transaction = session.BeginTransaction()) { if (exists) { session.CreateQuery("Update twitterrecentdetails set AccountCreationDate = : AccountCreationDate , LastActivityDate = : LastActivityDate , LastFeed = : LastFeed , FeedId = : FeedId , FeedRetweetCount = : FeedRetweetCount , FeedFavoriteCount = : FeedFavoriteCount where TwitterId = : TwitterId") .SetParameter("AccountCreationDate", data.AccountCreationDate) .SetParameter("LastActivityDate", data.LastActivityDate) .SetParameter("LastFeed", data.LastFeed) .SetParameter("FeedId", data.FeedId) .SetParameter("FeedRetweetCount", data.FeedRetweetCount) .SetParameter("FeedFavoriteCount", data.FeedFavoriteCount) .ExecuteUpdate(); transaction.Commit(); } else { session.Save(data); transaction.Commit(); } } } }
public int UpdateShareathonByFacebookPageId(string FacebookPageid, Guid UserId) { //Creates a database connection and opens up a session using (NHibernate.ISession session = SessionFactory.GetNewSession()) { List <Guid> lstids = session.Query <Domain.Socioboard.Domain.ShareathonGroup>().Where(t => t.Facebookpageid.Contains(FacebookPageid) && t.Userid == UserId).Select(t => t.Id).ToList(); if (lstids.Count > 0) { //After Session creation, start Transaction. using (NHibernate.ITransaction transaction = session.BeginTransaction()) { try { //Proceed action, to delete a FacebookAccount by FbUserId and UserId. int isUpdated = session.CreateQuery("Update ShareathonGroup set FacebookStatus = :FacebookStatus where Id in (:ids)") .SetParameterList("ids", lstids).SetParameter("FacebookStatus", 1) .ExecuteUpdate(); transaction.Commit(); return(isUpdated); } catch (Exception ex) { Console.WriteLine(ex.StackTrace); return(0); } }//End Transaction } else { return(0); } }//End session }
public bool IsReportExist(DateTime date, string PageId) { //DateTime stTime = DateTime.Parse(date.ToString("dd-MM-yyyy")); //DateTime enTime = DateTime.Parse(date.AddDays(1).ToString("dd-MM-yyyy")); using (NHibernate.ISession session = SessionFactory.GetNewSession()) { //After Session creation, start Transaction. using (NHibernate.ITransaction transaction = session.BeginTransaction()) { try { List <Domain.Socioboard.Domain.Fbpublicpagereports> alst = session.Query <Domain.Socioboard.Domain.Fbpublicpagereports>().Where(x => x.Pageid == PageId && x.Pageid == PageId && x.Date >= date.Date && x.Date <= date.Date).ToList(); if (alst.Count() > 0) { return(true); } else { return(false); } } catch (Exception ex) { // Console.WriteLine(ex.StackTrace); return(false); } } //End Transaction } //End session }
public bool IsPostExist(string Facebookgroupid, string PostId, string faceaccountId) { using (NHibernate.ISession session = SessionFactory.GetNewSession()) { try { bool rt = session.Query <Domain.Socioboard.Domain.SharethonGroupPost>().Any(t => t.Facebookaccountid == faceaccountId && t.Facebookgroupid == Facebookgroupid && t.PostId == PostId); //List<SharethonGroupPost> objlstfb = session.CreateQuery("from SharethonGroupPost where Facebookgroupid = :Facebookgroupid and Facebookaccountid=:faceaccountId and PostId =: PostId ") // .SetParameter("Facebookgroupid", Facebookgroupid).SetParameter("faceaccountId", faceaccountId) // .SetParameter("PostId", PostId) // .List<SharethonGroupPost>().ToList<SharethonGroupPost>(); //if (objlstfb.Count() > 0) //{ // return true; //} //else //{ // return false; //} return(rt); } catch (Exception ex) { return(true); } }//End session }
public bool checkBusinessExists(Guid userid, string groupname) { //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 find group by and and group name //NHibernate.IQuery query = session.CreateQuery("from BusinessSetting where UserId = :userid and BusinessName =:groupname"); //// query.SetParameter("userid", group.UserId); UserId =:userid and //query.SetParameter("userid", userid); //query.SetParameter("groupname", groupname); //var result = query.UniqueResult(); //if (result == null) // return false; //else // return true; bool exist = session.Query <Domain.Myfashion.Domain.BusinessSetting>() .Any(x => x.UserId == userid && x.BusinessName == groupname); return(exist); } catch (Exception ex) { Console.WriteLine(ex.StackTrace); return(true); } } //End Transaction } //End Session }
private void LoadAllWords() { _location = this.GetType().Name + "." + MethodBase.GetCurrentMethod().Name; _logger.OpenSection(_location); _wordsToStudy = new List <Domain.Word>(); _dbConnection.Open(); _dbSession = NHibernateHelper.GetCustomSession(_dbConnection); var allWords = _dbSession.Query <Domain.Word>().ToList(); foreach (var oneWord in allWords) { if (oneWord.IsMastered) { _numberOfMasteredWords++; } else if (oneWord.Disabled == 0) { _numberOfTotalWords++; _wordsToStudy.Add(oneWord); } } _logger.CloseSection(_location); }
public List <Domain.Socioboard.Domain.InstagramComment> getAllInstagramCommentMongo(int skip) { //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.InstagramComment> alst = session.Query <Domain.Socioboard.Domain.InstagramComment>().Skip(Convert.ToInt32(skip)).Take(50).ToList <Domain.Socioboard.Domain.InstagramComment>(); ////Proceed action to get all Facebook Message of User. //List<Domain.Socioboard.Domain.InstagramComment> alst = session.CreateQuery("from InstagramComment") // .List<Domain.Socioboard.Domain.InstagramComment>().Skip(skip).Take(50) // .ToList<Domain.Socioboard.Domain.InstagramComment>(); #region oldcode //List<FacebookMessage> alst = new List<FacebookMessage>(); //foreach (FacebookMessage item in query.Enumerable<FacebookMessage>().OrderByDescending(x => x.MessageDate)) //{ // alst.Add(item); //} #endregion return(alst); } catch (Exception ex) { Console.WriteLine(ex.StackTrace); return(null); } } //End Transaction } //End session }
public ActionResult <ISet <RoleAPIModel> > GetAll() { using (NHibernate.ISession session = nHibernateHelper.OpenSession()) { return(session.Query <Role>().Select(x => new RoleAPIModel(x)).ToHashSet()); } }
public List <Domain.Myfashion.Domain.InboxMessages> getInboxMessageByGroupandMessageType(Guid UserId, string profileids, string MessageType, 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(','); string[] arrstrtype = MessageType.Split(','); List <Domain.Myfashion.Domain.InboxMessages> results = session.Query <Domain.Myfashion.Domain.InboxMessages>().Where(U => U.UserId.Equals(UserId) && arrsrt.Contains(U.ProfileId) && arrstrtype.Contains(U.MessageType) && U.Status == 0).OrderByDescending(x => x.CreatedTime).Skip(Convert.ToInt32(noOfDataToSkip)).Take(Convert.ToInt32(noOfResultsFromTop)).ToList <Domain.Myfashion.Domain.InboxMessages>(); //string query = "from InboxMessages Where ProfileId In(" + profileids + ") and MessageType In(" + MessageType + ") and UserId =: UserId and Status=0 Order By CreatedTime DESC"; //List<Domain.Myfashion.Domain.InboxMessages> results = session.CreateQuery(query) // .SetParameter("UserId", UserId) // .SetFirstResult(Convert.ToInt32(noOfDataToSkip)) // .SetMaxResults(Convert.ToInt32(noOfResultsFromTop)).List<Domain.Myfashion.Domain.InboxMessages>().ToList(); return(results); } catch (Exception ex) { Console.WriteLine(ex.StackTrace); return(new List <Domain.Myfashion.Domain.InboxMessages>()); } } //End using transaction } //End using session }
/// <getAllRss> /// Get All Rss /// </summary> /// <param name="Id">Id of feedReader.(Guid)</param> /// <returns>Return object of RssReader Class with value of each member in the form of list.(List<RssReader>)</returns> public List <Domain.Socioboard.Domain.RssReader> getAllRss(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 data from id. //List<Domain.Socioboard.Domain.RssReader> lstRssReader = session.CreateQuery("from RssReader where UserId =:userid ORDER BY CreatedDate DESC") //.SetParameter("userid", Id.ToString()).SetFirstResult(0).SetMaxResults(50) //.List<Domain.Socioboard.Domain.RssReader>() //.ToList<Domain.Socioboard.Domain.RssReader>(); //List<RssReader> lstRssReader = new List<RssReader>(); //foreach (RssReader item in query.Enumerable<RssReader>()) //{ // lstRssReader.Add(item); //} List <Domain.Socioboard.Domain.RssReader> lstmsg = session.Query <Domain.Socioboard.Domain.RssReader>().Where(u => u.UserId == Id.ToString()).OrderByDescending(x => x.CreatedDate).Skip(Convert.ToInt32(0)).Take(30).ToList <Domain.Socioboard.Domain.RssReader>(); return(lstmsg); } catch (Exception ex) { Console.WriteLine(ex.StackTrace); return(null); } } //End Transaction } //End Session }
/// <checkAdsExists> /// To Check Existing Add bt Id.. /// </summary> /// <param name="adsid">Id of Ads (Guid).</param> /// <returns>Return true if result contain value otherwise false.</returns> public bool checkAdsExists(Guid adsid) { //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 to Check, Ads is Exist or Not. //And Set the reuired paremeters to find the specific values. // Returns True and false. //NHibernate.IQuery query = session.CreateQuery("from Ads where Id =:adsid"); //query.SetParameter("adsid", adsid); //var result = query.UniqueResult(); //if (result == null) // return false; //else // return true; bool exist = session.Query <Domain.Myfashion.Domain.Ads>() .Any(x => x.Id == adsid); return(exist); } catch (Exception ex) { Console.WriteLine(ex.StackTrace); return(true); } } //End using transaction. } //End using session. }
/// <checkNewsExists> /// Check the news details is exist or not. /// </summary> /// <param name="newsid">News id. (Guid)</param> /// <returns>True or False. (bool)</returns> public bool checkNewsExists(Guid newsid) { //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 find news by id. //NHibernate.IQuery query = session.CreateQuery("from News where Id =:newsid"); //query.SetParameter("newsid", newsid); //var result = query.UniqueResult(); //if (result == null) // return false; //else // return true; bool exist = session.Query <Domain.Socioboard.Domain.News>() .Any(x => x.Id == newsid); return(exist); } catch (Exception ex) { Console.WriteLine(ex.StackTrace); return(true); } } //End Transaction } //End Session }
/// <checkInstagramUserExists> /// Check if instagram user is Exist or not in Database by InUserId(String) and UserId(Guid). /// </summary> /// <param name="InsUserId">InUserId InstagramAccount(String)</param> /// <param name="Userid">UserId InstagramAccount(Guid)</param> /// <returns>Return true or false</returns> public bool checkInstagramUserExists(string InsUserId, 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 Check if instagram user is Exist or not in Database. //NHibernate.IQuery query = session.CreateQuery("from InstagramAccount where InstagramId = :InstagramId and UserId = :UserId"); //query.SetParameter("InstagramId", InsUserId); //query.SetParameter("UserId", Userid); //var result = query.UniqueResult(); //if (result == null) // return false; //else // return true; bool exist = session.Query <Domain.Socioboard.Domain.InstagramAccount>() .Any(x => x.InstagramId == InsUserId && x.UserId == Userid); return(exist); } catch (Exception ex) { Console.WriteLine(ex.StackTrace); return(true); } } //End Transaction } //End session }
public List <Domain.Socioboard.Domain.InstagramFeed> GetFeedsOfProfileWithRange(string profileid, Guid id, int noOfDataToSkip) { //Creates a database connection and opens up a session using (NHibernate.ISession session = SessionFactory.GetNewSession()) { //After Session creation, open up a Transaction. using (NHibernate.ITransaction transaction = session.BeginTransaction()) { try { //Proceed action, to get all twitter messages of profile by profile id // And order by Entry date. //List<Domain.Socioboard.Domain.TumblrFeed> lstmsg = session.CreateQuery("from TumblrFeed where ProfileId = :profid and UserId=:userid ") //.SetParameter("profid", profileid) //.SetParameter("userid", id) //.List<Domain.Socioboard.Domain.TumblrFeed>() //.ToList<Domain.Socioboard.Domain.TumblrFeed>(); List <Domain.Socioboard.Domain.InstagramFeed> lstmsg = session.Query <Domain.Socioboard.Domain.InstagramFeed>().Where(u => u.UserId == id && u.InstagramId.Equals(profileid)).OrderByDescending(x => x.EntryDate).Skip(Convert.ToInt32(noOfDataToSkip)).Take(15).ToList <Domain.Socioboard.Domain.InstagramFeed>(); return(lstmsg); } catch (Exception ex) { Console.WriteLine(ex.StackTrace); return(null); } } //End Transaction } //End Session }
public void AddGoogleAnalyticsReport(Domain.Socioboard.Domain.GoogleAnalyticsReport _GoogleAnalyticsReport) { //Creates a database connection and opens up a session using (NHibernate.ISession session = SessionFactory.GetNewSession()) { bool exist = session.Query <Domain.Socioboard.Domain.GoogleAnalyticsReport>().Any(t => t.GaProfileId == _GoogleAnalyticsReport.GaProfileId); //After Session creation, start Transaction. using (NHibernate.ITransaction transaction = session.BeginTransaction()) { if (!exist) { session.Save(_GoogleAnalyticsReport); transaction.Commit(); } else { try { session.CreateQuery("Update GoogleAnalyticsReport set Visits=:Visits, Views=:Views,TwitterMention=:TwitterMention, Article_Blogs =: Article_Blogs where GaProfileId =: GaProfileId") .SetParameter("Visits", _GoogleAnalyticsReport.Visits) .SetParameter("Views", _GoogleAnalyticsReport.Views) .SetParameter("GaProfileId", _GoogleAnalyticsReport.GaProfileId) .SetParameter("TwitterMention", _GoogleAnalyticsReport.TwitterMention) .SetParameter("Article_Blogs", _GoogleAnalyticsReport.Article_Blogs) .ExecuteUpdate(); transaction.Commit(); } catch (Exception ex) { } } } } }
public IEnumerable <ModuleDto> Get() { var xs = _session.Query <Module>(); IList <ModuleDto> lst = new List <ModuleDto>(); foreach (Module node in xs) { var dto = new ModuleDto { Id = node.Id, Name = node.Name }; foreach (Record r in node.Records) { RecordDto rDto = new RecordDto { Id = r.Id, Name = r.Name, Content = r.Content, }; dto.Records.Add(rDto); dto.RecordsCount++; } lst.Add(dto); } return(lst); }
/// <getAllTwitterFeedOfUsers> /// Get All Twitter Feed Of Users /// </summary> /// <param name="UserId">User id.(Guid)</param> /// <param name="profileid">Profile id.(String)</param> /// <returns>Return object of TwitterFeed Class with value of each member in the form of list.(List<TwitterFeed>)</returns> public List <Domain.Socioboard.Domain.TwitterFeed> getAllTwitterFeedOfUsersByKeyword(string UserId, string profileid, string keyword, int count) { //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.TwitterFeed> lstmsg = session.CreateQuery("from TwitterFeed where UserId = :userid and ProfileId = :profid") //.SetParameter("userid", UserId) //.SetParameter("profid", profileid) //.SetFirstResult(count) //.SetMaxResults(10) //.List<Domain.Socioboard.Domain.TwitterFeed>() //.ToList<Domain.Socioboard.Domain.TwitterFeed>(); List <Domain.Socioboard.Domain.TwitterFeed> lstmsg = session.Query <Domain.Socioboard.Domain.TwitterFeed>().Where(x => x.Feed.Contains(keyword) && x.UserId.Equals(Guid.Parse(UserId)) && x.ProfileId.Equals(profileid)).OrderByDescending(x => x.FeedDate).Take(20) //.CreateQuery("from FacebookFeed where UserId = :UserId and FeedDescription like %' =:keyword '% ORDER BY FeedDate DESC") //.List<Domain.Socioboard.Domain.FacebookFeed>() .ToList <Domain.Socioboard.Domain.TwitterFeed>(); return(lstmsg); } catch (Exception ex) { Console.WriteLine(ex.StackTrace); return(null); } } //End Transaction } //End Session }
public bool checkLinkedInUserExists(string ProfileId, 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 Check if FacebookUser is Exist in database or not by UserId and FbuserId. // And Set the reuired paremeters to find the specific values. // List<Domain.Myfashion.Domain.LinkedInFeed> alst = session.CreateQuery("from LinkedInFeed where UserId = :userid and ProfileId = :fbuserid") // .SetParameter("userid", Userid) // .SetParameter("fbuserid", ProfileId) // .List<Domain.Myfashion.Domain.LinkedInFeed>() //.ToList<Domain.Myfashion.Domain.LinkedInFeed>(); // if (alst.Count == 0 || alst == null) // return false; // else // return true; bool exist = session.Query <Domain.Myfashion.Domain.LinkedInFeed>() .Any(x => x.ProfileId == ProfileId && x.UserId == Userid); return(exist); } catch (Exception ex) { Console.WriteLine(ex.StackTrace); return(true); } } //End Transaction } //End session }
public List <Domain.Myfashion.Domain.FacebookFeed> getAllFacebookFeedsOfSBUserWithProfileIdAndRange(string UserId, string profileId, string keyword, string noOfDataToSkip) { //Creates a database connection and opens up a session using (NHibernate.ISession session = SessionFactory.GetNewSession()) { //Begin session trasaction and opens up. using (NHibernate.ITransaction transaction = session.BeginTransaction()) { try { //Proceed action, to get all facebook feeds of profile by facebook profile id List <Domain.Myfashion.Domain.FacebookFeed> alst = session.Query <Domain.Myfashion.Domain.FacebookFeed>().Where(x => x.FeedDescription.Contains(keyword) && x.UserId.Equals(Guid.Parse(UserId)) && x.ProfileId.Equals(profileId)).OrderByDescending(x => x.FeedDate).Take(20) //.CreateQuery("from FacebookFeed where UserId = :UserId and FeedDescription like %' =:keyword '% ORDER BY FeedDate DESC") //.List<Domain.Myfashion.Domain.FacebookFeed>() .ToList <Domain.Myfashion.Domain.FacebookFeed>(); return(alst); } catch (Exception ex) { Console.WriteLine(ex.StackTrace); return(null); } } //End Transaction } // End session }
/// <summary> /// Check whether the provided Condition is Exists or Not in Database /// </summary> public static bool IsExists <T>(Expression <Func <T, bool> > Predicate) { using (NHibernate.ISession session = SessionFactory.GetNewSession()) { using (NHibernate.ITransaction transaction = session.BeginTransaction()) { try { List <T> _ListT = session.Query <T>().Where(Predicate).ToList <T>(); if (_ListT != null) { if (_ListT.Count > 0) { return(true); } else { return(false); } } else { return(true); } } catch (Exception) { throw; } } } }
public static bool IsAllowPlanMaking(Guid currentUserId, Guid normalstaffId, NHibernate.ISession session) { bool result = false; //SessionManager.DoWork(session => //{ Staff supervisor = ControllerHelpers.GetCurrentStaff(session); Staff normalStaff = session.Query <Staff>().SingleOrDefault(s => s.Id == normalstaffId); if (supervisor.Id != normalStaff.Id) { if (supervisor != null) { if (supervisor.StaffInfo.Position != null) { switch (supervisor.StaffInfo.Position.AgentObjectType.Id) { case (int)AgentObjectTypes.PhongBan: { if ((normalStaff.StaffInfo.Position == null || normalStaff.StaffInfo.Position.AgentObjectType.Id == 7) && normalStaff.Department.Id == supervisor.Department.Id) { result = true; } } break; case (int)AgentObjectTypes.Khoa: { if ((normalStaff.StaffInfo.Position == null || normalStaff.StaffInfo.Position.AgentObjectType.Id == 8) && normalStaff.Department.Id == supervisor.Department.Id) { result = true; } } break; case (int)AgentObjectTypes.HieuTruong: { if (normalStaff.StaffInfo.Position != null && normalStaff.StaffInfo.Position.AgentObjectType.Id == 11 && normalStaff.Department.Id == supervisor.Department.Id) { result = true; } else if (normalStaff.StaffInfo.Position != null) { result = true; } } break; } } } } else { return(true); } return(result); }
public IEnumerable <T1> Search <T1, T2>(NHibernate.ISession session, Func <T2, bool> fn) where T1 : class, IEntity where T2 : class, IDataItem { IEnumerable <T2> query = session.Query <T2>().Where(fn); return(query.Select(x => (T1)Activator.CreateInstance(typeof(T1), x))); }
public bool IsInstagramAccountExistsSecond(string Profileid) { using (NHibernate.ISession session = SessionFactory.GetNewSession()) { bool exist = session.Query <Domain.Socioboard.Domain.InstagramUserDetails>().Any(x => x.Profile_Id == Profileid && x.Created_Time >= DateTime.Now.Date.AddHours(12).AddSeconds(1) && x.Created_Time <= DateTime.Now.AddDays(1).Date.AddSeconds(-1)); return(exist); } }
public bool IsLikeExist(string FromId, string FeedId) { using (NHibernate.ISession session = SessionFactory.GetNewSession()) { bool ret = session.Query <Domain.Socioboard.Domain.GoogleplusLike>().Any(x => x.FeedId == FeedId && x.FromId == FromId); return(ret); } }
public bool IsExist(string CommentId) { using (NHibernate.ISession session = SessionFactory.GetNewSession()) { bool ret = session.Query <Domain.Socioboard.Domain.GoogleplusComments>().Any(x => x.CommentId == CommentId); return(ret); } }
public ActionResult Get() { using (ISession session = NHibernateSession.OpenSession(_env)) { var orders = session.Query <ClientOrder>().ToList(); return(Ok(orders)); } }
public bool IsTwitterAccountExistsSecond(Guid UserId, string Profileid) { using (NHibernate.ISession session = SessionFactory.GetNewSession()) { bool exist = session.Query <Domain.Socioboard.Domain.TwitterAccountFollowers>().Any(x => x.UserId == UserId && x.ProfileId == Profileid && x.EntryDate >= DateTime.Now.Date.AddHours(12).AddSeconds(1) && x.EntryDate <= DateTime.Now.AddDays(1).Date.AddSeconds(-1)); return(exist); } }
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(); }