public static async Task LoadDocumentAsync(this XMLFile xMLFile)
 {
     using (var reader = new StreamReader(xMLFile.FullPath))
     {
         xMLFile.Document = await reader.ReadToEndAsync();
     }
 }
示例#2
0
        /// <summary>
        /// 
        /// </summary>
        public UIEstimateList()
        {
            InitializeComponent();
            db = new SDBServiceClient();
            db1 = new SDBServiceClient();
            mcm = new MouseClickManager(dgEDetails, 400);
            mcm.DoubleClick += new MouseButtonEventHandler(mcm_DoubleClick);
            db.GetMastersCompleted += new EventHandler<GetMastersCompletedEventArgs>(db_GetMastersCompleted);
            db.GetCustomersCompleted += new EventHandler<GetCustomersCompletedEventArgs>(db_GetCustomersCompleted);
            db.GetEstimateCompleted += new EventHandler<GetEstimateCompletedEventArgs>(db_GetEstimateCompleted);
            db.GetSupplierCompleted += new EventHandler<GetSupplierCompletedEventArgs>(db_GetSupplierCompleted); 
            db1.GetMastersCompleted += new EventHandler<GetMastersCompletedEventArgs>(db_GetTypeCompleted);
            db.DownloadTemplateCompleted += new EventHandler<DownloadTemplateCompletedEventArgs>(db_DownloadTemplateCompleted);
            db.DownloadTemplateAsync(EOrderFile);
            xmlFile = new XMLFile();

            ComboBoxItem cbi1 = new ComboBoxItem();
            cbi1.Content = "全て";
            cboExpire.Items.Add(cbi1);

            ComboBoxItem cbi2 = new ComboBoxItem();
            cbi2.Content = "有効";
            cboExpire.Items.Add(cbi2);

            ComboBoxItem cbi3 = new ComboBoxItem();
            cbi3.Content = "無効";
            cboExpire.Items.Add(cbi3); 
        }
示例#3
0
        public bool Delete(string idProduct)
        {
            contextMock = XMLFile.DeserializeList <List <ProductDTO> >(FILE_NAME);

            contextMock.Remove(contextMock.FirstOrDefault(p => p.Id == idProduct));
            return(true);
        }
示例#4
0
        public ActionResult UploadFile(HttpPostedFileBase xmlFile)
        {
            XMLFile file = new XMLFile();
            //This will upload the file.
            string filepath = file.UploadXmlFile(xmlFile);

            var userId = User.Identity.GetUserId();
            //This will read the uploaded XML file and store all its records in the database.
            List <YoutubeChannel> youtubeChannels = file.ReadXmlFile(filepath, userId);

            var existingChannels = _context.YoutubeChannels
                                   .Select(c => c.Title)
                                   .ToList();


            foreach (var youtubeChannel in youtubeChannels)
            {
                var exists = existingChannels.Contains(youtubeChannel.Title);
                if (!exists)
                {
                    _context.YoutubeChannels.Add(youtubeChannel);
                }
            }

            _context.SaveChanges();

            return(RedirectToAction("Index"));
        }
        public static string ConvertToHTML(this XMLFile xMLFile, string xsltString)
        {
            if (string.IsNullOrEmpty(xMLFile.Document))
            {
                return(null);
            }

            using (StringReader srt = new StringReader(xsltString))
                using (StringReader sri = new StringReader(xMLFile.Document))
                {
                    using (XmlReader xrt = XmlReader.Create(srt, new XmlReaderSettings {
                        DtdProcessing = DtdProcessing.Parse
                    }))
                        using (XmlReader xri = XmlReader.Create(sri))
                        {
                            XslCompiledTransform xslt = new XslCompiledTransform();
                            xslt.Load(xrt);
                            using (StringWriter sw = new StringWriter())
                                using (XmlWriter xwo = XmlWriter.Create(sw, xslt.OutputSettings)) // use OutputSettings of xsl, so it can be output as HTML
                                {
                                    xslt.Transform(xri, xwo);
                                    return(sw.ToString());
                                }
                        }
                }
        }
示例#6
0
        public void ReadXMLTest()
        {
            XMLFile testXML = new XMLFile(string.Format("{0}\\test.xml", Directory.GetCurrentDirectory()));

            string test = testXML.getNode("ChildNode1").getValue();

            Assert.AreEqual(test, "SomeValue1");
        }
    public static void Main(String[] args)
    {
        XMLFile test = new XMLFile();

        test.splitTags();

        System.Environment.Exit(1);
    }
