Пример #1
0
        protected override ReportTask CreateItemFromXmlNode(System.Xml.XmlNode xmlNode)
        {
            ReportTask task = new ReportTask();

            task.Name                   = xmlNode.GetAttributeValueIf("Name");
            task.Description            = xmlNode.GetAttributeValueIf("Description");
            task.OutputFolder           = xmlNode.GetNodeValueIf("OutputFolder");
            task.IsSendMailInSingleMail = bool.Parse(xmlNode.GetNodeValueIf("SendInSingleMail"));
            task.IsMergeInSingleExcel   = bool.Parse(xmlNode.GetNodeValueIf("MergeInSingleExcel"));

            XmlNodeList reportNodeList = xmlNode.SelectNodes("Reports/Report");

            for (int i = 0; i < reportNodeList.Count; i++)
            {
                string report = reportNodeList[i].GetNodeValueIf();
                if (ReportConfig.QvReportManager.ItemCollection.ContainsKey(report))
                {
                    var qvReport = ReportConfig.QvReportManager.ItemCollection[report];
                    task.Reports.Add(report, qvReport);
                }
            }

            XmlNodeList recipientNodeList = xmlNode.SelectNodes("Recipients/Recipient");

            for (int i = 0; i < recipientNodeList.Count; i++)
            {
                string recipient = recipientNodeList[i].GetNodeValueIf();
                if (ReportConfig.RecipientManager.ItemCollection.ContainsKey(recipient))
                {
                    task.Recipients.Add(recipient, ReportConfig.RecipientManager.ItemCollection[recipient]);
                }
            }

            string recipientGroup = xmlNode.GetNodeValueIf("RecipientGroup");

            if (ReportConfig.RecipientGroupManager.ItemCollection.ContainsKey(recipientGroup))
            {
                task.Group = ReportConfig.RecipientGroupManager.ItemCollection[recipientGroup];
            }

            task.MessageDefinition         = new Message();
            task.MessageDefinition.From    = xmlNode.GetNodeValueIf("Message/From");
            task.MessageDefinition.CC      = xmlNode.GetNodeValueIf("Message/CC");
            task.MessageDefinition.BCC     = xmlNode.GetNodeValueIf("Message/BCC");
            task.MessageDefinition.Subject = xmlNode.GetNodeValueIf("Message/Subject");
            task.MessageDefinition.Body    = xmlNode.GetNodeValueIf("Message/Body");

            if (xmlNode.ChildNodeExists("FtpServer"))
            {
                task.FtpServer          = new FtpServer();
                task.FtpServer.Host     = xmlNode.GetNodeValueIf("FtpServer/Host");
                task.FtpServer.Username = xmlNode.GetNodeValueIf("FtpServer/Username");
                task.FtpServer.Password = EncryptionDecryption.Decode(xmlNode.GetNodeValueIf("FtpServer/Password"));
                task.FtpServer.Folder   = xmlNode.GetNodeValueIf("FtpServer/Folder");
                task.FtpServer.Port     = xmlNode.GetNodeValueIf("FtpServer/Port");
            }
            return(task);
        }
Пример #2
0
        protected override ReportConnection CreateItemFromXmlNode(System.Xml.XmlNode xmlNode)
        {
            ReportConnection connection = new ReportConnection();

            connection.Name             = xmlNode.GetAttributeValueIf("Name");
            connection.Description      = xmlNode.GetAttributeValueIf("Description");
            connection.IsLocal          = bool.Parse(xmlNode.GetNodeValueIf("IsLocal"));
            connection.QlikViewDocument = xmlNode.GetNodeValueIf("QlikViewDocument");
            connection.ServerName       = xmlNode.GetNodeValueIf("ServerName");
            connection.ServiceHost      = xmlNode.GetNodeValueIf("WebServiceHost");
            connection.ServicePort      = xmlNode.GetNodeValueIf("WebServicePort");
            connection.User             = xmlNode.GetNodeValueIf("User");
            connection.Password         = EncryptionDecryption.Decode(xmlNode.GetNodeValueIf("Password"));

            return(connection);
        }
Пример #3
0
        public SmtpServerManager()
        {
            string folder = System.Reflection.Assembly.GetExecutingAssembly().CodeBase.Remove(System.Reflection.Assembly.GetExecutingAssembly().CodeBase.LastIndexOf("/"));

            folder     = folder.Replace("file:///", "");
            ConfigFile = folder + "/" + System.Configuration.ConfigurationManager.AppSettings["ReportConfig"];

            this._xmlDoc = new XmlDocument();
            this._xmlDoc.Load(ConfigFile);

            XmlNode smtpServerRootNode = this._xmlDoc.SelectSingleNode("ReportConfig/SmtpServer");

            //Smtp Server
            this.SmtpServer        = new SmtpServer();
            this.SmtpServer.Server = smtpServerRootNode.GetNodeValueIf("Server");
            this.SmtpServer.PickupDirectoryLocation = smtpServerRootNode.GetNodeValueIf("PickupDirectoryLocation");
            this.SmtpServer.User          = smtpServerRootNode.GetNodeValueIf("User");
            this.SmtpServer.Password      = EncryptionDecryption.Decode(smtpServerRootNode.GetNodeValueIf("Password"));
            this.SmtpServer.ExceptionFrom = smtpServerRootNode.GetNodeValueIf("ExceptionMailFrom");
            this.SmtpServer.ExceptionTo   = smtpServerRootNode.GetNodeValueIf("ExceptionMailTo");
            this.SmtpServer.UsePickupDirectoryLocation = bool.Parse(smtpServerRootNode.GetNodeValueIf("UsePickupDirectoryLocation"));
        }