/// <summary> /// Default constructor. /// </summary> /// <param name="identity">The identity for this character</param> /// <param name="guid">The unique identifier.</param> /// <exception cref="System.ArgumentNullException">identity</exception> protected Character(CharacterIdentity identity, Guid guid) { identity.ThrowIfNull(nameof(identity)); CharacterID = identity.CharacterID; m_name = identity.CharacterName; Identity = identity; Guid = guid; Corporation = new Corporation(this); SkillGroups = new SkillGroupCollection(this); Skills = new SkillCollection(this); UpdateAccountStatus(); EmploymentHistory = new EmploymentRecordCollection(this); ImplantSets = new ImplantSetCollection(this); Plans = new PlanCollection(this); CertificateCategories = new CertificateCategoryCollection(this); CertificateClasses = new CertificateClassCollection(this); Certificates = new CertificateCollection(this); MasteryShips = new MasteryShipCollection(this); for (int i = 0; i < m_attributes.Length; i++) { m_attributes[i] = new CharacterAttribute(this, (EveAttribute)i); } UISettings = new CharacterUISettings(); }
/// <summary> /// Default constructor. /// </summary> /// <param name="identity">The identitiy for this character</param> /// <param name="guid">The unique identifier.</param> /// <exception cref="System.ArgumentNullException">identity</exception> protected Character(CharacterIdentity identity, Guid guid) { identity.ThrowIfNull(nameof(identity)); CharacterID = identity.CharacterID; m_name = identity.CharacterName; CorporationID = identity.CorporationID; CorporationName = identity.CorporationName; Identity = identity; Guid = guid; Corporation = new Corporation(this); SkillGroups = new SkillGroupCollection(this); Skills = new SkillCollection(this); EmploymentHistory = new EmploymentRecordCollection(this); ImplantSets = new ImplantSetCollection(this); Plans = new PlanCollection(this); CertificateCategories = new CertificateCategoryCollection(this); CertificateClasses = new CertificateClassCollection(this); Certificates = new CertificateCollection(this); MasteryShips = new MasteryShipCollection(this); for (int i = 0; i < m_attributes.Length; i++) { m_attributes[i] = new CharacterAttribute(this, (EveAttribute)i); } UISettings = new CharacterUISettings(); }
/// <summary> /// Adds the plans as tool strip items to the list. /// </summary> /// <param name="character"></param> /// <param name="list"></param> /// <param name="initialize"></param> public static void AddTo(this PlanCollection plans, ToolStripItemCollection list, Action <ToolStripMenuItem, Plan> initialize) { //Scroll through plans foreach (var plan in plans) { ToolStripMenuItem planItem = new ToolStripMenuItem(plan.Name); initialize(planItem, plan); list.Add(planItem); } }
protected void AddTermEventDataToChart(Chart chart, DateTime startDate, DateTime endDate, MOE.Common.Business.AnalysisPhaseCollection analysisPhaseCollection, string signalId, bool showVolume, bool showPlanStripes) { foreach (MOE.Common.Business.AnalysisPhase phase in analysisPhaseCollection.Items) { if (phase.TerminationEvents.Count > 0) { foreach (MOE.Common.Models.Controller_Event_Log TermEvent in phase.ConsecutiveGapOuts) { chart.Series["GapOut"].Points.AddXY(TermEvent.Timestamp, phase.PhaseNumber); } foreach (MOE.Common.Models.Controller_Event_Log TermEvent in phase.ConsecutiveMaxOut) { chart.Series["MaxOut"].Points.AddXY(TermEvent.Timestamp, phase.PhaseNumber); } foreach (MOE.Common.Models.Controller_Event_Log TermEvent in phase.ConsecutiveForceOff) { chart.Series["ForceOff"].Points.AddXY(TermEvent.Timestamp, phase.PhaseNumber); } foreach (MOE.Common.Models.Controller_Event_Log TermEvent in phase.UnknownTermination) { chart.Series["Unknown"].Points.AddXY(TermEvent.Timestamp, phase.PhaseNumber); } if (ShowPedActivity) { foreach (MOE.Common.Models.Controller_Event_Log PedEvent in phase.PedestrianEvents) { if (PedEvent.EventCode == 23) { chart.Series["Ped Walk Begin"].Points.AddXY(PedEvent.Timestamp, (phase.PhaseNumber + .3)); } } } } if (showPlanStripes) { PlanCollection.SetSimplePlanStrips(analysisPhaseCollection.Plans, chart, startDate); } if (YAxisMax != null) { chart.ChartAreas[0].AxisY.Maximum = YAxisMax.Value + .5; } } }
public PreemptDetailChart(WCFServiceLibrary.PreemptDetailOptions options, MOE.Common.Business.ControllerEventLogs DTTB) { Options = options; int PreemptNumber = 0; if (DTTB.Events.Count > 0) { var r = (from e in DTTB.Events where e.EventCode != 99 select e).FirstOrDefault(); PreemptNumber = r.EventParam; } TimeSpan reportTimespan = Options.EndDate - Options.StartDate; AddTitleAndLegend(chart, PreemptNumber); AddChartArea(chart, reportTimespan); AddSeries(chart); AddDataToChart(chart, DTTB, PreemptNumber); PlanCollection plans = new PlanCollection(Options.StartDate, Options.EndDate, Options.SignalID); // SetSimplePlanStrips(plans, chart, graphStartDate, graphEndDate, DTTB); }
public async void TestPlansGetRequest() { var createProductResponse = await ProductsCreateTest.CreateProduct(); Product product1 = createProductResponse.Result <Product>(); var plan1Response = await PlansCreateTest.CreatePlan(product1.Id, false, false); Plan plan1 = plan1Response.Result <Plan>(); var plan2Response = await PlansCreateTest.CreatePlan(product1.Id, true, true); Plan plan2 = plan2Response.Result <Plan>(); List <string> planIds = new List <string>() { plan1.Id, plan2.Id }; Console.WriteLine(planIds[0] + " " + planIds[1]); PlansGetRequest request = new PlansGetRequest(product1.Id); var response = await TestHarness.client().Execute(request); Assert.Equal(200, (int)response.StatusCode); PlanCollection retrievedPlanCollection = response.Result <PlanCollection>(); Assert.NotNull(retrievedPlanCollection); Assert.NotEmpty(retrievedPlanCollection.Plans); Assert.Equal(2, retrievedPlanCollection.Plans.Count); Assert.NotNull(retrievedPlanCollection.Plans.FirstOrDefault(f => f.Id == plan1.Id)); Assert.NotNull(retrievedPlanCollection.Plans.FirstOrDefault(f => f.Id == plan2.Id)); Assert.NotNull(retrievedPlanCollection.Links); }
/// <summary> /// Default constructor /// </summary> /// <param name="identity">The identitiy for this character</param> /// <param name="guid"></param> protected Character(CharacterIdentity identity, Guid guid) { m_characterID = identity.CharacterID; m_name = identity.Name; m_identity = identity; m_guid = guid; m_skillGroups = new SkillGroupCollection(this); m_skills = new SkillCollection(this); m_certificateCategories = new CertificateCategoryCollection(this); m_certificateClasses = new CertificateClassCollection(this); m_certificates = new CertificateCollection(this); m_implants = new ImplantSetCollection(this); m_plans = new PlanCollection(this); for (int i = 0; i < m_attributes.Length; i++) { m_attributes[i] = new CharacterAttribute(this, (EveAttribute)i); } m_uiSettings = new CharacterUISettings(); }
protected void AddPlanStrips(Chart chart, MOE.Common.Business.CustomReport.Phase phase, DateTime startDate, DateTime endDate, List <DateTime> splitFails) { PlanCollection planCollection = new PlanCollection(startDate, endDate, phase.SignalID); int backGroundColor = 1; //Parallel.ForEach(planCollection.PlanList, plan => foreach (MOE.Common.Business.Plan plan in planCollection.PlanList) { StripLine stripline = new StripLine(); //Creates alternating backcolor to distinguish the plans if (backGroundColor % 2 == 0) { stripline.BackColor = Color.FromArgb(120, Color.LightGray); } else { stripline.BackColor = Color.FromArgb(120, Color.LightBlue); } //Set the stripline properties stripline.IntervalOffsetType = DateTimeIntervalType.Hours; stripline.Interval = 1; stripline.IntervalOffset = (plan.StartTime - startDate).TotalHours; stripline.StripWidth = (plan.EndTime - plan.StartTime).TotalHours; stripline.StripWidthType = DateTimeIntervalType.Hours; chart.ChartAreas["ChartArea1"].AxisX.StripLines.Add(stripline); //Add a corrisponding custom label for each strip CustomLabel Plannumberlabel = new CustomLabel(); Plannumberlabel.FromPosition = plan.StartTime.ToOADate(); Plannumberlabel.ToPosition = plan.EndTime.ToOADate(); switch (plan.PlanNumber) { case 254: Plannumberlabel.Text = "Free"; break; case 255: Plannumberlabel.Text = "Flash"; break; case 0: Plannumberlabel.Text = "Unknown"; break; default: Plannumberlabel.Text = "Plan " + plan.PlanNumber.ToString(); break; } Plannumberlabel.ForeColor = Color.Black; Plannumberlabel.RowIndex = 4; Plannumberlabel.LabelMark = LabelMarkStyle.LineSideMark; chart.ChartAreas[0].AxisX2.CustomLabels.Add(Plannumberlabel); CustomLabel PlanMetrics = new CustomLabel(); PlanMetrics.FromPosition = plan.StartTime.ToOADate(); PlanMetrics.ToPosition = plan.EndTime.ToOADate(); var cycleInPlan = from c in phase.Cycles where c.CycleStart > plan.StartTime && c.CycleEnd < plan.EndTime select c; var failsInPlan = from s in splitFails where s > plan.StartTime && s < plan.EndTime select s; PlanMetrics.Text += failsInPlan.Count().ToString() + " SF"; if (cycleInPlan.Count() > 0) { double p = Convert.ToDouble(failsInPlan.Count()) / Convert.ToDouble(cycleInPlan.Count()); PlanMetrics.Text += "\n" + Convert.ToInt32(p * 100).ToString() + "% SF"; } PlanMetrics.ForeColor = Color.Black; PlanMetrics.RowIndex = 3; chart.ChartAreas[0].AxisX2.CustomLabels.Add(PlanMetrics); //Change the background color counter for alternating color backGroundColor++; } //); }
protected void AddSpeedDataToChart(Chart chart, Models.Detector detector, DateTime startDate, DateTime endDate, int binSize) { decimal totalDetectorHits = 0; decimal totalOnGreenArrivals = 0; decimal percentArrivalOnGreen = 0; Models.SPM db = new SPM(); List <Models.Speed_Events> SpeedHitsForChart = (from r in db.Speed_Events where r.timestamp > startDate && r.timestamp < endDate && r.DetectorID == detector.DetectorID select r).ToList(); MOE.Common.Models.Repositories.IControllerEventLogRepository CLR = Models.Repositories.ControllerEventLogRepositoryFactory.Create(); List <Models.Controller_Event_Log> phaseevents = CLR.GetEventsByEventCodesParam(detector.Approach.SignalID, StartDate, EndDate, new List <int>() { 0, 1, 7, 8, 9, 10, 11 }, detector.Approach.ProtectedPhaseNumber); List <Models.Controller_Event_Log> detEvents = new List <Controller_Event_Log>(); List <Models.Controller_Event_Log> preemptEvents = new List <Controller_Event_Log>(); PlanCollection Plans = new PlanCollection(phaseevents, detEvents, StartDate, EndDate, detector.Approach, preemptEvents); foreach (MOE.Common.Business.Plan plan in Plans.PlanList) { foreach (Cycle c in plan.CycleCollection) { c.FindSpeedEventsForCycle(SpeedHitsForChart); } plan.AvgSpeedBucketCollection = new AvgSpeedBucketCollection(plan.StartTime, plan.EndTime, plan.CycleCollection, binSize, detector.MinSpeedFilter ?? 5, detector.MovementDelay ?? 0); if (plan.AvgSpeedBucketCollection.Items.Count > 0) { foreach (MOE.Common.Business.AvgSpeedBucket bucket in plan.AvgSpeedBucketCollection.Items) { chart.Series["Average MPH"].Points.AddXY(bucket.StartTime, bucket.AvgSpeed); chart.Series["85th Percentile Speed"].Points.AddXY(bucket.StartTime, bucket.EightyFifth); if (ShowPlanStatistics && ShowPostedSpeed) { chart.Series["Posted Speed"].Points.AddXY(bucket.StartTime, detector.Approach.MPH); } } } } //if arrivals on green is selected add the data to the chart if (ShowPlanStatistics) { if (totalDetectorHits > 0) { percentArrivalOnGreen = (totalOnGreenArrivals / totalDetectorHits) * 100; } else { percentArrivalOnGreen = 0; } SetSpeedPlanStrips(Plans, chart, startDate, detector.MinSpeedFilter ?? 0); } }
public PreemptRequestChart(WCFServiceLibrary.PreemptServiceRequestOptions options, MOE.Common.Business.ControllerEventLogs DTTB) { this.Options = options; //Set the chart properties chart.ImageStorageMode = ImageStorageMode.UseImageLocation; chart.ImageType = ChartImageType.Jpeg; chart.Height = 200; chart.Width = 1100; chart.BorderSkin.SkinStyle = BorderSkinStyle.None; chart.BorderSkin.BorderColor = Color.Black; chart.BorderSkin.BorderWidth = 1; TimeSpan reportTimespan = Options.EndDate - Options.StartDate; SetChartTitle(); //Create the chart legend Legend chartLegend = new Legend(); chartLegend.Name = "MainLegend"; chartLegend.Docking = Docking.Left; chart.Legends.Add(chartLegend); //Create the chart area ChartArea chartArea = new ChartArea(); chartArea.Name = "ChartArea1"; //if (double.TryParse(yAxisMax, out y)) //{ // chartArea.AxisY.Maximum = y; //} //else //{ chartArea.AxisY.Maximum = 10; //} chartArea.AxisY.Minimum = 0; chartArea.AxisY.Title = "Preempt Number"; chartArea.AxisY.Interval = 1; chartArea.AxisX.Title = "Time (Hour of Day)"; chartArea.AxisX.IntervalType = DateTimeIntervalType.Hours; chartArea.AxisX.LabelStyle.Format = "HH"; if (reportTimespan.Days < 1) { if (reportTimespan.Hours > 1) { chartArea.AxisX.Interval = 1; } else { chartArea.AxisX.LabelStyle.Format = "HH:mm"; } } chart.ChartAreas.Add(chartArea); //Add the point series Series PreemptSeries = new Series(); PreemptSeries.ChartType = SeriesChartType.Point; PreemptSeries.BorderDashStyle = ChartDashStyle.Dash; PreemptSeries.MarkerStyle = MarkerStyle.Diamond; PreemptSeries.Color = Color.Black; PreemptSeries.Name = "Preempt Request"; PreemptSeries.XValueType = ChartValueType.DateTime; //Add the Posts series to ensure the chart is the size of the selected timespan Series posts = new Series(); posts.IsVisibleInLegend = false; posts.ChartType = SeriesChartType.Point; posts.Color = Color.White; posts.Name = "Posts"; posts.XValueType = ChartValueType.DateTime; chart.Series.Add(posts); chart.Series.Add(PreemptSeries); //Add points at the start and and of the x axis to ensure //the graph covers the entire period selected by the user //whether there is data or not chart.Series["Posts"].Points.AddXY(Options.StartDate, 0); chart.Series["Posts"].Points.AddXY(Options.EndDate, 0); AddDataToChart(chart, Options.StartDate, Options.EndDate, DTTB, Options.SignalID); PlanCollection plans = new PlanCollection(Options.StartDate, Options.EndDate, Options.SignalID); SetSimplePlanStrips(plans, chart, Options.StartDate, DTTB); }
//初始化对象 private void LoadCreateObj() { planCollection = new PlanCollection(); serviceInfo = new ServiceInfo(); }
private void SetSimplePlanStrips(MOE.Common.Business.PlanCollection plans, Chart chart, DateTime StartDate) { PlanCollection.SetSimplePlanStrips(plans, chart, StartDate); }