示例#8
0
        public PageDTO SelectPage(int page, int numItems)
        {
            contextMock = XMLFile.DeserializeList <List <ProductDTO> >(FILE_NAME);

            return(new PageDTO {
                TotalProducts = contextMock.Count(), TotalPages = 1, Products = contextMock
            });
        }
示例#9
0
 /// <summary>
 /// Saves <see cref="XMLFile"/> by overwriting or creating a new file. Encrypts data before saving if encryption key is provided.
 /// </summary>
 /// <param name="xmlFile">XMLFile object that contains file settings and data.</param>
 /// <param name="overwrite">If true then existing file be be overwritten.</param>
 /// <param name="encryptionKey">Encryption key that will encrypt the data before saving.</param>
 /// <returns>returns <see cref="RESPONSE_CODES"/>.</returns>
 public static RESPONSE_CODES Save(XMLFile xmlFile, bool overwrite, string encryptionKey)
 {
     if (encryptionKey != null && encryptionKey.Trim().Length > 0)
     {
         xmlFile.XMLData = Crypto.EncryptStringAES(xmlFile.XMLData, encryptionKey);
     }
     return(Save(xmlFile, overwrite));
 }
示例#10
0
        public ProductDTO Insert(ProductDTO product)
        {
            contextMock = XMLFile.DeserializeList <List <ProductDTO> >(FILE_NAME);

            product.Id = Utilities.NewProductId(10, false);
            contextMock.Add(product);
            XMLFile.SerializeList(contextMock, FILE_NAME);
            return(product);
        }
示例#11
0
        public void LoadData()
        {
            //obtaining data products dictionary from XML file
            XMLFile.Path    = @"C:\Users\Curso\source\repos\UnitTestProducts\";
            ProductsFromXML = XMLFile.DeserializeList <List <ProductDTO> >("XMLProducctsFile.xml");

            //Using Mock data base
            pcMock = new ProductsController(new DataProductsContextMock());
        }
示例#12
0
文件: Program.cs 项目: hqdmyjsw/aoeo
        static void convertXML(string path)
        {
            string newfilename = String.Format("{0}", Path.ChangeExtension(path, "xmb"));

            Console.WriteLine(newfilename);
            XmlDocument x = new XmlDocument();

            x.Load(path);
            XMLFile.toXMB(x, newfilename);
        }
示例#13
0
        /// <summary>
        /// Loads <see cref="XMLFile"/> from given <see cref="FilePath"/> and decrypts data if decryption key is provided.
        /// </summary>
        /// <param name="FilePath">Complete path including filename.</param>
        /// <returns>Returns <see cref="XMLFile"/> object.</returns>
        public static XMLFile Load(string FilePath, string decryptionKey)
        {
            XMLFile xf = Load(FilePath);

            if (decryptionKey != null && decryptionKey.Trim().Length > 0)
            {
                xf.XMLData = Crypto.DecryptStringAES(xf.XMLData, decryptionKey);
            }
            return(xf);
        }
示例#14
0
        public void updateDocumentPrinterName(string name)
        {
            POSData printer_data = new POSData()
            {
                ReciptPrinterName = readReciptPrinterName(), DocumentSavePath = readDocumentSavePath(), DocumentPrinterName = name
            };

            try { XMLFile.ToXmlFile(printer_data, Paths.PROGRAME_DATA_FILE); logger.log("Recipt printer name successfully updated!"); }
            catch (Exception ex) { logger.log($"Failed to update printer name: {ex}", Logger.LogLevel.LEVEL_ERROR); }
        }
示例#15
0
        public void updateDocumentSavePath(string path)
        {
            POSData document_data = new POSData()
            {
                ReciptPrinterName = readReciptPrinterName(), DocumentSavePath = path, DocumentPrinterName = readDocumentPrinterName()
            };

            try { XMLFile.ToXmlFile(document_data, Paths.PROGRAME_DATA_FILE); logger.log("Document save path successfully updated!"); }
            catch (Exception ex) { logger.log($"Failed to update document save path: {ex}", Logger.LogLevel.LEVEL_ERROR); }
        }
        public void TestSimplestModel()
        {
            Package               input   = Loader.GetEnAarPackage("{C0315CAE-0D96-4b33-B553-0D9827E4DD6C}");
            IMetaModelInterface   editor  = new ReflectiveMetamodelInterface();
            XMLFile               output  = new XMLFile();
            TransformationEA2FMEA transfo = new TransformationEA2FMEA(editor);

            transfo.EA2FMEA_Start(output, input);
            Console.WriteLine(output.ToString());
        }
