public ActionResult DefaultIssueWithFilterIndex( string defaultIssueTypeRcd, string defaultIssueStatusRcd ) { if (defaultIssueStatusRcd == null) { defaultIssueStatusRcd = DefaultIssueStatusRef.ToBeResolved; } ViewBag.DefaultIssueStatusRcd = new SelectList( new CrudeDefaultIssueStatusRefServiceClient().FetchAll(), "DefaultIssueStatusRcd", "DefaultIssueStatusName", defaultIssueStatusRcd ); Logging.ActionLog( Request, "Default DefaultIssueWithFilter DefaultIssueWithFilterIndex ( ASP MVC WCF )" ); return(View( "~/Views/Default/DefaultIssueWithFilter/DefaultIssueWithFilterIndex.cshtml", new DefaultSearchService().DefaultIssueWithFilter(defaultIssueTypeRcd, defaultIssueStatusRcd) )); }
public ActionResult SystemInformation() { Logging.ActionLog(Request, "System Information", ViewBag); Process myProcess = Process.GetCurrentProcess(); long workingSet = myProcess.WorkingSet64 / 1024 / 1024; ViewBag.SoapWorkingSet = new DiagnosticsServiceClient().WorkingSet(); ViewBag.WorkingSet = workingSet; var measurement = new CrudeDefaultResourceMeasurementContract(); measurement.BusinessWorkingsetBytes = ((int)ViewBag.SoapWorkingSet) * 1024 * 1024; measurement.ClientWorkingsetBytes = (int)myProcess.WorkingSet64; measurement.DatabaseSizeBytes = new DefaultSearchService().DefaultResourceDatabaseStatistics()[0].ReservedPageCount * 1024; measurement.DefaultUserId = Logging.UserId(User.Identity, ViewBag); measurement.DateTime = DateTime.UtcNow; ViewBag.DatabaseSizeBytes = measurement.DatabaseSizeBytes; ViewBag.DatabaseSizeMBytes = measurement.DatabaseSizeBytes / 1024 / 1024; new CrudeDefaultResourceMeasurementServiceClient().Insert(measurement); return(View()); }
public ActionResult CreateIssue( string from ) { Logging.ActionLog(Request, "Create Issue"); //// save result of call new DefaultTestServiceClient(). AddTestRun( "SolutionNorPort", "MVC", from, Request.UrlReferrer.AbsoluteUri, DateTime.UtcNow, DateTime.UtcNow, 1, DefaultTestRunResultRef.OK, string.Empty, Logging.UserId(User.Identity, ViewBag) ); return(RedirectToAction( "DefaultIssueCreateWithUrl", "DefaultIssue", new { fromUrl = Request.UrlReferrer.AbsoluteUri, defaultUserId = Logging.UserId(User.Identity, ViewBag) } )); }
/// <summary>Create schedule record including identifiers</summary> /// <summary>Action log event inserted, exceptions logged</summary> public void CreateSchedule( ScheduleContract scheduleContract, Guid userId ) { Logging.ActionLog("SolutionNorSolutionPort.BusinessLogicLayer.ScheduleService.CreateSchedule", userId ); // start transaction using (var connection = new SqlConnection(Conn.ConnectionString)) { connection.Open(); SqlTransaction transaction = connection.BeginTransaction(); try { // insert flight schedule var crudeFlightScheduleData = new CrudeFlightScheduleData(); CrudeFlightScheduleService.ContractToData( scheduleContract.FlightSchedule, crudeFlightScheduleData ); crudeFlightScheduleData.FlightScheduleId = Guid.NewGuid(); // first flight schedule id has equal flight schedule id crudeFlightScheduleData.BindingFlightScheduleId = crudeFlightScheduleData.FlightScheduleId; crudeFlightScheduleData.UserId = userId; crudeFlightScheduleData.DateTime = DateTime.UtcNow; crudeFlightScheduleData.Insert(connection, transaction); // insert flight identifier, if existing // todo, there can be more than one identifier if (!String.IsNullOrEmpty(scheduleContract.FlightScheduleIdentifier.FlightIdentifierCode)) { var crudeFlightScheduleIdentifierData = new CrudeFlightScheduleIdentifierData(); crudeFlightScheduleIdentifierData.FlightScheduleId = crudeFlightScheduleData.FlightScheduleId; crudeFlightScheduleIdentifierData.FlightIdentifierCode = scheduleContract.FlightScheduleIdentifier.FlightIdentifierCode; crudeFlightScheduleIdentifierData.FlightIdentifierTypeRcd = FlightIdentifierTypeRef.FlightNumberThree; crudeFlightScheduleIdentifierData.DateTime = DateTime.UtcNow; crudeFlightScheduleIdentifierData.UserId = userId; crudeFlightScheduleIdentifierData.Insert(connection, transaction); } // commit transaction transaction.Commit(); } catch (Exception ex) { transaction.Rollback(); Logging.ErrorLog("Schedule", "ScheduleService", "CreateSchedule", ex.Message, ex.StackTrace, userId ); throw ex; } } }
/// <summary>Get schedule record including identifiers and segments in displayable and updatable arrays</summary> /// <summary>Action log event inserted, exceptions logged</summary> /// <cardinality>One</cardinality> public FlightContract GetFlight( Guid flightId, Guid userId ) { Logging.ActionLog("SolutionNorSolutionPort.BusinessLogicLayer.FlightService.GetFlight", userId ); var flight = new FlightContract(); try { // flight flight.Flight = new CrudeFlightService().FetchByFlightId(flightId); // segments /* * flight.FlightSegments = * new ScheduleSearchService().FlightSegments(flight).ToArray(); */ flight.CrudeFlightSegments = new CrudeFlightSegmentService().FetchByFlightId(flightId).ToArray(); // flight identifier CrudeFlightIdentifierContract[] flightIdentifiers = new CrudeFlightIdentifierService().FetchByFlightId(flightId).ToArray(); // todo, can be more than one, use the one if existing, or make an empty one, should have room for more than one if (flightIdentifiers.Length > 0) { flight.FlightIdentifier = flightIdentifiers[0]; } else { flight.FlightIdentifier = new CrudeFlightIdentifierContract(); } } catch (Exception ex) { Logging.ErrorLog("Flight", "FlightService", "GetFlight", ex.Message, ex.StackTrace, userId ); throw ex; } return(flight); }
public ActionResult CreateIssue() { Logging.ActionLog(Request, "Create Issue"); return(RedirectToAction( "DefaultIssueCreateWithUrl", "DefaultIssue", new { fromUrl = Request.UrlReferrer.AbsoluteUri, defaultUserId = Logging.UserId(User.Identity, ViewBag) } )); }
public void CheckFlightStatuses( DateTime dateFrom, DateTime dateUntil, Guid userId ) { Logging.ActionLog("SolutionNorSolutionPort.BusinessLogicLayer.FlightService.CheckFlightStatuses", userId ); // get all flights in a date time range List <FlightsForPeriodSimpleData> flights = FlightSearch.FlightsForPeriodSimple( dateFrom, dateUntil ); // get all flight segments in a date time range // start transaction using (var connection = new SqlConnection(Conn.ConnectionString)) { connection.Open(); SqlTransaction transaction = connection.BeginTransaction(); try { foreach (FlightsForPeriodSimpleData flight in flights) { // todo, rules for cutoff times CheckFlightEventFrom(connection, transaction, flight, DateTimeTypeRef.BookingClosed, TimeSpan.FromMinutes(30), userId); CheckFlightEventFrom(connection, transaction, flight, DateTimeTypeRef.BoardingOpen, TimeSpan.FromMinutes(30), userId); CheckFlightEventFrom(connection, transaction, flight, DateTimeTypeRef.LoadingInn, TimeSpan.FromMinutes(30), userId); CheckFlightEventFrom(connection, transaction, flight, DateTimeTypeRef.CheckInOpen, TimeSpan.FromMinutes(60 * 4), userId); CheckFlightEventFrom(connection, transaction, flight, DateTimeTypeRef.CheckInClosed, TimeSpan.FromMinutes(30), userId); CheckFlightEventFrom(connection, transaction, flight, DateTimeTypeRef.Takeoff, TimeSpan.FromMinutes(0), userId); CheckFlightEventFrom(connection, transaction, flight, DateTimeTypeRef.FlightFlown, TimeSpan.FromMinutes(-5), userId); CheckFlightEventUntil(connection, transaction, flight, DateTimeTypeRef.Touchdown, TimeSpan.FromMinutes(0), userId); CheckFlightEventUntil(connection, transaction, flight, DateTimeTypeRef.ActualArrival, TimeSpan.FromMinutes(-5), userId); CheckFlightEventFrom(connection, transaction, flight, DateTimeTypeRef.LoadingOff, TimeSpan.FromMinutes(-5), userId); } // commit transaction transaction.Commit(); } catch (Exception ex) { transaction.Rollback(); Logging.ErrorLog("Flight", "FlightService", "CheckFlightStatuses", ex.Message, ex.StackTrace, userId ); throw ex; } } }
/// <summary>Create all flights based on schedule record</summary> /// <summary>Schedule main dates will be used if segments does not exist</summary> /// <summary>Identifiers are taken from schedule</summary> /// <summary>Segments are taken from schedule if existing, default segment created if not</summary> /// <summary>Flight and segment 'created' events inserted</summary> /// <summary>Action log event inserted, exceptions logged</summary> public void MakeFlightsFromSchedule( Guid flightScheduleId, Guid userId ) { Logging.ActionLog("SolutionNorSolutionPort.BusinessLogicLayer.ScheduleService.MakeFlightsFromSchedule", userId ); // get schedule ScheduleContract scheduleContract = GetSchedule(flightScheduleId, userId); // make sure there are segments if (scheduleContract.CrudeFlightScheduleSegments.Length == 0) { Logging.ErrorLog("Schedule", "ScheduleService", "MakeFlightsFromSchedule", "Schedule.MakeFlightsFromSchedule: There are no segments on schedule", string.Empty, userId ); throw new Exception("Schedule.MakeFlightsFromSchedule: There are no segments on schedule"); } // make sure there is at least one identifier if (scheduleContract.FlightScheduleIdentifier == null || scheduleContract.FlightScheduleIdentifier.FlightScheduleIdentifierId == Guid.Empty) { Logging.ErrorLog("Schedule", "ScheduleService", "MakeFlightsFromSchedule", "Schedule.MakeFlightsFromSchedule: There are no flight identifiers", string.Empty, userId ); throw new Exception("Schedule.MakeFlightsFromSchedule: There are no flight identifiers"); } // get first aircraft available, TODO List <CrudeAircraftContract> aircrafts = new CrudeAircraftService().FetchAll(); if (aircrafts.Count == 0) { Logging.ErrorLog("Schedule", "ScheduleService", "MakeFlightsFromSchedule", "Schedule.MakeFlightsFromSchedule: There are no aircrafts available", string.Empty, userId ); throw new Exception("Schedule.MakeFlightsFromSchedule: There are no aircrafts available"); } // start transaction using (var connection = new SqlConnection(Conn.ConnectionString)) { connection.Open(); SqlTransaction transaction = connection.BeginTransaction(); try { // iterate all dates between from / until DateTime currentDate = scheduleContract.FlightSchedule.FromDateTime.Date; while (currentDate >= scheduleContract.FlightSchedule.FromDateTime.Date && currentDate <= scheduleContract.FlightSchedule.UntilDateTime) { // make new flight var flight = new CrudeFlightData(); flight.FlightId = Guid.NewGuid(); flight.BindingFlightId = flight.FlightId; flight.AirlineId = scheduleContract.FlightSchedule.AirlineId; flight.AircraftId = aircrafts[0].AircraftId; flight.AircraftTypeRcd = scheduleContract.FlightSchedule.AircraftTypeRcd; flight.DepartureAirportId = scheduleContract.FlightSchedule.DepartureAirportId; flight.ArrivalAirportId = scheduleContract.FlightSchedule.ArrivalAirportId; // compose flight date time departure / arrival time from first and last segment // todo, what about day shift +- flight.FromDateTime = currentDate.Add( scheduleContract.FlightScheduleSegments[0].DepartureTime ); flight.UntilDateTime = currentDate.Add( scheduleContract.FlightScheduleSegments[scheduleContract.FlightScheduleSegments.Length - 1].ArrivalTime ); flight.Comment = scheduleContract.FlightSchedule.Comment; flight.DateTime = DateTime.UtcNow; flight.UserId = userId; // make sure flight does not exist List <CrudeFlightData> flightDataList = CrudeFlightData.FetchWithFilter( flightId: Guid.Empty, becameFlightId: Guid.Empty, bindingFlightId: Guid.Empty, airlineId: flight.AirlineId, aircraftId: flight.AircraftId, aircraftTypeRcd: string.Empty, departureAirportId: flight.DepartureAirportId, arrivalAirportId: flight.ArrivalAirportId, fromDateTime: flight.FromDateTime, untilDateTime: flight.UntilDateTime, comment: string.Empty, userId: Guid.Empty, dateTime: DateTime.MinValue ); if (flightDataList.Count != 0) { continue; } flight.Insert(connection, transaction); // flight identifier // todo, can be more than one var identifier = new CrudeFlightIdentifierData(); identifier.FlightIdentifierTypeRcd = scheduleContract.FlightScheduleIdentifier.FlightIdentifierTypeRcd; identifier.FlightIdentifierCode = scheduleContract.FlightScheduleIdentifier.FlightIdentifierCode; identifier.FlightId = flight.FlightId; identifier.UserId = userId; identifier.DateTime = DateTime.UtcNow; identifier.Insert(connection, transaction); // events AddFlightEvent(connection, transaction, flight.FlightId, DateTimeTypeRef.Created, DateTime.UtcNow, userId); // planned / estimated times AddFlightEvent(connection, transaction, flight.FlightId, DateTimeTypeRef.PlannedDeparture, flight.FromDateTime, userId); AddFlightEvent(connection, transaction, flight.FlightId, DateTimeTypeRef.PlannedArrival, flight.UntilDateTime, userId); AddFlightEvent(connection, transaction, flight.FlightId, DateTimeTypeRef.EstimatedDeparture, flight.FromDateTime, userId); AddFlightEvent(connection, transaction, flight.FlightId, DateTimeTypeRef.EstimatedArrival, flight.UntilDateTime, userId); // open for booking AddFlightEvent(connection, transaction, flight.FlightId, DateTimeTypeRef.BookingOpen, DateTime.UtcNow, userId); // check rules // create flight segments for that day foreach (CrudeFlightScheduleSegmentContract scheduleSegment in scheduleContract.CrudeFlightScheduleSegments) { var flightSegment = new CrudeFlightSegmentData(); flightSegment.FlightSegmentId = Guid.NewGuid(); flightSegment.FlightId = flight.FlightId; flightSegment.DepartureAirportId = scheduleSegment.DepartureAirportId; flightSegment.ArrivalAirportId = scheduleSegment.ArrivalAirportId; flightSegment.LogicalSegmentNumber = scheduleSegment.LogicalSegmentNumber; flightSegment.PhysicalSegmentNumber = scheduleSegment.PhysicalSegmentNumber; flightSegment.FromDateTime = currentDate.Add(scheduleSegment.DepartureTime); flightSegment.UntilDateTime = currentDate.Add(scheduleSegment.ArrivalTime); flightSegment.DepartureGate = scheduleSegment.DepartureGate; flightSegment.ArrivalGate = scheduleSegment.ArrivalGate; flightSegment.UserId = userId; flightSegment.DateTime = DateTime.UtcNow; flightSegment.Insert(connection, transaction); // events AddFlightSegmentEvent(connection, transaction, flightSegment.FlightSegmentId, DateTimeTypeRef.Created, DateTime.UtcNow, userId); // planned / estimated times AddFlightSegmentEvent(connection, transaction, flightSegment.FlightSegmentId, DateTimeTypeRef.PlannedDeparture, flightSegment.FromDateTime, userId); AddFlightSegmentEvent(connection, transaction, flightSegment.FlightSegmentId, DateTimeTypeRef.PlannedArrival, flightSegment.UntilDateTime, userId); AddFlightSegmentEvent(connection, transaction, flightSegment.FlightSegmentId, DateTimeTypeRef.EstimatedDeparture, flightSegment.FromDateTime, userId); AddFlightSegmentEvent(connection, transaction, flightSegment.FlightSegmentId, DateTimeTypeRef.EstimatedArrival, flightSegment.UntilDateTime, userId); // open for booking AddFlightSegmentEvent(connection, transaction, flightSegment.FlightSegmentId, DateTimeTypeRef.BookingOpen, DateTime.UtcNow, userId); } currentDate = currentDate.AddDays(1); break; // break here since we are testing with a fresh database where from date is todays date } // commit transaction transaction.Commit(); } catch (Exception ex) { transaction.Rollback(); Logging.ErrorLog("Schedule", "ScheduleService", "MakeFlightsFromSchedule", ex.Message, ex.StackTrace, userId ); throw ex; } } }
/// <summary>Update schedule record including identifiers</summary> /// <summary>Identifier will be created if not existing</summary> /// <summary>Action log event inserted, exceptions logged</summary> public void UpdateSchedule( ScheduleContract scheduleContract, Guid userId ) { Logging.ActionLog("SolutionNorSolutionPort.BusinessLogicLayer.ScheduleService.UpdateSchedule", userId ); // make sure this is not an historical record if (scheduleContract.FlightSchedule.BecameFlightScheduleId != Guid.Empty) { Logging.ErrorLog("Schedule", "ScheduleService", "UpdateSchedule", "Schedule.UpdateSchedule: Can not update a history schedule flight record", string.Empty, userId ); throw new Exception("Schedule.UpdateSchedule: Can not update a history schedule flight record"); } // start transaction using (var connection = new SqlConnection(Conn.ConnectionString)) { connection.Open(); SqlTransaction transaction = connection.BeginTransaction(); try { // insert new flight schedule var crudeNewFlightScheduleData = new CrudeFlightScheduleData(); CrudeFlightScheduleService.ContractToData( scheduleContract.FlightSchedule, crudeNewFlightScheduleData ); crudeNewFlightScheduleData.FlightScheduleId = Guid.NewGuid(); // binding flight schedule id carries on forward crudeNewFlightScheduleData.BindingFlightScheduleId = scheduleContract.FlightSchedule.BindingFlightScheduleId; crudeNewFlightScheduleData.UserId = userId; crudeNewFlightScheduleData.DateTime = DateTime.UtcNow; crudeNewFlightScheduleData.Insert(connection, transaction); // insert new identifier // todo, can be more than one if (scheduleContract.FlightScheduleIdentifier.FlightIdentifierCode != string.Empty) { var crudeNewFlightScheduleIdentifierData = new CrudeFlightScheduleIdentifierData(); CrudeFlightScheduleIdentifierService.ContractToData( scheduleContract.FlightScheduleIdentifier, crudeNewFlightScheduleIdentifierData ); crudeNewFlightScheduleIdentifierData.FlightScheduleIdentifierId = Guid.NewGuid(); crudeNewFlightScheduleIdentifierData.FlightScheduleId = crudeNewFlightScheduleData.FlightScheduleId; crudeNewFlightScheduleIdentifierData.FlightIdentifierTypeRcd = FlightIdentifierTypeRef.FlightNumberThree; crudeNewFlightScheduleIdentifierData.DateTime = DateTime.UtcNow; crudeNewFlightScheduleIdentifierData.UserId = userId; crudeNewFlightScheduleIdentifierData.Insert(connection, transaction); } // update old flight schedule 'became' identifier var crudeOldFlightScheduleData = new CrudeFlightScheduleData(); crudeOldFlightScheduleData.FetchByFlightScheduleId(scheduleContract.FlightSchedule.FlightScheduleId); crudeOldFlightScheduleData.BecameFlightScheduleId = crudeNewFlightScheduleData.FlightScheduleId; crudeOldFlightScheduleData.Update(connection, transaction); // copy schedule segments List <CrudeFlightScheduleSegmentData> crudeFlightScheduleSegmentsData = CrudeFlightScheduleSegmentData.FetchByFlightScheduleId( scheduleContract.FlightSchedule.FlightScheduleId ); foreach (CrudeFlightScheduleSegmentData crudeFlightScheduleSegmentData in crudeFlightScheduleSegmentsData) { crudeFlightScheduleSegmentData.FlightScheduleSegmentId = Guid.NewGuid(); crudeFlightScheduleSegmentData.FlightScheduleId = crudeNewFlightScheduleData.FlightScheduleId; crudeFlightScheduleSegmentData.DateTime = DateTime.UtcNow; crudeFlightScheduleSegmentData.UserId = userId; crudeFlightScheduleSegmentData.Insert(connection, transaction); } // commit transaction transaction.Commit(); } catch (Exception ex) { transaction.Rollback(); Logging.ErrorLog("Schedule", "ScheduleService", "UpdateSchedule", ex.Message, ex.StackTrace, userId ); throw ex; } } }
public ActionResult WinForm() { Logging.ActionLog(Request, "About WinForm"); return(Redirect("~/install/publish.htm")); }
public ActionResult BookingStatisticsIndex() { Logging.ActionLog(Request, "BookingStatisticsIndex ( ASP MVC WCF )"); DateTime fromDateTime = DateTime.UtcNow.AddDays(-20); DateTime untilDateTime = DateTime.UtcNow.AddDays(+20); List <BookingStatisticsContract> statistics = new BookingSearchService().BookingStatistics( Guid.Empty, Guid.Empty, fromDateTime, untilDateTime ); // create a collection of data var statisticsCounts = new List <BookingStatistics>(); foreach (BookingStatisticsContract contract in statistics) { statisticsCounts.Add( new BookingStatistics() { Day = contract.Date.ToString("yyyyMMdd"), Passengers = contract.PassengersBookedCount, Adults = contract.AdultBookedCount, Childs = contract.ChildBookedCount, Infants = contract.InfantBookedCount } ); } // modify data type to make it of array type var xDataMonths = statisticsCounts.Select(i => i.Day).ToArray(); var yDataPassengers = statisticsCounts.Select(i => new object[] { i.Passengers }).ToArray(); var yDataAdults = statisticsCounts.Select(i => new object[] { i.Adults }).ToArray(); var yDataChildren = statisticsCounts.Select(i => new object[] { i.Childs }).ToArray(); var yDataInfants = statisticsCounts.Select(i => new object[] { i.Infants }).ToArray(); // instantiate an object of the High charts type var chart = new Highcharts("chart") // define the type of chart .InitChart(new Chart { DefaultSeriesType = ChartTypes.Line }) // overall Title of the chart .SetTitle(new Title { Text = "nor-port" }) // small label below the main Title .SetSubtitle(new Subtitle { Text = "Bookings from " + fromDateTime.ToShortDateString() + " until " + untilDateTime.ToShortDateString() }) // load the X values .SetXAxis(new XAxis { Categories = xDataMonths }) // set the Y title .SetYAxis(new YAxis { Title = new YAxisTitle { Text = "Bookings" } }) .SetYAxis(new YAxis { Title = new YAxisTitle { Text = "Adults" } }) .SetYAxis(new YAxis { Title = new YAxisTitle { Text = "Children" } }) .SetYAxis(new YAxis { Title = new YAxisTitle { Text = "Infants" } }) .SetTooltip( new Tooltip { Enabled = true, Formatter = @"function() { return '<b>'+ this.series.name +'</b><br/>'+ this.x +': '+ this.y; }" }) .SetPlotOptions(new PlotOptions { Line = new PlotOptionsLine { DataLabels = new PlotOptionsLineDataLabels { Enabled = true }, EnableMouseTracking = false } }) // load the Y values .SetSeries(new[] { new Series { Name = "Bookings", Data = new Data(yDataPassengers) }, new Series { Name = "Adults", Data = new Data(yDataAdults) }, new Series { Name = "Children", Data = new Data(yDataChildren) }, new Series { Name = "Infants", Data = new Data(yDataInfants) } }); return(View(chart)); }
public ActionResult Booking(Guid bookingId) { Logging.ActionLog(Request, "WinForm Booking"); return(Redirect("~/install/Booking/PrototypeDotNetFrameworkWinExeBooking.application?bookingId=" + bookingId.ToString())); }
public ActionResult Checkin() { Logging.ActionLog(Request, "WinForm Checkin"); return(Redirect("~/install/Checkin/PrototypeDotNetFrameworkWinExeCheckin.application")); }
public ActionResult UserActivityIndex() { Logging.ActionLog(Request, "UserActivityIndex ( ASP MVC WCF )"); List <DefaultStatisticsContract> statistics = new DefaultSearchService().DefaultStatistics(); //create a collection of data var transactionCounts = new List <UserActivities>(); foreach (DefaultStatisticsContract contract in statistics) { transactionCounts.Add( new UserActivities() { Day = contract.ActivityDate.Substring(3, 5), Activities = contract.DayCount } ); } // modify data type to make it of array type var xDataMonths = transactionCounts.Select(i => i.Day).ToArray(); var yDataCounts = transactionCounts.Select(i => new object[] { i.Activities }).ToArray(); // instantiate an object of the High charts type var chart = new Highcharts("chart") // define the type of chart .InitChart(new Chart { DefaultSeriesType = ChartTypes.Line }) // overall Title of the chart .SetTitle(new Title { Text = "History" }) // small label below the main Title .SetSubtitle(new Subtitle { Text = "User Activities" }) // load the X values .SetXAxis(new XAxis { Categories = xDataMonths }) // set the Y title .SetYAxis(new YAxis { Title = new YAxisTitle { Text = "Number of Transactions" } }) .SetTooltip(new Tooltip { Enabled = true, Formatter = @"function() { return '<b>'+ this.series.name +'</b><br/>'+ this.x +': '+ this.y; }" }) .SetPlotOptions(new PlotOptions { Line = new PlotOptionsLine { DataLabels = new PlotOptionsLineDataLabels { Enabled = true }, EnableMouseTracking = false } }) //load the Y values .SetSeries(new[] { new Series { Name = "Transactions", Data = new Data(yDataCounts) }, //you can add more y data to create a second line // new Series { Name = "Other Name", Data = new Data(OtherData) } }); return(View(chart)); }
public ActionResult PerformanceTimesAndCombo( string commandName ) { Logging.ActionLog(Request, "PerformanceTimesAndCombo: " + commandName + " ( ASP MVC WCF )"); DateTime fromDateTime = DateTime.UtcNow.AddMonths(-1); DateTime untilDateTime = DateTime.UtcNow.AddDays(+5); List <DefaultPerformanceTimeCommandsContract> commands = new DefaultSearchService().DefaultPerformanceTimeCommands(); ViewBag.CommandName = new SelectList( commands.Select(x => new { x.CommandName, x.CommandDisplayName }).Distinct(), "CommandName", "CommandDisplayName" ); List <DefaultPerformanceTimesContract> times = new DefaultSearchService().DefaultPerformanceTimes( commandName ); // create a collection of data var performanceTimes = new List <PerformanceTime>(); foreach (DefaultPerformanceTimesContract contract in times) { performanceTimes.Add( new PerformanceTime() { Date = contract.DateTime.ToString("ss"), Milliseconds = contract.Milliseconds } ); } // modify data type to make it of array type var xDataTimes = performanceTimes.Select(i => i.Date).ToArray(); var yDataMilliseconds = performanceTimes.Select(i => new object[] { i.Milliseconds.ToString() }).ToArray(); // instantiate an object of the High charts type var chart = new Highcharts("chart") // define the type of chart .InitChart(new Chart { DefaultSeriesType = ChartTypes.Line }) // overall Title of the chart .SetTitle(new Title { Text = "nor-port" }) // small label below the main Title .SetSubtitle(new Subtitle { Text = commandName + " from " + fromDateTime.ToShortDateString() + " until " + untilDateTime.ToShortDateString() }) // load the X values .SetXAxis(new XAxis { Categories = xDataTimes }) // set the Y title .SetYAxis(new YAxis { Title = new YAxisTitle { Text = "Milliseconds" } }) .SetTooltip( new Tooltip { Enabled = true, Formatter = @"function() { return '<b>'+ this.series.name +'</b><br/>'+ this.x +': '+ this.y; }" }) .SetPlotOptions(new PlotOptions { Line = new PlotOptionsLine { DataLabels = new PlotOptionsLineDataLabels { Enabled = true }, EnableMouseTracking = false } }) // load the Y values .SetSeries(new[] { new Series { Name = "Milliseconds", Data = new Data(yDataMilliseconds) } }); return(View(chart)); }
public ActionResult TransactionsBalance() { Logging.ActionLog(Request, "TransactionsBalance ( ASP MVC WCF )"); DateTime fromDateTime = DateTime.UtcNow.AddMonths(-1); DateTime untilDateTime = DateTime.UtcNow.AddDays(+5); List <TransactionsCreditDebitBalanceContract> statistics = new FinancialSearchService().TransactionsCreditDebitBalance( fromDateTime, untilDateTime ); // create a collection of data var transactionsBalance = new List <TransactionsBalance>(); foreach (TransactionsCreditDebitBalanceContract contract in statistics) { transactionsBalance.Add( new TransactionsBalance() { Day = contract.Date, Credit = contract.CreditAmount, Debit = contract.DebitAmount } ); } // modify data type to make it of array type var xDataMonths = transactionsBalance.Select(i => i.Day).ToArray(); var yDataCredit = transactionsBalance.Select(i => new object[] { i.Credit.ToString("f0") }).ToArray(); var yDataDebit = transactionsBalance.Select(i => new object[] { i.Debit.ToString("f0") }).ToArray(); // instantiate an object of the High charts type var chart = new Highcharts("chart") // define the type of chart .InitChart(new Chart { DefaultSeriesType = ChartTypes.Line }) // overall Title of the chart .SetTitle(new Title { Text = "nor-port" }) // small label below the main Title .SetSubtitle(new Subtitle { Text = "Days from " + fromDateTime.ToShortDateString() + " until " + untilDateTime.ToShortDateString() }) // load the X values .SetXAxis(new XAxis { Categories = xDataMonths }) // set the Y title .SetYAxis(new YAxis { Title = new YAxisTitle { Text = "Credit" } }) .SetYAxis(new YAxis { Title = new YAxisTitle { Text = "Debit" } }) .SetTooltip( new Tooltip { Enabled = true, Formatter = @"function() { return '<b>'+ this.series.name +'</b><br/>'+ this.x +': '+ this.y; }" }) .SetPlotOptions(new PlotOptions { Line = new PlotOptionsLine { DataLabels = new PlotOptionsLineDataLabels { Enabled = true }, EnableMouseTracking = false } }) // load the Y values .SetSeries(new[] { new Series { Name = "Credit", Data = new Data(yDataCredit) }, new Series { Name = "Debit", Data = new Data(yDataDebit) } }); return(View(chart)); }
public void UpdateFlight( FlightContract flightContract, Guid userId ) { Logging.ActionLog("SolutionNorSolutionPort.BusinessLogicLayer.FlightService.UpdateFlight", userId ); // start transaction using (var connection = new SqlConnection(Conn.ConnectionString)) { connection.Open(); SqlTransaction transaction = connection.BeginTransaction(); try { // insert new flight var crudeNewFlightData = new CrudeFlightData(); CrudeFlightService.ContractToData( flightContract.Flight, crudeNewFlightData ); crudeNewFlightData.FlightId = Guid.NewGuid(); // binding flight id carries on forward crudeNewFlightData.BindingFlightId = flightContract.Flight.BindingFlightId; crudeNewFlightData.UserId = userId; crudeNewFlightData.DateTime = DateTime.UtcNow; crudeNewFlightData.Insert(connection, transaction); // todo, can be more than one if (!String.IsNullOrEmpty(flightContract.FlightIdentifier.FlightIdentifierCode)) { var crudeNewFlightIdentifierData = new CrudeFlightIdentifierData(); CrudeFlightIdentifierService.ContractToData( flightContract.FlightIdentifier, crudeNewFlightIdentifierData ); crudeNewFlightIdentifierData.FlightIdentifierId = Guid.NewGuid(); crudeNewFlightIdentifierData.FlightId = crudeNewFlightData.FlightId; crudeNewFlightIdentifierData.FlightIdentifierTypeRcd = FlightIdentifierTypeRef.FlightNumberThree; crudeNewFlightIdentifierData.DateTime = DateTime.UtcNow; crudeNewFlightIdentifierData.UserId = userId; crudeNewFlightIdentifierData.Insert(connection, transaction); } // update old flight schedule 'became' identifier var crudeOldFlightData = new CrudeFlightData(); crudeOldFlightData.FetchByFlightId(flightContract.Flight.FlightId); crudeOldFlightData.BecameFlightId = crudeNewFlightData.FlightId; crudeOldFlightData.Update(connection, transaction); // copy segments List <CrudeFlightSegmentData> crudeFlightSegmentsData = CrudeFlightSegmentData.FetchByFlightId( flightContract.Flight.FlightId ); foreach (CrudeFlightSegmentData crudeFlightSegmentData in crudeFlightSegmentsData) { crudeFlightSegmentData.FlightSegmentId = Guid.NewGuid(); crudeFlightSegmentData.FlightId = crudeNewFlightData.FlightId; crudeFlightSegmentData.DateTime = DateTime.UtcNow; crudeFlightSegmentData.UserId = userId; crudeFlightSegmentData.Insert(connection, transaction); } // commit transaction transaction.Commit(); } catch (Exception ex) { transaction.Rollback(); Logging.ErrorLog("Flight", "FlightService", "UpdateFlight", ex.Message, ex.StackTrace, userId ); throw ex; } } }
public ActionResult Documentation() { Logging.ActionLog(Request, "Documentation"); return(Redirect("~/documentation/_Index.html")); }