Esempio n. 1
0
 /// <DeleteGroup>
 /// Delete a group of user by profile id , group id and profile id.
 /// </summary>
 /// <param name="group">Set the group name and user id in a Groups Class Property and Pass the same Object of Groups Class.(Domain.Groups)</param>
 /// <returns>Return 1 when Data  is deleted Otherwise retun 0. (int)</returns>
 public int DeleteGroup(Domain.Myfashion.Domain.Groups 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 delete the group data.
                 NHibernate.IQuery query = session.CreateQuery("delete from Groups where UserId = :userid and GroupName = :name")
                                           .SetParameter("name", group.GroupName)
                                           .SetParameter("userid", group.UserId);
                 int isUpdated = query.ExecuteUpdate();
                 transaction.Commit();
                 return(isUpdated);
             }
             catch (Exception ex)
             {
                 Console.WriteLine(ex.StackTrace);
                 return(0);
             }
         } //End Transaction
     }     //End Session
 }
 /// <DeleteAllGroupProfile>
 /// Delete all group profile of user by group id.
 /// </summary>
 /// <param name="GroupId">Group id.(Guid)</param>
 /// <returns>Return 1 when Data is successfully deleted Otherwise retun 0 . (int)</returns>
 public int DeleteAllGroupProfile(Guid GroupId)
 {
     //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 group profile by Group id.
                 NHibernate.IQuery query = session.CreateQuery("delete from GroupProfile where GroupId = :id")
                                           .SetParameter("id", GroupId);
                 int isUpdated = query.ExecuteUpdate();
                 transaction.Commit();
                 return(isUpdated);
             }
             catch (Exception ex)
             {
                 Console.WriteLine(ex.StackTrace);
                 return(0);
             }
         } //End Transaction
     }     //End Session
 }
 /// <DeleteDrafts>
 /// Delete Draft
 /// </summary>
 /// <param name="d">Set Values in a Draft Class Property and Pass the Object of Draft Class (SocioBoard.Domain.Draft).</param>
 /// <returns>Return 1 for successfully deleted or 0 for failed.</returns>
 public int DeleteDrafts(Domain.Myfashion.Domain.Drafts d)
 {
     //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 draft, by user id and message.
                 NHibernate.IQuery query = session.CreateQuery("delete from Drafts where UserId = :userid and Message =:mess")
                                           .SetParameter("userid", d.UserId)
                                           .SetParameter("mess", d.Message);
                 int isUpdated = query.ExecuteUpdate();
                 transaction.Commit();
                 return(isUpdated);
             }
             catch (Exception ex)
             {
                 Console.WriteLine(ex.StackTrace);
                 return(0);
             }
         } //End transaction
     }     //End session
 }
Esempio n. 4
0
 /// <deleteProfile>
 /// Delte existing profile by user id and profile id.
 /// </summary>
 /// <param name="userid">user id.(Guid)</param>
 /// <param name="profileid">Profile id.(String)</param>
 /// <returns>Return 1 for true and 0 for false.(int)</returns>
 public int deleteProfile(Guid userid, string profileid)
 {
     //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 profile.
                 NHibernate.IQuery query = session.CreateQuery("delete from SocialProfile where UserId = :userid and ProfileId = :profileid")
                                           .SetParameter("userid", userid)
                                           .SetParameter("profileid", profileid);
                 int isUpdated = query.ExecuteUpdate();
                 transaction.Commit();
                 return(isUpdated);
             }
             catch (Exception ex)
             {
                 Console.WriteLine(ex.StackTrace);
                 return(0);
             }
         } //End Transaction
     }     //End Session
 }