示例#17
0
        public IActionResult GetAppsDBName()
        {
            XMLFile xml01 = new XMLFile(_env.ContentRootPath + "/XMlFiles/01/App.config.xml");
            XMLFile xml02 = new XMLFile(_env.ContentRootPath + "/XMlFiles/02/App.config.xml");

            var DBNameOf01 = this.xmlFileServices.ReadKey(xml01, "DB");
            var DBNameOf02 = this.xmlFileServices.ReadKey(xml02, "DB");

            return(Json(new { App01 = DBNameOf01, App02 = DBNameOf02 }));
        }
示例#18
0
    /// <summary>
    /// Compute a summary for given project containing languages and percentages
    /// </summary>
    /// <param name="project">ProjectInfo of the project to be checked</param>
    /// <param name="maxPerc">only returns the objects in the list where the completed percentage is below gived value</param>
    /// <param name="minPerc">only returns the objects in the list where the completed percentage is above gived value</param>
    /// <returns>A List of translated Languages as ProjectFileShortSummary object</returns>
    public static List <ProjectHelper.ProjectFileShortSummary> ComputeSummary(ProjectHelper.ProjectInfo project, double minPerc = 0, double maxPerc = 99.999)
    {
        List <ProjectHelper.ProjectFileShortSummary> functionReturnValue = new List <ProjectHelper.ProjectFileShortSummary>();

        string ProjDirectory = ConfigurationManager.AppSettings["ProjectDirectory"] + project.Folder;

        if (Directory.Exists(ProjDirectory))
        {
            // Logger.Write("Directory '" + Directory + "' exists.", Category, 10, 0, Diagnostics.TraceEventType.Verbose, LogTitle, LogProperties);

            string[] AllLanguageFiles = Directory.GetFiles(ProjDirectory, "*.xml", SearchOption.TopDirectoryOnly);

            foreach (string LanguageFilename in AllLanguageFiles)
            {
                XmlDocument LanguageXML = XMLFile.GetXMLDocument(LanguageFilename);

                ProjectHelper.ProjectFileShortSummary pss = new ProjectHelper.ProjectFileShortSummary();

                // if there is something wrong with the xml file, it will raise an exception here for the first time
                try
                {
                    pss.LangCode = LanguageXML.SelectSingleNode("files").Attributes["language"].Value;
                }
                catch (Exception e) { throw new Exception("Your language file " + LanguageFilename + " is damaged!", e); }

                double   Percentage = 0.0;
                DateTime LastUpdate = DateTime.MinValue;

                foreach (XmlNode FileNode in LanguageXML.SelectNodes("/files/file"))
                {
                    Percentage += Convert.ToDouble(FileNode["percentcompleted"].InnerText, CultureInfo.InvariantCulture);
                    try
                    {
                        DateTime LastChange = DateTime.Parse(FileNode["lastchange"].InnerText);
                        if (LastChange > LastUpdate)
                        {
                            LastUpdate = LastChange;
                        }
                    }
                    catch (FormatException) { }
                }

                Percentage     = Math.Round(Percentage / LanguageXML.SelectNodes("/files/file").Count, 4);
                pss.Percentage = Percentage;
                pss.LastUpdate = LastUpdate;
                pss.LangFile   = LanguageFilename;

                if (Percentage >= minPerc && Percentage <= maxPerc)
                {
                    functionReturnValue.Add(pss);
                }
            }
        }
        return(functionReturnValue);
    }
 public UIRequisitionList()
 {
     InitializeComponent();
     db = new SDBServiceClient();
     mcm = new MouseClickManager(dgRDetails, 400);
     mcm.DoubleClick += new MouseButtonEventHandler(mcm_DoubleClick);
     db.GetMastersCompleted += new EventHandler<GetMastersCompletedEventArgs>(db_GetMastersCompleted);
     db.GetCustomersCompleted += new EventHandler<GetCustomersCompletedEventArgs>(db_GetCustomersCompleted);
     db.GetRequistionCompleted += new EventHandler<GetRequistionCompletedEventArgs>(db_GetRequistionCompleted);
     xmlFile = new XMLFile();
 }
