/// <getNewsLetterDetails> /// Get news letter details by news boy /// </summary> /// <param name="nlDetail">Message(Body) of new latter</param> /// <returns></returns> public Domain.Myfashion.Domain.NewsLetter getNewsLetterDetails(string nlDetail) { //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 news detail by new body. NHibernate.IQuery query = session.CreateQuery("from NewsLetter where NewsLetterBody=:nlDetail"); query.SetParameter("nlDetail", nlDetail); Domain.Myfashion.Domain.NewsLetter grou = query.UniqueResult <Domain.Myfashion.Domain.NewsLetter>(); return(grou); } catch (Exception ex) { Console.WriteLine(ex.StackTrace); return(null); } } //End Transaction } //End Session }
} //End session public BusinessSetting IsAssignTaskEnable(Guid groupId) { // bool flag = 0; using (NHibernate.ISession session = SessionFactory.GetNewSession()) { using (NHibernate.ITransaction transaction = session.BeginTransaction()) { List <BusinessSetting> lstdetails = session.CreateQuery("from BusinessSetting where groupId=:groupId") .SetParameter("groupId", groupId).List <BusinessSetting>().ToList <BusinessSetting>(); BusinessSetting objBsnsStng = lstdetails[0]; //flag = objBsnsStng.AssigningTasks; //if (objBsnsStng.AssigningTasks == true) //{ // return true; //} //else //{ // return false; //} return(objBsnsStng); } } }
public void updateTeambyteamid(Guid teamid) { //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 update team details. session.CreateQuery("Update Team set InviteStatus=1 where Id = :teamid") .SetParameter("teamid", teamid) .ExecuteUpdate(); transaction.Commit(); } catch (Exception ex) { Console.WriteLine(ex.StackTrace); // return 0; } } //End Transaction } //End Session }
public List <Domain.Socioboard.Domain.TwitterFeed> getAllTwitterFeedsMongo(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 { //Proceed action to get all Facebook Message of User. //List<Domain.Socioboard.Domain.TwitterFeed> alst = session.CreateQuery("from TwitterFeed") // .List<Domain.Socioboard.Domain.TwitterFeed>().Skip(skip).Take(50) // .ToList<Domain.Socioboard.Domain.TwitterFeed>(); List <Domain.Socioboard.Domain.TwitterFeed> alst = session.Query <Domain.Socioboard.Domain.TwitterFeed>().Skip(Convert.ToInt32(skip)).Take(50).ToList <Domain.Socioboard.Domain.TwitterFeed>(); #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 }
/// <deleteAllActivitysOfUser> /// delete All Activitys Of User /// </summary> /// <param name="gpuserid">Google plus user id.(String)</param> /// <param name="userid">Id of user. (Guid)</param> public void deleteAllActivitysOfUser(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()) { try { //Proceed action, to delete data NHibernate.IQuery query = session.CreateQuery("delete from GooglePlusActivities where UserId = :userid and GpUserId = :profileId"); query.SetParameter("userid", userid); query.SetParameter("profileId", gpuserid); int isUpdated = query.ExecuteUpdate(); transaction.Commit(); } catch (Exception ex) { Console.WriteLine(ex.StackTrace); } } //End Transaction } //End Session }
public Domain.Myfashion.Domain.FacebookFeed GetFacebookFeedByFeedId(Guid userid, string feedid) { //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 { NHibernate.IQuery query = session.CreateQuery("from FacebookFeed where UserId =: userid and FeedId = :feedid"); query.SetParameter("feedid", feedid); query.SetParameter("userid", userid); var result = query.UniqueResult(); return((Domain.Myfashion.Domain.FacebookFeed)result); } catch (Exception ex) { Console.WriteLine(ex.StackTrace); return(null); } } //End Transaction } //End Session }
/// <deleteAllFeedsOfUser> /// Delete All Feeds Of User /// </summary> /// <param name="fbuserid">Facebook user id</param> /// <param name="userid">User id(Guid)</param> public void deleteAllFeedsOfUser(string fbuserid, Guid userid) { //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 Delete data NHibernate.IQuery query = session.CreateQuery("delete from FacebookFeed where UserId = :userid and ProfileId = :profileId"); query.SetParameter("userid", userid); query.SetParameter("profileId", fbuserid); int isUpdated = query.ExecuteUpdate(); transaction.Commit(); } catch (Exception ex) { Console.WriteLine(ex.StackTrace); } } //End Transaction } //End session }
/// <updateFriendsCount> /// update afriends in FacebookAccount by FbUserId(string). /// </summary> /// <param name="fbUserId">fbUserId of FacebookAccount(string)</param> /// <param name="UserID">UserId of User(Guid)</param> /// <param name="friends">friends of FacebookAccount (Frinds)</param> public void updateFriendsCount(string fbUserId, Guid UserID, int friends) { //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 update friends in FacebookAccount by FbUserId(string). session.CreateQuery("update FacebookAccount set Friends =:friends where FbUserId =:fbuserid") .SetParameter("fbuserid", fbUserId) .SetParameter("friends", friends) .ExecuteUpdate(); transaction.Commit(); } catch (Exception ex) { Console.WriteLine(ex.StackTrace); } } //End Transaction } //End session }
/// <getPackageDetails> /// Get Package Details by package name. /// </summary> /// <param name="packagename">package name.(String)</param> /// <returns>Return the object of package class with value.(Domain.package)</returns> public Package getPackageDetails(string packagename) { //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 package details by name. NHibernate.IQuery query = session.CreateQuery("from Package where PackageName=:packagename"); query.SetParameter("packagename", packagename); Package grou = query.UniqueResult <Package>(); return(grou); } catch (Exception ex) { Console.WriteLine(ex.StackTrace); return(null); } } //End Transaction } //End Session }
public int UpdateGooglePlusAccount(Domain.Socioboard.Domain.GooglePlusAccount _GooglePlusAccount) { using (NHibernate.ISession session = SessionFactory.GetNewSession()) { //After Session creation, start Transaction. using (NHibernate.ITransaction transaction = session.BeginTransaction()) { try { int i = session.CreateQuery("Update GooglePlusAccount set InYourCircles =: InYourCircles, HaveYouInCircles =: HaveYouInCircles where UserId =: UserId and GpUserId =: GpUserId") .SetParameter("InYourCircles", _GooglePlusAccount.InYourCircles) .SetParameter("HaveYouInCircles", _GooglePlusAccount.HaveYouInCircles) .SetParameter("UserId", _GooglePlusAccount.UserId) .SetParameter("GpUserId", _GooglePlusAccount.GpUserId) .ExecuteUpdate(); transaction.Commit(); return(i); } catch (Exception ex) { return(0); } } } }
public Domain.Myfashion.Domain.WordpressAccount GetWordpressAccountById(Guid id, string wpid) { 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. NHibernate.IQuery query = session.CreateQuery("from WordpressAccount where UserId = :userid and WpUserId = :WpUserId"); query.SetParameter("userid", id); query.SetParameter("WpUserId", wpid); return((Domain.Myfashion.Domain.WordpressAccount)query.UniqueResult()); } catch (Exception ex) { Console.WriteLine(ex.StackTrace); return(null); } } //End Transaction } //End session }
public ArrayList UnPaidUserCountByMonth() { using (NHibernate.ISession session = SessionFactory.GetNewSession()) { using (NHibernate.ITransaction transaction = session.BeginTransaction()) { ArrayList alstUser = new ArrayList(); try { NHibernate.IQuery query = session.CreateSQLQuery("Select month(CreateDate),Count(*) from User where PaymentStatus='unpaid' group by month(CreateDate)"); foreach (var item in query.List()) { alstUser.Add(item); } return(alstUser); } catch (Exception Err) { Console.Write(Err.StackTrace); return(alstUser); } } } }
public void UpdatePassword(string emailid, string password, Guid id, string username, string accounttype) { using (NHibernate.ISession session = SessionFactory.GetNewSession()) { using (NHibernate.ITransaction transaction = session.BeginTransaction()) { try { int i = session.CreateQuery("Update User set EmailId=:email, UserName =: username, Password =:pass, AccountType= :acctype where Id = :twtuserid") .SetParameter("twtuserid", id) .SetParameter("email", emailid) .SetParameter("pass", password) .SetParameter("acctype", accounttype) .SetParameter("username", username) .ExecuteUpdate(); transaction.Commit(); } catch (Exception ex) { Console.WriteLine(ex.StackTrace); } } } }
public int UpdateCode(Guid userid, string code) { int i = 0; using (NHibernate.ISession session = SessionFactory.GetNewSession()) { using (NHibernate.ITransaction transaction = session.BeginTransaction()) { try { i = session.CreateQuery("Update User set UserCode=:code where Id = :Id") .SetParameter("code", code) .SetParameter("Id", userid) .ExecuteUpdate(); transaction.Commit(); } catch (Exception ex) { i = 0; } } } return(i); }
public int UpdateUserRefRelation(UserRefRelation userRefRelation) { int i = 0; try { using (NHibernate.ISession session = SessionFactory.GetNewSession()) { using (NHibernate.ITransaction transaction = session.BeginTransaction()) { try { i = session.CreateQuery("Update UserRefRelation set ReferenceUserId =:referenceUserId, RefereeUserId =: refereeUserId , ReferenceUserEmail=:referenceUserEmail,RefereeUserEmail =:refereeUserEmail,EntryDate =:entryDate where Id = :id") .SetParameter("referenceUserId", userRefRelation.ReferenceUserId) .SetParameter("refereeUserId", userRefRelation.RefereeUserId) .SetParameter("referenceUserEmail", userRefRelation.ReferenceUserEmail) .SetParameter("refereeUserEmail", userRefRelation.RefereeUserEmail) .SetParameter("entryDate", userRefRelation.EntryDate) .ExecuteUpdate(); transaction.Commit(); } catch (Exception ex) { Console.WriteLine(ex.StackTrace); } } } } catch (Exception ex) { Console.WriteLine("Error : " + ex.StackTrace); } return(i); }
public List <Domain.Socioboard.Domain.TeamMemberProfile> getLinkedInTeamMemberProfileData(Guid TeamId) { //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 team by team id. List <Domain.Socioboard.Domain.TeamMemberProfile> alstFBAccounts = session.CreateQuery("from TeamMemberProfile where TeamId = :teamid and ProfileType='linkedIn'") .SetParameter("teamid", TeamId) .List <Domain.Socioboard.Domain.TeamMemberProfile>() .ToList <Domain.Socioboard.Domain.TeamMemberProfile>(); //List<TeamMemberProfile> alstFBAccounts = new List<TeamMemberProfile>(); //foreach (TeamMemberProfile item in query.Enumerable()) //{ // alstFBAccounts.Add(item); //} return(alstFBAccounts); } //End Transaction } //End Session }
public void Delete <T>(T item) where T : class, new() { try { using (NHibernate.ISession session = SessionFactory.GetNewSession(_env)) { using (NHibernate.ITransaction transaction = session.BeginTransaction()) { session.Delete(item); transaction.Commit(); } } } catch (Exception ex) { _logger.LogCritical(ex.Message); _logger.LogError(ex.StackTrace); if (ex.InnerException != null) { _logger.LogError(ex.InnerException.Message); _logger.LogError(ex.InnerException.StackTrace); } } }
public Domain.Socioboard.Domain.InboxMessages getInboxMessageByMessageId(Guid UserId, Guid MessageId) { //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 results = session.CreateQuery("from InboxMessages Where UserId =: UserId and Id =: MessageId") .SetParameter("UserId", UserId) .SetParameter("MessageId", MessageId); Domain.Socioboard.Domain.InboxMessages result = (Domain.Socioboard.Domain.InboxMessages)results.UniqueResult(); return(result); } catch (Exception ex) { Console.WriteLine(ex.StackTrace); return(new Domain.Socioboard.Domain.InboxMessages()); } } //End using transaction } //End using session }
/// <getAllFacebookFeedsOfUser> /// get All Facebook Feeds Of User /// </summary> /// <param name="UserId">Userid of FacebookFeed</param> /// <param name="profileid">Profileid of FacebookFeed</param> /// <returns>List of Facebook feeds.(List<FacebookFeed>)</returns> public List <Domain.Myfashion.Domain.FacebookFeed> getAllFacebookFeedsOfUser(Guid UserId, string profileid) { //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 data of facebook feed by user id and profileid. List <Domain.Myfashion.Domain.FacebookFeed> alst = session.CreateQuery("from FacebookFeed where UserId = :userid and ProfileId = :profileId") .SetParameter("userid", UserId) .SetParameter("profileId", profileid) .List <Domain.Myfashion.Domain.FacebookFeed>() .ToList <Domain.Myfashion.Domain.FacebookFeed>(); #region oldcode //List<FacebookFeed> alst = new List<FacebookFeed>(); //foreach (FacebookFeed item in query.Enumerable<FacebookFeed>().OrderByDescending(x => x.FeedDate)) //{ // alst.Add(item); //} #endregion return(alst); } catch (Exception ex) { Console.WriteLine(ex.StackTrace); return(null); } } //End Transaction } //End session }
public bool IsPostExist(Domain.Socioboard.Domain.FbPagePost _FbPagePost) { //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 all Facebook Message of User. List <Domain.Socioboard.Domain.FbPagePost> alst = session.CreateQuery("from FbPagePost where UserId = :userid and PageId = :pageid and PostId = :postid and FromId = :fromid") .SetParameter("userid", _FbPagePost.UserId) .SetParameter("pageid", _FbPagePost.PageId) .SetParameter("postid", _FbPagePost.PostId) .SetParameter("fromid", _FbPagePost.FromId) .List <Domain.Socioboard.Domain.FbPagePost>() .ToList <Domain.Socioboard.Domain.FbPagePost>(); if (alst.Count > 0) { return(true); } else { return(false); } } catch (Exception ex) { Console.WriteLine(ex.StackTrace); return(true); } } //End Transaction } //End session }
/// <getAllFacebookUserFeeds> /// Get All Facebook User Feeds /// </summary> /// <param name="profileid">Profile id</param> /// <returns>List of Facebbok feeds (List<FacebookFeed>)</returns> public List <Domain.Socioboard.Domain.TwitterFeed> getAllFeedsOfSBUserWithRangeByProfileId(string profileid, string noOfDataToSkip, string noOfResultsFromTop) { //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.Socioboard.Domain.TwitterFeed> alst = session.Query <Domain.Socioboard.Domain.TwitterFeed>().Where(x => x.ProfileId.Equals(profileid)).OrderByDescending(x => x.FeedDate).Skip(Convert.ToInt32(noOfDataToSkip)).Take(Convert.ToInt32(noOfResultsFromTop))//.CreateQuery("from FacebookFeed where UserId = :UserId and FeedDescription like %' =:keyword '% ORDER BY FeedDate DESC") .ToList <Domain.Socioboard.Domain.TwitterFeed>(); return(alst); } catch (Exception ex) { Console.WriteLine(ex.StackTrace); return(null); } } //End Transaction } // End se }
/// <GetLoginDetailsByUserId> /// Get Login Details By User Id /// </GetLoginDetailsByUserId> /// <param name="UserId">Id of socioboard User.(Guid)</param> /// <returns>Return objects of LoginLogs Class with value of each member in the form of list.(List<LoginLogs>)</returns> public List <LoginLogs> GetLoginDetailsByUserId(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 { List <LoginLogs> lst = session.CreateQuery("From LoginLogs where UserId = :userid order by LoginTime desc") .SetParameter("userid", UserId) .List <LoginLogs>() .ToList <LoginLogs>(); return(lst); } catch (Exception ex) { Console.WriteLine(ex.StackTrace); return(null); } } //End Transaction } //End Session }
public void UpdateMandrillAccount(int id, int total) { //Creates a database connection and opens up a session using (NHibernate.ISession session = SocioBoardInvitationMailSenderSessionFactory.GetNewSession()) { //Begin session trasaction and opens up. using (NHibernate.ITransaction transaction = session.BeginTransaction()) { try { session.CreateQuery("Update Mandrillaccount set Total =:total where Id =:id") .SetParameter("total", total) .SetParameter("id", id) .ExecuteUpdate(); transaction.Commit(); } catch (Exception ex) { Console.WriteLine(ex.StackTrace); // return 0; } } //End Trasaction } //End session }
/// <UpdateGroupProfile> /// Update the details of group profile /// </summary> /// <param name="group">Set Values in a GroupProfile Class Property and Pass the same Object of GroupProfile Class.(Domain.GroupProfile)</param> public void UpdateGroupProfile(Domain.Socioboard.Domain.GroupProfile group) { //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 update specific data by user id. session.CreateQuery("Update GroupProfiles set EntryDate =:entrydate where Id = :userid") .SetParameter("userid", group.Id) .ExecuteUpdate(); transaction.Commit(); } catch (Exception ex) { Console.WriteLine(ex.StackTrace); // return 0; } } //End Transaction } //End Session }
/// <IsDraftsMessageExist> /// Check the draft message is exist or not. /// </summary> /// <param name="UserId">Guid of user</param> /// <param name="message">Draft message</param> /// <returns>It is return bool value. If draft is exist it returns true otherwise false </returns> public bool IsDraftsMessageExist(Guid UserId, string message) { //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 check draft by user id and message. NHibernate.IQuery query = session.CreateQuery("From Drafts where UserId = :userid and Message =:mess"); query.SetParameter("userid", UserId); query.SetParameter("mess", message); List <Domain.Socioboard.Domain.Drafts> lst = new List <Domain.Socioboard.Domain.Drafts>(); foreach (Domain.Socioboard.Domain.Drafts item in query.Enumerable <Domain.Socioboard.Domain.Drafts>()) { lst.Add(item); } if (lst.Count == 0) { return(false); } else { return(true); } } catch (Exception ex) { Console.WriteLine(ex.StackTrace); return(true); } } //End trasaction } //End session }
/// <SavePayPalTransaction> /// Save PayPal Transaction Details /// </summary> /// <param name="paymentTransaction">Set the payment details in a payment Transaction Class Property and Pass the Object of PaymentTransaction Class.(Domain.paymentTransaction)</param> public string SavePayPalTransaction(PaymentTransaction paymentTransaction) { 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 of paypal transaction. session.Save(paymentTransaction); transaction.Commit(); return("Success"); } //End Transaction } //End Session } catch (Exception ex) { Console.WriteLine(ex.Message); return("Failure"); } }
/// <getTeamByEmailId> /// Get Team By Email Id. /// </summary> /// <param name="EmailId">memver Email id.(String)</param> /// <returns>Return the object of Team class with value.(Domain.Team)</returns> public Domain.Socioboard.Domain.Team getTeamByEmailId(string EmailId) { //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 team details. NHibernate.IQuery query = session.CreateQuery("from Team where EmailId =:memberId"); query.SetParameter("memberId", EmailId); Domain.Socioboard.Domain.Team alstFBAccounts = query.UniqueResult <Domain.Socioboard.Domain.Team>(); return(alstFBAccounts); } catch (Exception ex) { Console.WriteLine(ex.StackTrace); return(null); } } //End Transaction } //End Session }
/// <getAllDirectMessagesByScreenName> /// Get All Direct Messages By ScreenName /// </summary> /// <param name="screenName">Twitter account screen name.(String)</param> /// <returns>Return object of TwitterDirectMessages Class with value of each member in the form of list.(List<TwitterDirectMessages>)</returns> public List <TwitterDirectMessages> getAllDirectMessagesByScreenName(string screenName) { //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 Messages by screen name. List <TwitterDirectMessages> alstFBAccounts = session.CreateQuery("from TwitterDirectMessages where SenderScreenName = :teamid") .SetParameter("teamid", screenName) .List <TwitterDirectMessages>() .ToList <TwitterDirectMessages>(); //List<TwitterDirectMessages> alstFBAccounts = new List<TwitterDirectMessages>(); //foreach (TwitterDirectMessages item in query.Enumerable()) //{ // alstFBAccounts.Add(item); //} return(alstFBAccounts); } //End Transaction } //End Session }
public int DeleteGroupMemberByUserId(string EmailId) { using (NHibernate.ISession session = SessionFactory.GetNewSession()) { //After Session creation, start Transaction. using (NHibernate.ITransaction transaction = session.BeginTransaction()) { try { //Proceed action, to delete a group detail by group guid. NHibernate.IQuery query = session.CreateQuery("delete from Groupmembers where Emalid =: EmalId") .SetParameter("EmalId", EmailId); int isUpdated = query.ExecuteUpdate(); transaction.Commit(); return(isUpdated); } catch (Exception ex) { Console.WriteLine(ex.StackTrace); return(0); } } //End Transaction } //End Session }
public int DeleteProfile(Guid Userid, string FeedUrl, string ProfileId) { using (NHibernate.ISession session = SessionFactory.GetNewSession()) { using (NHibernate.ITransaction transaction = session.BeginTransaction()) { int str = 0; try { NHibernate.IQuery query = session.CreateQuery("delete from RssFeeds where UserId =:UserId and ProfileId=:ProfileId") .SetParameter("UserId", Userid) .SetParameter("ProfileId", ProfileId); str = query.ExecuteUpdate(); transaction.Commit(); return(str); } catch (Exception ex) { Console.WriteLine(ex.StackTrace); return(str); } } } }