public Line(Models.Line line) { Date = (line.Date ?? line.OriginalDate).ToShortDateString(); Text = (line.Text ?? line.OriginalText) ?? ""; Amount = (line.Amount ?? line.OriginalAmount).ToString("N2"); Category = line.Category ?? ""; }
public static Line Format(Models.Line line) { return(new Line() { Name = line.Name, ShortName = line.ShortName, VehicleType = line.VehicleType }); }
public void Insert(Models.Line line) { try { _context.Lines.Add(line); _context.SaveChanges(); } catch (Exception ex) { throw; } }
public static double GetCycleTime(Models.Line line) { double result = 0.0; foreach (Models.WorkStation workStation in line.WorkStations) { if (result < GetCycleTime(workStation)) { result = GetCycleTime(workStation); } } return(result); }
// // GET: /Home/ public ActionResult Index() { // Create an instance of the cafeteria class Models.Cafeteria Cafe = new Models.Cafeteria(); Models.Line line = new Models.Line(); List<Models.Line> lines = new List<Models.Line>(); /* Now populate the Cafeteria object with required info ie Menu for the OC Cafeteria, Breakfast, Lunch, Dinner */ // testing with the breakfast menu first line.Line_List = Cafe.Breakfast(); Cafe.Line_List = line.Line_List; return View(Cafe); }
public void OnGet(string input) { LineList = new List<Models.Line>(); // make input available to web page: Input = input; // clear exception: EX = null; try { // // Do we have an input argument? If not, there's nothing to do: // if (input == null) { // // there's no page argument, perhaps user surfed to the page directly? // In this case, nothing to do. // } else { // // Lookup CTA(s) based on input, which could be id or a partial name: // string sql; // lookup station(s) by partial name match: input = input.Replace("'", "''"); sql = string.Format(@" SELECT Stations.StationID, Stations.Name, (SELECT COUNT(StopID) FROM Stops WHERE Stations.StationID = Stops.StationID) AS NumOfStops FROM Stations, Lines, StopDetails, StationOrder, Stops WHERE Lines.Color LIKE '%{0}%' AND Lines.LineID = StopDetails.LineID AND StopDetails.StopID = Stops.StopID AND Stops.StationID = Stations.StationID AND StationOrder.StationID = Stations.StationID AND StationORder.LineID = Lines.LineID GROUP BY Stations.StationID, Stations.Name, StationOrder.Position ORDER BY StationOrder.Position ", input); DataSet ds = DataAccessTier.DB.ExecuteNonScalarQuery(sql); foreach (DataRow row in ds.Tables[0].Rows) { Models.Line l = new Models.Line(); l.StationID = Convert.ToInt32(row["StationID"]); l.StationName = Convert.ToString(row["Name"]); l.NumOfStops = Convert.ToInt32(row["NumOfStops"]); LineList.Add(l); } }//else } catch(Exception ex) { EX = ex; } finally { // nothing at the moment } }
public void OnGet(string input) { StationList = new List <Models.Line>(); // make input available to web page: Input = input; // clear exception: EX = null; try { // // Do we have an input argument? If not, there's nothing to do: // if (input == null) { // // there's no page argument, perhaps user surfed to the page directly? // In this case, nothing to do. // } else { // // Lookup movie(s) based on input, which could be id or a partial name: // string sql; // lookup station(s) by partial name match: input = input.Replace("'", "''"); sql = string.Format(@" SELECT Position, Stations.StationID, Stations.Name, COUNT(DISTINCT StopID) AS numStops, Color FROM Stations LEFT JOIN Riderships ON Stations.StationID = Riderships.StationID LEFT JOIN Stops ON Stations.StationID = Stops.StationID LEFT JOIN StationOrder ON Stations.StationID = StationOrder.StationID LEFT JOIN Lines ON Lines.LineID = StationOrder.LineID WHERE Color LIKE '%{0}%' GROUP BY Stations.StationID, Stations.Name, [Position], Color ORDER BY [Position] ", input); DataSet ds = DataAccessTier.DB.ExecuteNonScalarQuery(sql); foreach (DataRow row in ds.Tables[0].Rows) { Models.Line s = new Models.Line(); s.StationID = Convert.ToInt32(row["StationID"]); s.StationName = Convert.ToString(row["Name"]); s.NumStops = Convert.ToInt32(row["numStops"]); StationList.Add(s); } } //else } catch (Exception ex) { EX = ex; } finally { // nothing at the moment } }
public void OnGet(string input) { LineList = new List<Models.Line>(); // make input available to web page: Input = input; // clear exception: EX = null; try { // // Do we have an input argument? If not, there's nothing to do: // if (input == null) { // // there's no page argument, perhaps user surfed to the page directly? // In this case, nothing to do. // } else { // // Lookup movie(s) based on input, which could be id or a partial name: // string sql; // lookup station(s) by partial name match: input = input.Replace("'", "''"); sql = string.Format(@" SELECT tableA.StationID, tableB.Name, tableB.TotalStops FROM (SELECT StationOrder.LineID, StationOrder.StationID, StationOrder.Position FROM StationOrder LEFT JOIN lines on lines.LineID = StationOrder.LineID WHERE lines.Color LIKE '%{0}%') as tableA, (SELECT Stations.StationID, Stations.Name, count(Stops.StationID) as TotalStops FROM Stations LEFT JOIN Stops ON Stations.StationID = Stops.StationID GROUP BY Stations.StationID, Stations.Name) as tableB WHERE tableA.StationID = tableB.StationID ORDER BY tableA.Position ASC ", input); DataSet ds = DataAccessTier.DB.ExecuteNonScalarQuery(sql); foreach (DataRow row in ds.Tables[0].Rows) { Models.Line s = new Models.Line(); s.StationID = Convert.ToInt32(row["StationID"]); s.StationName = Convert.ToString(row["Name"]); s.TotalStops = Convert.ToInt32(row["TotalStops"]); LineList.Add(s); } }//else } catch(Exception ex) { EX = ex; } finally { // nothing at the moment } }
public void Remove(Models.Line line) { _context.Lines.Remove(line); _context.SaveChanges(); }