Example #1
0
        public static void SaveEdits(XmlDocument updatedDoc, ContentURI uri)
        {
            string sErrorMsg = string.Empty;

            Helpers.FileStorageIO fileStorageIO = new Helpers.FileStorageIO();
            fileStorageIO.SaveXmlInURI(uri,
                                       updatedDoc, uri.URIClub.ClubDocFullPath,
                                       out sErrorMsg);
            uri.ErrorMessage += sErrorMsg;
        }
Example #2
0
 public static void SaveEdits(XElement updatedDoc, ContentURI uri)
 {
     //make sure the file and directory were not deleted
     if (Helpers.FileStorageIO.DirectoryCreate(uri,
                                               uri.URIClub.ClubDocFullPath))
     {
         string sErrorMsg = string.Empty;
         Helpers.FileStorageIO fileStorageIO = new Helpers.FileStorageIO();
         fileStorageIO.SaveXmlInURI(uri,
                                    updatedDoc.CreateReader(), uri.URIClub.ClubDocFullPath,
                                    out sErrorMsg);
         uri.ErrorMessage += sErrorMsg;
     }
 }
Example #3
0
        public static async Task <bool> SaveEditsAsync(XElement updatedDoc, ContentURI uri)
        {
            bool bHasCompleted = false;

            //make sure the file and directory were not deleted
            if (Helpers.FileStorageIO.DirectoryCreate(uri,
                                                      uri.URIClub.ClubDocFullPath))
            {
                Helpers.FileStorageIO fileStorageIO = new Helpers.FileStorageIO();
                //210: changed to async and eliminated byref vars
                bHasCompleted = await fileStorageIO.SaveXmlInURIAsync(uri,
                                                                      updatedDoc.CreateReader(), uri.URIClub.ClubDocFullPath);
            }
            return(bHasCompleted);
        }
Example #4
0
        public static async Task <bool> SaveNameValueList(ContentURI uri,
                                                          IDictionary <string, string> lstUpdates,
                                                          string docPath, string nodeName)
        {
            bool bHasCompleted = false;

            if (lstUpdates.Count > 0)
            {
                string      sValue      = string.Empty;
                XmlDocument oUpdatesDoc = new XmlDocument();
                oUpdatesDoc.LoadXml(Helpers.GeneralHelpers.ROOT_NODE);
                XPathNavigator navDoc = oUpdatesDoc.CreateNavigator();
                //move to the root node
                navDoc.MoveToFirstChild();
                //use an xmlwriter to write remaining nodes
                XmlWriterSettings oXmlWriterSettings = new XmlWriterSettings();
                oXmlWriterSettings.Indent             = true;
                oXmlWriterSettings.OmitXmlDeclaration = true;
                oXmlWriterSettings.ConformanceLevel   = ConformanceLevel.Auto;
                using (XmlWriter oUpdateElWriter
                           = XmlWriter.Create(navDoc.AppendChild(), oXmlWriterSettings))
                {
                    foreach (KeyValuePair <string, string> kvp in lstUpdates)
                    {
                        oUpdateElWriter.WriteStartElement(nodeName);
                        oUpdateElWriter.WriteAttributeString(AppHelpers.Calculator.cId,
                                                             kvp.Key);
                        oUpdateElWriter.WriteAttributeString(Helpers.GeneralHelpers.VALUE,
                                                             kvp.Value);
                        oUpdateElWriter.WriteEndElement();
                    }
                }
                if (oUpdatesDoc != null)
                {
                    XmlTextReader xmlUpdates = XmlIO.ConvertStringToReader(oUpdatesDoc.OuterXml);
                    //new XmlTextReader(oUpdatesDoc.OuterXml)
                    Helpers.FileStorageIO fileStorageIO = new Helpers.FileStorageIO();
                    bHasCompleted
                        = await fileStorageIO.SaveXmlInURIAsync(uri, xmlUpdates, docPath);
                }
            }
            return(bHasCompleted);
        }