示例#20
0
        public string ReadKey(XMLFile xml, string key)
        {
            XDocument doc      = XDocument.Load(xml.Path);
            var       elements = doc.Descendants("appSettings").Descendants("add").Select(x => new {
                Key   = x.Attribute("key").Value,
                Value = x.Attribute("value").Value
            }).ToList();
            var DbName = elements.Where(e => e.Key == key).Select(e => e.Value).FirstOrDefault();

            return(DbName);
        }
        public void TestGenerateHTMLFileName()
        {
            //mock a xml file Object
            XMLFile file = new XMLFile
            {
                Name     = "Test.xml",
                FullPath = @"C:\Test.xml"
            };

            Assert.AreEqual(file.GetHTMLFileName(), "Test.html");
        }
示例#22
0
 public string readReciptPrinterName()
 {
     try {
         POSData printer = XMLFile.FromXmlFile <POSData>(Paths.PROGRAME_DATA_FILE);
         logger.log("Recipt printer name successfully read!");
         return(printer.ReciptPrinterName);
     }
     catch (Exception ex) {
         logger.log($"Failed to read printer name: {ex}", Logger.LogLevel.LEVEL_ERROR);
         return("");
     }
 }
示例#23
0
 public string readDocumentSavePath()
 {
     try {
         POSData document_data = XMLFile.FromXmlFile <POSData>(Paths.PROGRAME_DATA_FILE);
         logger.log("Document save path successfully read!");
         return(document_data.DocumentSavePath);
     }
     catch (Exception ex) {
         logger.log($"Failed to read document save path: {ex}", Logger.LogLevel.LEVEL_ERROR);
         return(Paths.DOCUMENT_SAVE_PATH);
     }
 }
示例#24
0
        public Tuple <bool, List <FileDiagnostics> > ProcessFile(Stream File, string FileName)
        {
            Tuple <bool, List <FileDiagnostics> > tpl = null;

            try
            {
                string FType = Path.GetExtension(FileName);

                if (FType == Constants.CSV)
                {
                    BaseFile baseFile = new CSVFile();
                    baseFile._Stream = File;
                    List <FileDiagnostics> ValidationMessage = baseFile.ValidateData();
                    if (ValidationMessage != null && ValidationMessage.Count > 0)
                    {
                        tpl = Tuple.Create(false, ValidationMessage);
                    }
                    else
                    {
                        tpl = Tuple.Create(baseFile.SaveData(), ValidationMessage);
                    }
                }
                else if (FType == Constants.XML)
                {
                    BaseFile baseFile = new XMLFile();
                    baseFile._Stream = File;
                    List <FileDiagnostics> ValidationMessage = baseFile.ValidateData();
                    if (ValidationMessage != null && ValidationMessage.Count > 0)
                    {
                        tpl = Tuple.Create(false, ValidationMessage);
                    }
                    else
                    {
                        tpl = Tuple.Create(baseFile.SaveData(), ValidationMessage);
                    }
                }
                else
                {
                    return(Tuple.Create(false, new List <FileDiagnostics>()
                    {
                        new FileDiagnostics()
                        {
                            FieldName = "File", Message = "Unknown file format"
                        }
                    }));
                }
            }
            catch (Exception ex)
            {
                AppLogger.Log(ex);
            }
            return(tpl);
        }
