예제 #1
0
 ///<Summary>Serialize to Json String.</Summary>
 public static string JsonSerializer <T>(T dataObject)
 {
     LogUtility.LogInfoFunction("Entered JsonSerializer.");
     return(JsonConvert.SerializeObject(dataObject, Formatting.Indented));
 }
예제 #2
0
        public static void CreateFileSystemSettings(string fileSystemName)
        {
            LogUtility.LogInfoFunction("Entered CreateFileSystemSettings.");
            XmlDocument xmlDoc = new XmlDocument();

            xmlDoc.Load(@".\UserSettings.xml");

            string  query      = string.Format("//FileSystem[@Name='{0}']", fileSystemName);
            XmlNode fileSystem = xmlDoc.SelectSingleNode(query);

            if (fileSystem == null)
            {
                XmlNode FileSystemNode = xmlDoc.CreateElement("FileSystem");

                XmlAttribute fileSystemId = xmlDoc.CreateAttribute("Name");
                FileSystemNode.Attributes.Append(fileSystemId);
                fileSystemId.Value = fileSystemName;

                XmlNode      node       = xmlDoc.CreateElement("Alert");
                XmlAttribute user       = xmlDoc.CreateAttribute("User");
                XmlAttribute start      = xmlDoc.CreateAttribute("FetchStartTime");
                XmlAttribute end        = xmlDoc.CreateAttribute("FetchEndTime");
                XmlAttribute lastUpdate = xmlDoc.CreateAttribute("LastUpdatedTime");
                node.Attributes.Append(user);
                node.Attributes.Append(start);
                node.Attributes.Append(end);
                node.Attributes.Append(lastUpdate);
                user.Value  = System.Security.Principal.WindowsIdentity.GetCurrent().Name;
                start.Value = DateTime.Now.ToString();
                end.Value   = "2016-02-25";
                FileSystemNode.AppendChild(node);

                node       = xmlDoc.CreateElement("Job");
                user       = xmlDoc.CreateAttribute("User");
                start      = xmlDoc.CreateAttribute("FetchStartTime");
                end        = xmlDoc.CreateAttribute("FetchEndTime");
                lastUpdate = xmlDoc.CreateAttribute("LastUpdatedTime");
                node.Attributes.Append(user);
                node.Attributes.Append(start);
                node.Attributes.Append(end);
                node.Attributes.Append(lastUpdate);
                user.Value  = System.Security.Principal.WindowsIdentity.GetCurrent().Name;
                start.Value = DateTime.Now.ToString();
                end.Value   = "2016-02-25";
                FileSystemNode.AppendChild(node);

                node       = xmlDoc.CreateElement("JobHistory");
                user       = xmlDoc.CreateAttribute("User");
                start      = xmlDoc.CreateAttribute("FetchStartTime");
                end        = xmlDoc.CreateAttribute("FetchEndTime");
                lastUpdate = xmlDoc.CreateAttribute("LastUpdatedTime");
                node.Attributes.Append(user);
                node.Attributes.Append(start);
                node.Attributes.Append(end);
                node.Attributes.Append(lastUpdate);
                user.Value  = System.Security.Principal.WindowsIdentity.GetCurrent().Name;
                start.Value = DateTime.Now.ToString();
                end.Value   = "2016-02-25";
                FileSystemNode.AppendChild(node);

                string query2 = string.Format("//TimeSetting");
                setting = xmlDoc.SelectSingleNode(query2);
                setting.AppendChild(FileSystemNode);

                xmlDoc.Save(@".\UserSettings.xml");
            }

            xmlDoc.Save(@".\UserSettings.xml");
        }
예제 #3
0
 ///<Summary>Dererializes the Json string.</Summary>
 public static T JsonDeserialize <T>(string jsonString)
 {
     LogUtility.LogInfoFunction("Entered JsonDeserialize.");
     return(JsonConvert.DeserializeObject <T>(jsonString));
 }
예제 #4
0
 /// <summary>
 ///  Saves the Job Histories into the DocumentDB Collection with Id: "JobHistoryCollection"
 /// </summary>
 /// <param name="jobHistoryObject">
 /// Contains the JobHistory Data
 /// </param>
 /// <param name="documentDBName">
 /// The documentDB name to determine to which EndPointUrl the data is to be stored.
 /// </param>
 public void SaveJobHistoryData(List <JobHistory> jobHistoryObject, string documentDBName)
 {
     LogUtility.LogInfoFunction("Entered SaveJobHistoryData.");
     SaveJobHistory(jobHistoryObject, documentDBName).Wait();
     LogUtility.LogInfoFunctionFinished();
 }