Esempio n. 5
0
        //public string GetAllNewLetter()
        //{

        //    try
        //    {
        //        lstbox.Items.Add("Getting Mails....");
        //        string dirPath = Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData) + @"\NewsLetterScheduler";
        //        string path = dirPath + "\\hibernate.cfg.xml";
        //        string startUpFilePath = Application.StartupPath + "\\hibernate.cfg.xml";
        //        Console.Write(dirPath + " " + path + " " + startUpFilePath);
        //        if (!Directory.Exists(dirPath))
        //        {
        //            Directory.CreateDirectory(dirPath);
        //        }

        //        if (!File.Exists(path))
        //        {
        //            File.Copy(startUpFilePath, path);
        //        }
        //        SessionFactory.configfilepath = path;
        //        NHibernate.ISession session = SessionFactory.GetNewSession();

        //        UserRepository objUserRepository = new UserRepository();
        //        User objUser = objUserRepository.getUsersById(Guid.Parse("62ebeaa8-0148-4e30-84fc-bf1af515dbf8"));
        //        List<User> lstuser = objUserRepository.getAllUsers();

        //        NewsLetter objNewsLetter = new NewsLetter();
        //        NewsLetterRepository objNewsLetterRepository = new NewsLetterRepository();
        //        //List<NewsLetter> lstNewsLetter = objNewsLetterRepository.GetAllNewsLetterByDate(DateTime.Now);
        //        //lstbox.Items.Add("Found " + lstNewsLetter.Count+" Mails");
        //        //foreach (NewsLetter item in lstNewsLetter)
        //        //{
        //        //    try
        //        //    {
        //        //        SendMail(item);
        //        //    }
        //        //    catch (Exception ex)
        //        //    {

        //        //      Console.WriteLine("Error : " + ex.StackTrace);
        //        //    }

        //        //}
        //    }
        //    catch (Exception ex)
        //    {
        //        Console.WriteLine("Error : " + ex.StackTrace);
        //        timer1.Start();
        //    }
        //    return "";
        //}

        /// <DeleteNewsLetter>
        /// Delete existing record of News Letter by news Latter id.
        /// </DeleteNewsLetter>
        /// <param name="nlid">News latter id (Guid)</param>
        /// <returns>Return integer 1 for true and 0 for false.(int)</returns>
        public int DeleteNewsLetter(Guid nlid)
        {
            //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 a message.
                        NHibernate.IQuery query = session.CreateQuery("delete from NewsLetter where Id = :adsid")
                                                  .SetParameter("adsid", nlid);
                        int isUpdated = query.ExecuteUpdate();
                        transaction.Commit();
                        return(isUpdated);
                    }
                    catch (Exception ex)
                    {
                        Console.WriteLine(ex.StackTrace);
                        return(0);
                    }
                } //End Transaction
            }     //End Session
        }
Esempio n. 6
0
 /// <DeleteTwitterDirectMessagesByUserid>
 /// Delete Twitter Direct Messages By User id.
 /// </summary>
 /// <param name="userid">User id.(guid)</param>
 /// <returns>Return 1 for success and 0 for failure.(int) </returns>
 public int DeleteTwitterDirectMessagesByUserid(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
             {
                 //Delete twitter direct message of user by user id.
                 NHibernate.IQuery query = session.CreateQuery("delete from TwitterDirectMessages where UserId = :userid")
                                           .SetParameter("userid", userid);
                 int isUpdated = query.ExecuteUpdate();
                 transaction.Commit();
                 return(isUpdated);
             }
             catch (Exception ex)
             {
                 Console.WriteLine(ex.StackTrace);
                 return(0);
             }
         } //End Transaction
     }     //End Session
 }
 /// <deleteInstagramUser>
 /// Delete InstagrameUser from Databse by Inuserid(string) and userid(Guid).
 /// </summary>
 /// <param name="Insuserid">Inuserid InstagramAccount(string)</param>
 /// <param name="userid">userid InstagramAccount(Guid)</param>
 /// <returns>Return integer 1 for true and 0 for false</returns>
 public int deleteInstagramUser(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 delete InstagrameUser from Databse.
                 NHibernate.IQuery query = session.CreateQuery("delete from InstagramAccount where InstagramId = :InstagramId and UserId = :UserId")
                                           .SetParameter("InstagramId", Insuserid)
                                           .SetParameter("UserId", userid);
                 int isUpdated = query.ExecuteUpdate();
                 transaction.Commit();
                 return(isUpdated);
             }
             catch (Exception ex)
             {
                 Console.WriteLine(ex.StackTrace);
                 return(0);
             }
         } //End Transaction
     }     //End session
 }
 public int DeleteArchiveMessage(Guid userid, string profileid)
 {
     //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
                 // And return integer value when it is success or failed (0 or 1).
                 NHibernate.IQuery query = session.CreateQuery("delete from ArchiveMessage where UserId = :userid and ProfileId = :Pro")
                                           .SetParameter("userid", userid)
                                           .SetParameter("Pro", profileid);
                 int isUpdated = query.ExecuteUpdate();
                 transaction.Commit();
                 return(isUpdated);
             }
             catch (Exception ex)
             {
                 Console.WriteLine(ex.StackTrace);
                 return(0);
             }
         } // End using trasaction
     }     // End using session
 }
 /// <deleteTwitterFeed>
 /// Delete Twitter Feed
 /// </summary>
 /// <param name="twtfeed">Set Values of twitter profile id and user id in a TwitterFeed Class Property and Pass the Object of TwitterFeed Class.(Domein.TwitterFeed)</param>
 /// <returns>Return 1 for success and 0 for failure.(int) </returns>
 public int deleteTwitterFeed(Domain.Socioboard.Domain.TwitterFeed twtfeed)
 {
     //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 feeds by profile id and user id.
                 NHibernate.IQuery query = session.CreateQuery("delete from TwitterFeed where ProfileId = :twtuserid and UserId = :userid")
                                           .SetParameter("twtuserid", twtfeed.ProfileId)
                                           .SetParameter("userid", twtfeed.UserId);
                 int isUpdated = query.ExecuteUpdate();
                 transaction.Commit();
                 return(isUpdated);
             }
             catch (Exception ex)
             {
                 Console.WriteLine(ex.StackTrace);
                 return(0);
             }
         } //End Transaction
     }     //End Session
 }