示例#25
0
        public Spell(int id)
        {
            ID = id;
            XMLFile file = new XMLFile("Data/Spell.xml");

            foreach (XMLSection spell in file.GetSections()[0].GetSections("spell"))
            {
                if (Convert.ToInt32(spell.GetAttribute("id")) == id)
                {
                    Name          = spell.Get("name", "Unknown");
                    Description   = spell.Get("description", "Description not found.");
                    voluntary     = spell.Get("voluntary", true);
                    Level         = spell.Get("level", 0);
                    spelltype     = spell.GetEnum("type", CardEffectType.INSTANT);
                    spelltrigger  = spell.GetEnum("trigger", CardEffectTrigger.IMMEDIATE);
                    triggeramount = spell.Get("triggeramount", 0);

                    effects = new List <CardEffect>();
                    foreach (XMLSection e in spell.GetSections("effect"))
                    {
                        CardEffect effect = new CardEffect();

                        effect.Range            = e.GetEnum("range", CardEffectTargetRange.ANY);
                        effect.Action           = e.GetEnum <CardEffectAction>("action");
                        effect.TargetAssignment = e.GetEnum("assignment", CardEffectTargetAssignment.NONE);
                        if (effect.TargetAssignment == CardEffectTargetAssignment.PREVIOUS && effects.Count > 0)
                        {
                            effect.TargetType = effects.Last().TargetType;
                        }
                        else
                        {
                            effect.TargetType = e.GetEnum <CardEffectTargetType>("target");
                        }
                        effect.EffectStat = e.GetEnum("stat", CardEffectStat.NULL);
                        effect.Amount     = e.Get("amount", 0);

                        effect.Requirements = new List <CardEffectTargetRequirement>();
                        foreach (XMLSection r in e.GetSections("requirement"))
                        {
                            CardEffectTargetRequirement requirement = new CardEffectTargetRequirement();
                            requirement.Stat    = r.GetEnum <CardEffectStat>("stat");
                            requirement.Maximum = r.Get("maximum", 9999);
                            requirement.Minimum = r.Get("minimum", 0);
                            effect.Requirements.Add(requirement);
                        }

                        effects.Add(effect);
                    }

                    break;
                }
            }
        }
示例#26
0
 /// <summary>
 /// Initialize a new XMLConfig
 /// </summary>
 /// <param name="path">The path to this XML file</param>
 /// <param name="parentNode">The name of the node in which this config's properties are located. Defaults to the root node.</param>
 public XMLConfig(string path = "Config.xml", string parentNode = "")
 {
     this.path = path;
     file      = new XMLFile(path);
     if (parentNode.Length == 0)
     {
         this.parentNode = file.Children[0].Key;
     }
     else
     {
         this.parentNode = parentNode;
     }
 }
示例#27
0
        static void Main(string[] args)
        {
            Console.ForegroundColor = ConsoleColor.Cyan;
            Console.WriteLine("DATSpeechTool by gdkchan");
            Console.WriteLine("MGS4 speech.dat subtitle extractor/inserter");
            Console.WriteLine("Version 0.2.0");
            Console.ResetColor();
            Console.Write(Environment.NewLine);

            if (args.Length == 0)
            {
                PrintUsage();
                return;
            }
            else
            {
                switch (args[0])
                {
                case "-xdat": Data.Extract(args[1], args[2], args[3]); break;

                case "-cdat": Data.Create(args[1], args[2], args[3]); break;

                case "-xspc": Speech.Extract(args[1], args[2]); break;

                case "-ispc": Speech.Insert(args[1], args[2]); break;

                case "-xspcall":
                    string[] SPCFiles = Directory.GetFiles(Environment.CurrentDirectory, "*.spc");
                    foreach (string SPCFile in SPCFiles)
                    {
                        string OutFile = SPCFile.Replace(".spc", ".xml");
                        Speech.Extract(SPCFile, OutFile);
                    }
                    break;

                case "-ispcall":
                    string[] XMLFiles = Directory.GetFiles(Environment.CurrentDirectory, "*.xml");
                    foreach (string XMLFile in XMLFiles)
                    {
                        string OutFile = XMLFile.Replace(".xml", ".spc");
                        Speech.Insert(OutFile, XMLFile);
                    }
                    break;

                default: TextOut.PrintError("Invalid command \"" + args[0] + "\" used!"); return;
                }
            }

            Console.Write(Environment.NewLine);
            TextOut.PrintSuccess("Finished!");
        }
示例#28
0
        /// <summary>
        /// Converts the contents of this list into an XMLFile.
        /// </summary>
        /// <returns>An XMLFile object containing all the queries in this list.</returns>
        public XMLFile ToXML()
        {
            XMLFile file = new XMLFile(FilePath);

            file.Children.Clear();
            XMLSection top = new XMLSection("queries");

            foreach (Query q in this)
            {
                top.AddSection(q.ToXML());
            }
            file.AddSection(top);
            return(file);
        }
