public CampaignTreeFactory()
        {
            CampaignTrees = new List<CampaignTree>();
            CampaignStepFactory = new CampaignStepFactory();
            CampaignStepTypeFactory = new CampaignStepTypeFactory();
            CampaignBriefingFactory = new CampaignBriefingFactory();

            Uri uri = new Uri(Constants.Campaign_TreeDataPath, UriKind.Relative);
            XElement applicationXml;
            StreamResourceInfo xmlStream = Application.GetResourceStream(uri);
            applicationXml = XElement.Load(xmlStream.Stream);
            var data = from t in applicationXml.Descendants("Campaign_Tree")
                       select t;

            CampaignTree campaignTree = null;
            foreach (var d in data)
            {
                campaignTree = new CampaignTree();
                campaignTree.CampaignTreeId = (Int32)d.Element("CampaignTreeId");
                campaignTree.CurrentCampaignStep = CampaignStepFactory.GetCampaignStep((Int32)d.Element("CurrentCampaignStepId"));
                campaignTree.CampaignStepType = CampaignStepTypeFactory.GetCampaignStepType((Int32)d.Element("CampaignStepTypeId"));
                campaignTree.Prestige = (Int32)d.Element("Prestige");
                campaignTree.CampaignBriefing = CampaignBriefingFactory.GetCampaignBriefing((Int32)d.Element("BriefingId"));
                campaignTree.NextCampaignStep = CampaignStepFactory.GetCampaignStep((Int32)d.Element("NextCampaignStepId"));
                CampaignTrees.Add(campaignTree);
            }
        }
예제 #2
0
 public CampaignFactory()
 {
     Campaigns = new List<CampaignInfo>();
     CampaignBriefingFactory = new CampaignBriefingFactory();
     CampaignStepFactory = new CampaignStepFactory();
     CampaignStepTypeFactory = new CampaignStepTypeFactory();
     CampaignTreeFactory = new CampaignTreeFactory();
     PopulateCampaigns();
 }
        public CampaignStepFactory()
        {
            CampaignSteps = new List<CampaignStep>();
            CampaignBriefingFactory = new CampaignBriefingFactory();

            Uri uri = new Uri(Constants.Campaign_StepDataPath, UriKind.Relative);
            XElement applicationXml;
            StreamResourceInfo xmlStream = Application.GetResourceStream(uri);
            applicationXml = XElement.Load(xmlStream.Stream);
            var data = from t in applicationXml.Descendants("Campaign_Step")
                       select t;

            CampaignStep campaignStep = null;
            foreach (var d in data)
            {
                campaignStep = new CampaignStep();
                campaignStep.CampaignStepId = (Int32)d.Element("CampaignStepId");
                campaignStep.CampaignStepDescription = (String)d.Element("CampaignStepDesc");
                campaignStep.CampaignBriefing = CampaignBriefingFactory.GetCampaignBriefing((Int32)d.Element("BriefingId"));
                campaignStep.ScenarioId = ((Int32)d.Element("ScenarioId"));
                CampaignSteps.Add(campaignStep);
            }
        }