Esempio n. 10
0
 /// <DeleteRssReader>
 /// Delete RssReader
 /// </summary>
 /// <param name="rss">Set rssid in a RssReader Class Property and Pass the Object of RssReader Class.(Domein.RssReader)</param>
 /// <returns>Return 1 for true and 0 for false.(int)</returns>
 public int DeleteRssReader(Domain.Socioboard.Domain.RssReader rss)
 {
     //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 RssReader by id.
                 NHibernate.IQuery query = session.CreateQuery("delete from RssReader where Id = :adsid")
                                           .SetParameter("adsid", rss.Id);
                 int isUpdated = query.ExecuteUpdate();
                 transaction.Commit();
                 return(isUpdated);
             }
             catch (Exception ex)
             {
                 Console.WriteLine(ex.StackTrace);
                 return(0);
             }
         } //End Transaction
     }     //End Session
 }
 /// <DeleteArchiveMessage>
 /// Delete a ArchieveMessage From Database by UserId and Message.
 /// </summary>
 /// <param name="archive">the object of the ArchieveMessage class(Domain.ArchieveMEssage)</param>
 /// <returns>Return 1 for True and 0 for False</returns>
 public int DeleteArchiveMessage(Domain.Myfashion.Domain.ArchiveMessage archive)
 {
     //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 Detele specific data.
                 // return the integer value when it is success or not (0 or 1).
                 NHibernate.IQuery query = session.CreateQuery("delete from ArchiveMessage where UserId = :userid and Message = :message")
                                           .SetParameter("message", archive.Message)
                                           .SetParameter("userid", archive.UserId);
                 int isUpdated = query.ExecuteUpdate();
                 transaction.Commit();
                 return(isUpdated);
             }
             catch (Exception ex)
             {
                 Console.WriteLine(ex.StackTrace);
                 return(0);
             }
         } // End using trasaction
     }     // End using session
 }
        public int DeleteUserPackageRelation(UserPackageRelation userPackageRelation)
        {
            int isUpdated = 0;

            try
            {
                using (NHibernate.ISession session = SessionFactory.GetNewSession())
                {
                    using (NHibernate.ITransaction transaction = session.BeginTransaction())
                    {
                        try
                        {
                            NHibernate.IQuery query = session.CreateQuery("delete from userPackageRelation where Id = :adsid")
                                                      .SetParameter("adsid", userPackageRelation.Id);
                            isUpdated = query.ExecuteUpdate();
                            transaction.Commit();
                            return(isUpdated);
                        }
                        catch (Exception ex)
                        {
                            Console.WriteLine(ex.StackTrace);
                            return(0);
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                logger.Error("Error : " + ex.StackTrace);
                Console.WriteLine("Error : " + ex.StackTrace);
            }

            return(isUpdated);
        }
 public int deletecompanyProfileName(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 delete a FacebookAccount by FbUserId and UserId.
                 NHibernate.IQuery query = session.CreateQuery("delete from CompanyProfiles where Id = :id")
                                           .SetParameter("id", id);
                 int isUpdated = query.ExecuteUpdate();
                 transaction.Commit();
                 return(isUpdated);
             }
             catch (Exception ex)
             {
                 Console.WriteLine(ex.StackTrace);
                 return(0);
             }
         } //End Transaction
     }     //End session
 }
        public int deletepageshraethonpost()
        {
            //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
                    {
                        DateTime dt = DateTime.UtcNow.Date.AddDays(-1);
                        //Proceed action, to delete a FacebookAccount by FbUserId and UserId.
                        //NHibernate.IQuery query = session.CreateQuery("delete from SharethonGroupPost where PostedTime like'%Id%'")
                        //                .SetParameter("Id", dt);

                        NHibernate.IQuery query = session.CreateQuery("Delete from SharethonPost where PostedTime < DATE_ADD(UTC_TIMESTAMP(),INTERVAL -1 DAY)");
                        int isUpdated           = query.ExecuteUpdate();
                        transaction.Commit();
                        return(isUpdated);
                    }
                    catch (Exception ex)
                    {
                        Console.WriteLine(ex.StackTrace);
                        return(0);
                    }
                } //End Transaction
            }     //End session
        }
 public int DeleteTeamMemberProfileByTeamIdProfileId(string ProfileId, 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 delete records of user.
                 NHibernate.IQuery query = session.CreateQuery("delete from TeamMemberProfile where ProfileId = :ProfileId and TeamId=:teamid")
                                           .SetParameter("ProfileId", ProfileId)
                                           .SetParameter("teamid", teamid);
                 int isUpdated = query.ExecuteUpdate();
                 transaction.Commit();
                 return(isUpdated);
             }
             catch (Exception ex)
             {
                 Console.WriteLine(ex.StackTrace);
                 return(0);
             }
         } //End Transaction
     }     //End Session
 }