示例#29
0
        private void selectFiles()
        {
            List <CFe.Node.Node> cfes = new List <CFe.Node.Node>();

            if (m_openFileDialog.ShowDialog() == System.Windows.Forms.DialogResult.OK && m_openFileDialog.FileNames.Length > 0)
            {
                foreach (XMLFile xml in XMLFile.LoadFile(m_openFileDialog.FileNames))
                {
                    cfes.AddRange(xml.getCFes().Cast <CFe.Node.Node>());
                }
            }

            updateListView(cfes);
        }
示例#30
0
        static void Main()
        {
            CartesObj     cartes = new CartesObj();
            RPADataString Abort;
            string        workingFile;

            workingFile = Environment.CurrentDirectory;
            cartes.open(workingFile + "\\rpa\\AbortAndXML.rpa");
            try
            {
                XmlDocument doc       = new XmlDocument();
                XmlNode     usersNode = doc.CreateElement("users");
                XMLFile     datos2    = new XMLFile(); // Cartes class from CE_Data

                Abort = (RPADataString)cartes.component("$Abort");
                Abort.ShowAbortDialog("Presss the button to end", "Bye", "Abort");
                if (Abort.Value == "0")
                {
                    XmlNode userNode  = null;
                    XmlNode phoneNode = null;

                    // I create the XML with the native class of C #
                    doc.AppendChild(usersNode);
                    userNode           = doc.CreateElement("name");
                    userNode.InnerText = "Federico Codd";
                    usersNode.AppendChild(userNode);
                    phoneNode           = doc.CreateElement("telephone");
                    phoneNode.InnerText = "985124753";
                    usersNode.AppendChild(phoneNode);
                    phoneNode           = doc.CreateElement("telephone");
                    phoneNode.InnerText = "654357951";
                    usersNode.AppendChild(phoneNode);
                    // I create the XML with the Cartes class
                    datos2.AsString["name"] = userNode.InnerText;
                    datos2.getKey("telephone").listAsString[0] = "985124753";
                    datos2.getKey("telephone").listAsString[1] = "985124753";
                    do
                    {
                        Thread.Sleep(2000);
                    }while (Abort.Value == "0");
                    doc.Save(workingFile + "\\datos1.xml");
                    datos2.SaveToFile(workingFile + "\\datos2.xml");
                }
            }
            finally
            {
                cartes.close();
            }
        }
示例#31
0
 /// <summary>
 /// 
 /// </summary>
 public UIRequisition()
 {
     InitializeComponent();
     opMod =(int) Common.opmode;
     req = Common.requisition;
     if (App.Current.IsRunningOutOfBrowser)
     {
         dynamic wscript = AutomationFactory.CreateObject("WScript.Network");
         pcName = (string)wscript.ComputerName;
     }
     this.LayoutRoot.DataContext = new DBService.Requisition();            
     db.UpdateRequisitionCompleted += new EventHandler<UpdateRequisitionCompletedEventArgs>(db_UpdateRequisitionCompleted);
     xmlFile = new XMLFile();
     this.BindingValidationError += new EventHandler<ValidationErrorEventArgs>(UIRequisition_BindingValidationError);
 }
示例#32
0
        public PageDTO SelectByName(string name, int page, int numItems)
        {
            contextMock = XMLFile.DeserializeList <List <ProductDTO> >(FILE_NAME);

            var products = contextMock.Where(p => p.Name == name).ToList();

            if (products != null)
            {
                return new PageDTO {
                           TotalPages = 1, TotalProducts = products.Count(), Products = products
                }
            }
            ;
            return(new PageDTO());
        }
示例#33
0
        public bool Update(ProductDTO product)
        {
            contextMock = XMLFile.DeserializeList <List <ProductDTO> >(FILE_NAME);

            var productInContext = contextMock.FirstOrDefault(p => p.Id == product.Id);

            if (productInContext != null)
            {
                productInContext = product;

                XMLFile.SerializeList(contextMock, FILE_NAME);
                return(true);
            }
            return(false);
        }
