Example #1
0
        private List <TriggerList> GenerateTotalTriggerList()
        {
            var appManCoEmails = this._appManCoEmailService.GetAppManCoEmails();

            var applications = GetApplications(appManCoEmails.ToList());

            var totalTriggerList = new List <TriggerList>();

            foreach (var app in applications)
            {
                var appOtfData = this.GetOtfDataByAppId(app.Id, appManCoEmails.ToList());

                var manCos = this.GetManCos(appOtfData);

                foreach (var manCo in manCos)
                {
                    var manCoTriggerList = new TriggerList()
                    {
                        AppId = app.Code, ManCoId = manCo.Code
                    };

                    var listOtfRecords = this.GetSingleOtfRecords(manCo.Id, appOtfData);

                    manCoTriggerList.Name = listOtfRecords[0].DocType;

                    manCoTriggerList.Records.AddRange(listOtfRecords);

                    totalTriggerList.Add(manCoTriggerList);
                }
            }

            appManCoEmails.Clear();

            return(totalTriggerList);
        }
Example #2
0
        private void GenerateTriggerXml(TriggerList triggerList)
        {
            var docName  = triggerList.ManCoId + triggerList.AppId + ".OTF";
            var filePath = this._appInfo.OutputPath;

            XAttribute xTypeText      = new XAttribute("type", "text");
            XAttribute xTypeEmail     = new XAttribute("type", "email");
            XAttribute xTypeFax       = new XAttribute("type", "fax");
            XAttribute xTypeCheckBox  = new XAttribute("type", "checkbox");
            XAttribute xMultipleFalse = new XAttribute("multiple", "false");
            XAttribute xMultipleTrue  = new XAttribute("multiple", "true");

            XDocument xDoc = new XDocument(
                new XDeclaration("1.0", "UTF-8", null),
                new XElement("TriggerList", new XAttribute("applID", triggerList.AppId), new XAttribute("name", GetTriggerName(triggerList.Name))));

            foreach (var record in triggerList.Records)
            {
                xDoc.Element("TriggerList")
                .Add(new XElement(
                         "Record",
                         new XElement(
                             "Section",
                             new XElement("Field", record.ManCo, new XAttribute("label", "ManagerId"), xTypeText, xMultipleFalse),
                             new XElement("Field", record.AccountNumber, new XAttribute("label", "AccountNumber"), xTypeText, xMultipleFalse),
                             new XElement("Field", record.DocType, new XAttribute("label", "DocType"), xTypeText, xMultipleFalse),
                             new XElement("Field", "ALL", new XAttribute("label", "SubDocType"), xTypeText, xMultipleFalse),
                             new XElement("Field", "true", new XAttribute("label", "TxtFile"), xTypeCheckBox, xMultipleFalse),
                             new XAttribute("label", "Main")),
                         new XElement(
                             "Section",
                             new XElement("Field", new XAttribute("label", "InvestorName"), xTypeText, xMultipleFalse),
                             new XElement("Field", new XAttribute("label", "Designation"), xTypeText, xMultipleFalse),
                             new XAttribute("label", "Contact")),
                         new XElement(
                             "Section",
                             new XElement("Field", new XAttribute("label", "email1"), xTypeEmail, xMultipleTrue, record.Emails.Select(x => new XElement("Value", x))),
                             new XAttribute("label", "EMail")),
                         new XElement(
                             "Section",
                             new XElement("Field", new XAttribute("label", "fax1"), xTypeFax, xMultipleTrue),
                             new XAttribute("label", "Fax"))));
            }

            xDoc.Save(filePath + docName);
        }