Esempio n. 16
0
 /// <deleteTeam>
 /// Delete Team
 /// </summary>
 /// <param name="team">Set Values of team id and email id in a Team Class Property and Pass the Object of Team Class.(Domein.Team)</param>
 /// <returns>Return 1 for success and 0 for failure.(int) </returns>
 public int deleteTeam(Domain.Socioboard.Domain.Team team)
 {
     //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 team by user id and email id.
                 NHibernate.IQuery query = session.CreateQuery("delete from Team where UserId = :userid and EmailId = :emailid")
                                           .SetParameter("userid", team.UserId)
                                           .SetParameter("emailid", team.EmailId);
                 int isUpdated = query.ExecuteUpdate();
                 transaction.Commit();
                 return(isUpdated);
             }
             catch (Exception ex)
             {
                 Console.WriteLine(ex.StackTrace);
                 return(0);
             }
         } //End Transaction
     }     //End Session
 }
Esempio n. 17
0
 /// <deleteGoogelAnalyticsUser>
 /// Delete googel analytics user account
 /// </summary>
 /// <param name="gauserid">Id of the google account.(String)</param>
 /// <param name="userid">Id of the user.(Guid)</param>
 /// <returns>Return int value when successfullt deleted it's return 1 , otherwise return 0</returns>
 public int deleteGoogelAnalyticsUser(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 delete user account.
                 NHibernate.IQuery query = session.CreateQuery("delete from GoogleAnalyticsAccount where GaProfileId = :gauserid and UserId = :userid")
                                           .SetParameter("gauserid", Profileid)
                                           .SetParameter("userid", userid);
                 int isUpdated = query.ExecuteUpdate();
                 transaction.Commit();
                 return(isUpdated);
             }
             catch (Exception ex)
             {
                 Console.WriteLine(ex.StackTrace);
                 return(0);
             }
         } //End Transaction
     }     //End Session
 }
Esempio n. 18
0
 public int deleteAllPostOfPage(string PageId, 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 linkedin feed
                 NHibernate.IQuery query = session.CreateQuery("delete from LinkedinCompanyPagePosts where UserId = :userid and PageId = :pageid");
                 query.SetParameter("userid", userid);
                 query.SetParameter("pageid", PageId);
                 int isUpdated = query.ExecuteUpdate();
                 transaction.Commit();
                 return(isUpdated);
             }
             catch (Exception ex)
             {
                 Console.WriteLine(ex.StackTrace);
                 return(0);
             }
         } //End Transaction
     }     //End Session
 }
