Exemplo n.º 1
0
        public static bool DoesWorkspaceExist(Guid siteId, Guid webId, Guid listId, int itemId)
        {
            bool exists = false;

            SPSecurity.RunWithElevatedPrivileges(() =>
            {
                using (var eSite = new SPSite(siteId))
                {
                    using (var con = new SqlConnection(
                               CoreFunctions.getReportingConnectionString(eSite.WebApplication.Id, eSite.ID)))
                    {
                        con.Open();

                        using (var cmd = new SqlCommand(WorkspaceQueries.GetDoesWorkSpaceExistQuery(siteId, webId, listId, itemId)))
                            using (var rdr = cmd.ExecuteReader())
                            {
                                while (rdr.Read())
                                {
                                    bool.TryParse(rdr[0].ToString(), out exists);
                                }
                            }
                    }
                }
            });

            return(exists);
        }
Exemplo n.º 2
0
        public static void SendCompletedSignalsToDB(
            Guid siteId,
            SPWeb itemWeb,
            SPWeb parentWeb,
            Guid listId,
            int itemId,
            Guid createdWebId,
            string createdWebServerRelativeUrl,
            string createdWebTitle,
            string creatorId,
            string createdWebDescription)
        {
            Guard.ArgumentIsNotNull(itemWeb, nameof(itemWeb));

            SPSecurity.RunWithElevatedPrivileges(() =>
            {
                using (var eSite = new SPSite(siteId))
                {
                    var eRootWeb = eSite.RootWeb;

                    using (var con = new SqlConnection(
                               CoreFunctions.getReportingConnectionString(eSite.WebApplication.Id, eSite.ID)))
                    {
                        con.Open();

                        using (var cmd = new SqlCommand(WorkspaceQueries.GetSendCompletedSignalsQuery(
                                                            siteId,
                                                            itemWeb.ID,
                                                            parentWeb,
                                                            listId,
                                                            itemId,
                                                            createdWebId,
                                                            createdWebServerRelativeUrl,
                                                            createdWebTitle,
                                                            creatorId,
                                                            createdWebDescription,
                                                            eSite,
                                                            eRootWeb)))
                        {
                            cmd.Connection = con;
                            cmd.ExecuteNonQuery();
                        }
                    }
                }
            });
        }
Exemplo n.º 3
0
 public static void AddToFRF(
     Guid siteId,
     Guid createdWebId,
     string siteTitle,
     string createdWebUrl,
     int userId,
     int type,
     Guid listId,
     int itemId)
 {
     // type legend
     // 1 = favorites
     // 2 = recent
     // 3 = frequent apps
     // 4 = workspace
     SPSecurity.RunWithElevatedPrivileges(() =>
     {
         using (var spSite = new SPSite(siteId))
         {
             using (var con = new SqlConnection(CoreFunctions.getConnectionString(spSite.WebApplication.Id)))
             {
                 con.Open();
                 using (var cmd = new SqlCommand
                 {
                     CommandText = WorkspaceQueries.GetAddToFRFQuery(
                         siteId,
                         createdWebId,
                         siteTitle,
                         createdWebUrl,
                         userId,
                         listId,
                         itemId),
                     Connection = con
                 })
                 {
                     cmd.ExecuteNonQuery();
                 }
             }
         }
     });
 }
Exemplo n.º 4
0
        public static bool IsFirstAttempt(SPSite site, SPWeb web, string listId, string itemId)
        {
            var iRecs = 0;

            SPSecurity.RunWithElevatedPrivileges(() =>
            {
                Guard.ArgumentIsNotNull(site, nameof(site));
                var siteId = site.ID;
                using (var eSite = new SPSite(site.ID))
                {
                    using (var con = new SqlConnection(CoreFunctions.getConnectionString(site.WebApplication.Id)))
                    {
                        con.Open();
                        using (var cmd = new SqlCommand(WorkspaceQueries.GetFirstAttemptQuery(siteId, web, listId, itemId)))
                        {
                            cmd.Connection = con;
                            iRecs          = int.Parse(cmd.ExecuteScalar().ToString());
                        }
                    }
                }
            });

            return(iRecs == 0);
        }