示例#34
0
 /// <summary>
 /// 
 /// </summary>
 public UIStaff()
 {
     InitializeComponent();
     this.LayoutRoot.DataContext = new DBService.Staff();            
     if (App.Current.IsRunningOutOfBrowser)
     {
         dynamic wscript = AutomationFactory.CreateObject("WScript.Network");                      //***code should be checked with xp
         pcName = (string)wscript.ComputerName;
     }
     db.UpdateStaffCompleted += new EventHandler<UpdateStaffCompletedEventArgs>(db_UpdateStaffCompleted); 
     //DisplayDetails("0=0");
     this.LayoutRoot.DataContext = new DBService.Customer();
     xmlFile = new XMLFile();
     this.BindingValidationError += new EventHandler<ValidationErrorEventArgs>(UIStaff_BindingValidationError);
     db.GetMaxCodeCompleted += new EventHandler<GetMaxCodeCompletedEventArgs>(db_GetMaxCodeCompleted);
 }
示例#35
0
 /// <summary>
 /// Saves <see cref="XMLFile"/> by overwriting or creating a new file.
 /// </summary>
 /// <param name="xmlFile">XMLFile object that contains file settings and data.</param>
 /// <param name="overwrite">If true then existing file be be overwritten.</param>
 /// <returns>returns <see cref="RESPONSE_CODES"/>.</returns>
 public static RESPONSE_CODES Save(XMLFile xmlFile, bool overwrite)
 {
     if (overwrite == false)
     {
         if (File.Exists(xmlFile.Filename) == true)
         {
             return RESPONSE_CODES.FILE_EXISTS;
         }
     }
     try
     {
         File.WriteAllText(xmlFile.Filename, Converters.CreateXML(xmlFile));
     }
     catch (Exception) { return RESPONSE_CODES.SAVE_FAILED; }
     return RESPONSE_CODES.SAVE_SUCCESS;
 }
示例#36
0
 /// <summary>
 /// 
 /// </summary>
 public UICustomer()
 {
     InitializeComponent();
     this.LayoutRoot.DataContext = new DBService.Customer();            
     if (App.Current.IsRunningOutOfBrowser)
     {
         dynamic wscript = AutomationFactory.CreateObject("WScript.Network");                      //***code should be checked with xp
         pcName = (string)wscript.ComputerName;
     }
     db.UpdateCustomerCompleted += new EventHandler<UpdateCustomerCompletedEventArgs>(db_UpdateCustomerCompleted);
     
     this.LayoutRoot.DataContext = new DBService.Customer();            
     xmlFile = new XMLFile();
     this.BindingValidationError += new EventHandler<ValidationErrorEventArgs>(cwCustomer_BindingValidationError);
     db.GetMaxCodeCompleted += new EventHandler<GetMaxCodeCompletedEventArgs>(db_GetMaxCodeCompleted);
     CommandStatus.Refresh = true;
     CommandStatus.Print = true;
     CommandStatus.Show = false;
     CommandStatus.SendMail = false;
 }
示例#37
0
        public App()
        {
            this.Startup += this.Application_Startup;
            this.Exit += this.Application_Exit;
            this.UnhandledException += this.Application_UnhandledException;
            //App.Current.CheckAndDownloadUpdateCompleted += new CheckAndDownloadUpdateCompletedEventHandler(Current_CheckAndDownloadUpdateCompleted);
            InitializeComponent();
            xmlfile = new XMLFile();
            Thread.CurrentThread.CurrentCulture = (CultureInfo)Thread.CurrentThread.CurrentCulture.Clone();
            Thread.CurrentThread.CurrentCulture.DateTimeFormat.ShortDatePattern = "yyyy/MM/dd";
            POdb = new SDBServiceClient();
            Estdb = new SDBServiceClient();
            EOdb = new SDBServiceClient();
            RDOdb = new SDBServiceClient();
            ROdb = new SDBServiceClient();

            POdb.DownloadTemplateCompleted += new EventHandler<DownloadTemplateCompletedEventArgs>(POdb_DownloadTemplateCompleted);
            Estdb.DownloadTemplateCompleted += new EventHandler<DownloadTemplateCompletedEventArgs>(Estdb_DownloadTemplateCompleted);
            EOdb.DownloadTemplateCompleted += new EventHandler<DownloadTemplateCompletedEventArgs>(EOdb_DownloadTemplateCompleted);
            RDOdb.DownloadTemplateCompleted += new EventHandler<DownloadTemplateCompletedEventArgs>(RDOdb_DownloadTemplateCompleted);
            ROdb.DownloadTemplateCompleted += new EventHandler<DownloadTemplateCompletedEventArgs>(ROdb_DownloadTemplateCompleted);
          }