Esempio n. 19
0
 public int DeleteTumblrDataByProfileid(string Profileid, string blogname)
 {
     //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 twitter account info by user id.
                 NHibernate.IQuery query = session.CreateQuery("delete from TumblrFeed where blogname=:blogname and ProfileId=:Profileid")
                                           .SetParameter("blogname", blogname)
                                           .SetParameter("Profileid", Profileid);
                 int isUpdated = query.ExecuteUpdate();
                 transaction.Commit();
                 return(isUpdated);
             }
             catch (Exception ex)
             {
                 Console.WriteLine(ex.StackTrace);
                 return(0);
             }
         } //End Transaction
     }     //End Session
 }
 public int DeleteGroupMember(string GroupId, string UserId)
 {
     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 Userid = :userid and Groupid =: GroupId")
                                           .SetParameter("userid", UserId)
                                           .SetParameter("GroupId", GroupId);
                 int isUpdated = query.ExecuteUpdate();
                 transaction.Commit();
                 return(isUpdated);
             }
             catch (Exception ex)
             {
                 Console.WriteLine(ex.StackTrace);
                 return(0);
             }
         } //End Transaction
     }     //End Session
 }
 /// <DeleteFacebookInsightStatsByUserid>
 /// Delete all FacebookInsightStats from database by Userid(Guid).
 /// </summary>
 /// <param name="userid">UserId FacebookInsightStats(Guid).</param>
 /// <returns>Return integer 1 for True 0 for false.</returns>
 public int DeleteFacebookInsightStatsByUserid(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 all FacebookInsightStats from database by Userid(Guid).
                 NHibernate.IQuery query = session.CreateQuery("delete from FacebookInsightStats where UserId = :userid")
                                           .SetParameter("userid", userid);
                 int isUpdated = query.ExecuteUpdate();
                 transaction.Commit();
                 return(isUpdated);
             }
             catch (Exception ex)
             {
                 Console.WriteLine(ex.StackTrace);
                 return(0);
             }
         } //End Transaction
     }     //End session
 }
 /// <deleteTwitterMessage>
 /// Delete Twitter Message
 /// </summary>
 /// <param name="twtmsg">Set Values of profile id and user id in a TwitterMessage Class Property and Pass the Object of Class.(Domein.TwitterMessage)</param>
 /// <returns>Return 1 for success and 0 for failure.(int) </returns>
 public int deleteTwitterMessage(TwitterMessage twtmsg)
 {
     //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 delete twitter message by twitter user id and user id
                 NHibernate.IQuery query = session.CreateQuery("delete from TwitterMessage where ProfileId = :twtuserid and UserId = :userid")
                                           .SetParameter("twtuserid", twtmsg.ProfileId)
                                           .SetParameter("userid", twtmsg.UserId);
                 int isUpdated = query.ExecuteUpdate();
                 transaction.Commit();
                 return(isUpdated);
             }
             catch (Exception ex)
             {
                 Console.WriteLine(ex.StackTrace);
                 return(0);
             }
         } //End Transaction
     }     //End Session
 }
Esempio n. 23
0
        /// <updateSocialProfile>
        /// Update Social Profile
        /// </summary>
        /// <param name="socio">Set Values in a SocialProfile Class Property and Pass the Object of SocialProfile Class.(Domein.SocialProfile)</param>
        /// <returns>Return 1 for true and 0 for false.(int)</returns>
        public int updateSocialProfile(SocialProfile socio)
        {
            //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 existing data from new profile value.
                        NHibernate.IQuery query = session.CreateQuery("Update SocialProfile set ProfileDate=:profiledate where UserId = :userid and ProfileId = :profileid")

                                                  .SetParameter("profiledate", DateTime.Now)
                                                  .SetParameter("userid", socio.UserId)
                                                  .SetParameter("profileid", socio.ProfileId);
                        int isUpdated = query.ExecuteUpdate();
                        transaction.Commit();
                        return(isUpdated);
                    }
                    catch (Exception ex)
                    {
                        Console.WriteLine(ex.StackTrace);
                        return(0);
                    }
                } //End Transaction
            }     //End Session
        }
Esempio n. 24
0
        public int deleteGroupRelatedTeam(Guid groupid)
        {
            //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 team by user id and email id.
                        NHibernate.IQuery query = session.CreateQuery("delete from Team where GroupId = :groupid")

                                                  .SetParameter("groupid", groupid);
                        int isUpdated = query.ExecuteUpdate();
                        transaction.Commit();
                        return(isUpdated);
                    }
                    catch (Exception ex)
                    {
                        Console.WriteLine(ex.StackTrace);
                        return(0);
                    }
                } //End Transaction
            }     //End Session
        }
Esempio n. 25
0
 /// <deleteTwitterUser>
 /// Delete Twitter User
 /// </summary>
 /// <param name="userid">User id.(Guid)</param>
 /// <param name="twtuserid">Twitter id.(string)</param>
 /// <returns>Return 1 for success and 0 for failure.(int) </returns>
 public int deleteTwitterUser(Guid userid, string twtuserid)
 {
     //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 existing account by user id and twitter id.
                 NHibernate.IQuery query = session.CreateQuery("delete from TwitterAccount where TwitterUserId = :twtuserid and UserId = :userid")
                                           .SetParameter("twtuserid", twtuserid)
                                           .SetParameter("userid", userid);
                 int isUpdated = query.ExecuteUpdate();
                 transaction.Commit();
                 return(isUpdated);
             }
             catch (Exception ex)
             {
                 Console.WriteLine(ex.StackTrace);
                 return(0);
             }
         } //End Transaction
     }     //End Session
 }
