protected void SnapshotLists(string sLists)
        {
            //PROD -- START
            using (SPSite site = SPContext.Current.Site)
            {
                using (SPWeb web = SPContext.Current.Web)
                {
                    Guid listId = _DAO.GetListId(sLists, web.ID);
                    _DAO.Command =
                        "select timerjobuid from timerjobs where siteguid=@siteguid and listguid = @listguid and jobtype=7";
                    _DAO.AddParam("@siteguid", site.ID.ToString());
                    _DAO.AddParam("@listguid", listId.ToString());
                    object oResult = _DAO.ExecuteScalar(_DAO.GetEPMLiveConnection);

                    Guid timerjobuid = Guid.Empty;
                    if (oResult != null)
                    {
                        timerjobuid = (Guid)oResult;
                    }
                    else
                    {
                        timerjobuid  = Guid.NewGuid();
                        _DAO.Command =
                            "INSERT INTO TIMERJOBS (timerjobuid, siteguid, jobtype, jobname, scheduletype, webguid, listguid, jobdata) VALUES (@timerjobuid, @siteguid, 7, 'Reporting Snapshot', 0, @webguid, @listguid, @jobdata)";
                        _DAO.AddParam("@siteguid", site.ID.ToString());
                        _DAO.AddParam("@webguid", web.ID.ToString());
                        _DAO.AddParam("@listguid", listId.ToString());
                        _DAO.AddParam("@jobdata", listId.ToString());
                        _DAO.AddParam("@timerjobuid", timerjobuid);
                        _DAO.ExecuteNonQuery(_DAO.GetEPMLiveConnection);
                    }

                    if (timerjobuid != Guid.Empty)
                    {
                        CoreFunctions.enqueue(timerjobuid, 0);
                    }
                }
            }
            //END
        }
Esempio n. 2
0
        private void CleanupListAfterFieldUpdate(EPMData DAO, string sList)
        {
            using (SPSite site = new SPSite(DAO.SiteId))
            {
                using (SPWeb web = site.RootWeb)
                {
                    Guid listID = DAO.GetListId(sList, web.ID);

                    //DELETE WORK
                    DAO.DeleteWork(listID, -1);
                    //END

                    DAO.Command =
                        "select timerjobuid from timerjobs where siteguid=@siteguid and listguid = @listguid and jobtype=6";
                    DAO.AddParam("@siteguid", site.ID.ToString());
                    DAO.AddParam("@listguid", listID.ToString());
                    object oResult = DAO.ExecuteScalar(DAO.GetEPMLiveConnection);

                    Guid timerjobuid = Guid.Empty;

                    if (oResult != null)
                    {
                        timerjobuid = (Guid)oResult;
                    }
                    else
                    {
                        timerjobuid = Guid.NewGuid();
                        DAO.Command =
                            "INSERT INTO TIMERJOBS (timerjobuid, siteguid, jobtype, jobname, scheduletype, webguid, listguid, jobdata) VALUES (@timerjobuid, @siteguid, 6, 'List Data Cleanup', 0, @webguid, @listguid, @jobdata)";
                        DAO.AddParam("@siteguid", site.ID.ToString());
                        DAO.AddParam("@webguid", web.ID.ToString());
                        DAO.AddParam("@listguid", listID.ToString());
                        DAO.AddParam("@jobdata", sList);
                        DAO.AddParam("@timerjobuid", timerjobuid);
                        DAO.ExecuteNonQuery(DAO.GetEPMLiveConnection);
                    }

                    if (timerjobuid != Guid.Empty)
                    {
                        EPMLiveCore.CoreFunctions.enqueue(timerjobuid, 0, site);
                    }
                }
            }
            //--End
        }