示例#38
0
 /// <summary>
 /// 
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void Page_Loaded(object sender, RoutedEventArgs e)
 {
     XMLFile xmlFile = new XMLFile();
     XMLFile.XMLFileUpdated += new EventHandler(RefreshFavourite);
     Common.favourites = xmlFile.ReadXml();
     lbFavourite.ItemsSource = Common.favourites;
     acdnMenu.SelectedIndex = 4;
     FContent.Source = new Uri("/Pages/UIGraph.xaml", UriKind.Relative);
 }
示例#39
0
 /// <summary>
 /// 
 /// </summary>
 public void RefreshFavourite(object obj, EventArgs e)
 {
     XMLFile xmlFile = new XMLFile();
     Common.favourites = xmlFile.ReadXml();
     lbFavourite.ItemsSource = Common.favourites;
 }
示例#40
0
        // Executes when the user navigates to this page.
        protected override void OnNavigatedTo(NavigationEventArgs e)
        {
            if (App.Current.IsRunningOutOfBrowser)
            {
                dynamic wscript = AutomationFactory.CreateObject("WScript.Network");
                Common.PCName = (string)wscript.ComputerName;
            }

            XMLFile xmlFile = new XMLFile();
            XMLFile.XMLFileUpdated += new EventHandler(RefreshFavourite);
            Common.favourites = xmlFile.ReadXml();
            lbFavourite.ItemsSource = Common.favourites;
            acdnMenu.SelectedIndex = 4;
            FContent.Source = new Uri("/Pages/UIGraph.xaml", UriKind.Relative);
        }
示例#41
0
        /// <summary>
        /// 
        /// </summary>
        public UIMaster()
        {
            InitializeComponent();
            this.MasterRoot.Visibility = System.Windows.Visibility.Visible;
            this.TaxRoot.Visibility = System.Windows.Visibility.Collapsed;
            if (App.Current.IsRunningOutOfBrowser)
            {
                dynamic wscript = AutomationFactory.CreateObject("WScript.Network");
                pcName = (string)wscript.ComputerName;
            }
            dbEx.UpdateMasterCompleted += new EventHandler<UpdateMasterCompletedEventArgs>(UpdateMasterCompleted);
            dbPC.UpdateMasterCompleted += new EventHandler<UpdateMasterCompletedEventArgs>(UpdateMasterCompleted);
            dbSf.UpdateMasterCompleted += new EventHandler<UpdateMasterCompletedEventArgs>(UpdateMasterCompleted);
            dbSp.UpdateMasterCompleted += new EventHandler<UpdateMasterCompletedEventArgs>(UpdateMasterCompleted);
            dbTx.UpdateTaxCompleted += new EventHandler<UpdateTaxCompletedEventArgs>(dbTx_UpdateTaxCompleted);
            dbUt.UpdateMasterCompleted += new EventHandler<UpdateMasterCompletedEventArgs>(UpdateMasterCompleted); 
            this.Loaded += new RoutedEventHandler(cwMaster_Loaded);
            //this.MasterRoot.DataContext = new DBService.Master();
            this.dgSupplier.DataContext = new DBService.Supplier();
            this.dgPayCond.DataContext = new DBService.Master();
            this.dgEX.DataContext = new DBService.Master();
            this.dgCategory.DataContext = new DBService.Master();
            this.dgUnit.DataContext = new DBService.Master();
 
            this.TaxRoot.DataContext = new DBService.Tax();
            xmlFile = new XMLFile();
            
        }
示例#42
0
 /// <summary>
 /// Saves <see cref="XMLFile"/> by overwriting or creating a new file. Encrypts data before saving if encryption key is provided.
 /// </summary>
 /// <param name="xmlFile">XMLFile object that contains file settings and data.</param>
 /// <param name="overwrite">If true then existing file be be overwritten.</param>
 /// <param name="encryptionKey">Encryption key that will encrypt the data before saving.</param>
 /// <returns>returns <see cref="RESPONSE_CODES"/>.</returns>
 public static RESPONSE_CODES Save(XMLFile xmlFile, bool overwrite, string encryptionKey)
 {
     if (encryptionKey != null && encryptionKey.Trim().Length > 0)
         xmlFile.XMLData = Crypto.EncryptStringAES(xmlFile.XMLData, encryptionKey);
     return Save(xmlFile, overwrite);
 }