Esempio n. 1
0
        private bool HardDeleteNextUserBatch(string alias, string username, string password, int batchSize, bool testMode, bool useFastDelete, out string result)
        {
            result = null;
            bool   retVal = false;
            string url    = DnnRequest.GetUrl(alias, "Dnn_BulkUserDelete", "BulkUserDelete", "HardDeleteNextUsers", false);

            System.Net.HttpStatusCode  statusCode; string errorMsg;
            System.Net.CookieContainer cookies = new System.Net.CookieContainer();
            //really should use a string format here to build the JSON but quick and dirty does the job
            string requestBody = "{ 'actionName' : 'hardDelete', 'actionNumber' : " + batchSize.ToString() + ", 'testRun': '" + testMode.ToString() + "', 'useFastDelete': '" + useFastDelete.ToString() + "'}";

            //post the request to delete the batch of users
            result = DnnRequest.PostRequest(url, username, password, requestBody, ContentType.JSON, out statusCode, out errorMsg, ref cookies);
            result = ReturnResult(url, statusCode, errorMsg, result);
            if (statusCode == System.Net.HttpStatusCode.OK)
            {
                //get the call return value form the return JSON
                if (string.IsNullOrEmpty(result) == false)
                {
                    var jsonResult = Newtonsoft.Json.Linq.JObject.Parse(result);
                    retVal = bool.Parse(jsonResult["Success"].ToString());
                }
            }
            return(retVal);
        }
Esempio n. 2
0
        private string GetSoftDeletedUsers(string alias, string username, string password)
        {
            string result = null;
            string url    = DnnRequest.GetUrl(alias, "Dnn_BulkUserDelete", "BulkUserDelete", "GetSoftDeletedUsers", false);

            System.Net.HttpStatusCode statusCode; string errorMsg;
            result = DnnRequest.GetRequest(url, username, password, ContentType.JSON, out statusCode, out errorMsg);
            result = ReturnResult(url, statusCode, errorMsg, result);
            return(result);
        }
Esempio n. 3
0
        private string PingServerAuthenticated(string alias, string username, string password)
        {
            string result  = null;
            string pingUrl = DnnRequest.GetUrl(alias, "Dnn_BulkUserDelete", "BulkUserDelete", "AdministratorPing", false);

            System.Net.HttpStatusCode statusCode;
            string errorMsg;

            result = DnnRequest.GetRequest(pingUrl, username, password, ContentType.JSON, out statusCode, out errorMsg);
            result = ReturnResult(pingUrl, statusCode, errorMsg, result);

            return(result);
        }
Esempio n. 4
0
        private string PingServerAnon(string alias)
        {
            string result  = null;
            string pingUrl = DnnRequest.GetUrl(alias, "Dnn_BulkUserDelete", "BulkUserDelete", "AnonymousPing", false);

            System.Net.HttpStatusCode statusCode;
            string errorMsg;

            result = DnnRequest.GetRequest(pingUrl, "", "", ContentType.JSON, out statusCode, out errorMsg);
            result = ReturnResult(pingUrl, statusCode, errorMsg, result);

            return(result);
        }