Esempio n. 26
0
 public int DeleteProfileDataByUserid(string ProfileId)
 {
     //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 records of user.
                 NHibernate.IQuery query = session.CreateQuery("delete from YoutubeChannel where Googleplususerid = :ProfileId")
                                           .SetParameter("ProfileId", ProfileId);
                 int isUpdated = query.ExecuteUpdate();
                 transaction.Commit();
                 return(isUpdated);
             }
             catch (Exception ex)
             {
                 Console.WriteLine(ex.StackTrace);
                 return(0);
             }
         } //End Transaction
     }     //End Session
 }
Esempio n. 27
0
 /// <DeleteAds>
 /// Delete a Advertisement from a Database by Id.
 /// </summary>
 /// <param name="adsid">Id of the Ads (Guid)</param>
 /// <returns>int</returns>
 public int DeleteAds(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 action to Delete Data.
                 // And Set the reuired paremeters to find the specific values.
                 NHibernate.IQuery query = session.CreateQuery("delete from Ads where Id = :adsid")
                                           .SetParameter("adsid", adsid);
                 int isUpdated = query.ExecuteUpdate();
                 transaction.Commit();
                 return(isUpdated);
             }
             catch (Exception ex)
             {
                 Console.WriteLine(ex.StackTrace);
                 return(0);
             }
         } //End using transaction.
     }     //End using session.
 }
 /// <deleteTeamMember>
 /// Delete profile of TeamMember
 /// </summary>
 /// <param name="team">Set the team id and prfile id of team in a TeamMemberProfile Class Property and Pass the Object of TeamMemberProfile Class.(Domein.TeamMemberProfile)</param>
 /// <returns>Return 1 for successfully delete and 0 for failed.(int)</returns>
 public int deleteTeamMember(Domain.Socioboard.Domain.TeamMemberProfile team)
 {
     //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 deleting team profile by id and team id.
                 NHibernate.IQuery query = session.CreateQuery("delete from TeamMemberProfile where TeamId = :teamid and ProfileId = :profileid")
                                           .SetParameter("teamin", team.TeamId)
                                           .SetParameter("profileid", team.ProfileId);
                 int isUpdated = query.ExecuteUpdate();
                 transaction.Commit();
                 return(isUpdated);
             }
             catch (Exception ex)
             {
                 Console.WriteLine(ex.StackTrace);
                 return(0);
             }
         } //End Transaction
     }     //End Session
 }
        /// <DeleteDrafts>
        /// Delete Draft
        /// </summary>
        /// <param name="d">Set Values in a Draft Class Property and Pass the same Object of Draft Class (SocioBoard.Domain.Draft).</param>
        /// <returns>Return 1 for successfully deleted or 0 for failed.</returns>
        public int DeleteDrafts(Guid Id)
        {
            //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 draft, by Draft id.
                        NHibernate.IQuery query = session.CreateQuery("delete from Drafts where Id = :id")
                                                  .SetParameter("id", Id);

                        int isUpdated = query.ExecuteUpdate();
                        transaction.Commit();
                        return(isUpdated);
                    }
                    catch (Exception ex)
                    {
                        Console.WriteLine(ex.StackTrace);
                        return(0);
                    }
                } //End Transaction
            }     //End Session
        }
Esempio n. 30
0
        public int DeleteSelectedRowData(Message msg)
        {
            int i = 0;

            //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
                    {
                        NHibernate.IQuery query = session.CreateQuery("delete from Message where UserName=:userName and MsgSenderName=:msgSenderName and MessagingReadParticipants=:msgReadParticipants")
                                                  .SetParameter("userName", msg.UserName)
                                                  .SetParameter("msgSenderName", msg.MsgSenderName)
                                                  .SetParameter("msgReadParticipants", msg.MessagingReadParticipants);

                        int isUpdated = query.ExecuteUpdate();
                        transaction.Commit();
                        i = 1;
                        return(i);
                    }
                    catch (Exception ex)
                    {
                        Console.WriteLine(ex.StackTrace);
                        return(0);
                    }
                } //End Trsansaction
            }     //End session
        }