Esempio n. 1
0
        public Dictionary <string, string> GetSurveys()
        {
            BlobManager BlobManagerObj = new BlobManager("snpdiscovery");
            string      localPath      = "questionnaire/";
            var         blobSurveys    = BlobManagerObj.GetBlobAsync(localPath);

            return(GetFromSession <Dictionary <string, string> >("SurveyStorage", blobSurveys));
        }
Esempio n. 2
0
        public void DeleteSurvey(string surveyId)
        {
            BlobManager BlobManagerObj = new BlobManager("snpdiscovery");
            // Create a file in your local MyDocuments folder to upload to a blob.
            string localPath = "questionnaire";
            var    storage   = GetSurveys();

            if (storage.Remove(surveyId))
            {
                BlobManagerObj.DeleteBlob(localPath, surveyId);
            }
            session.SetString("SurveyStorage", JsonConvert.SerializeObject(storage));
        }
Esempio n. 3
0
        public void StoreSurvey(string surveyId, string jsonString)
        {
            var storage = GetSurveys();


            // Container Name - picture
            BlobManager BlobManagerObj = new BlobManager("snpdiscovery");
            // Create a file in your local MyDocuments folder to upload to a blob.
            string localPath    = "questionnaire";
            string sourceFile   = System.IO.Path.Combine(localPath, surveyId);
            var    uploadStatus = BlobManagerObj.UploadTextToBlob(sourceFile, jsonString);

            if (!string.IsNullOrWhiteSpace(uploadStatus) & uploadStatus.Contains(surveyId))
            {
                storage[surveyId] = jsonString;
            }

            session.SetString("SurveyStorage", JsonConvert.SerializeObject(storage));
            //return task.Result;
        }
Esempio n. 4
0
        public void ChangeName(string id, string name)  //name is new id
        {
            // Container Name - picture
            BlobManager BlobManagerObj = new BlobManager("snpdiscovery");
            // Create a file in your local MyDocuments folder to upload to a blob.
            string localPath    = "questionnaire";
            string sourceFile   = System.IO.Path.Combine(localPath, name);
            string uploadStatus = "";

            var storage = GetSurveys();

            storage[name] = storage[id]; //adding new entry
            uploadStatus  = BlobManagerObj.UploadTextToBlob(sourceFile, storage[id]);

            if (!string.IsNullOrWhiteSpace(uploadStatus) & uploadStatus.Contains(name))
            {
                storage.Remove(id);
                BlobManagerObj.DeleteBlob(localPath, id);
            }
            session.SetString("SurveyStorage", JsonConvert.SerializeObject(storage));
        }