public ActionResult BusInfo(PostcodeSelection selection) { // Add some properties to the BusInfo view model with the data you want to render on the page. // Write code here to populate the view model with info from the APIs. // Then modify the view (in Views/Home/BusInfo.cshtml) to render upcoming buses. var info = new BusInfo(selection.Postcode); if (info.PostCode != null) { apiManager.GetLonAndLatByPostCode(info.PostCode); info.orderedResult = apiManager.orderedResult; info.orderedResult2 = apiManager.orderedResult2; info.BusStopName1 = apiManager.busStopName + " " + apiManager.stopLetter1; info.BusStopName2 = apiManager.bustStopName2 + " " + apiManager.stopLetter2; info.isInLondon = apiManager.inLondon; } else { info.isInLondon = apiManager.inLondon; } return(View(info)); }
public ActionResult Create(BusInfo busInfo) { ViewBag.BusNames = businfoBll.GetBusName(); ViewBag.Message = businfoBll.Save(busInfo); ModelState.Clear(); return(View()); }
public ViewTicket(Login user) { this.user = user; try { var bookData = db.TicketDetails.Where(a => a.custId == user.custId).FirstOrDefault(); var busDate = db.BusInfoes.Where(c => c.id == bookData.BusId).FirstOrDefault(); var countSeat = db.SeatInfoes.Where(me => me.BusId == bookData.BusId && me.custId == user.custId).ToList(); this.ticket = bookData; this.bus = busDate; this.seats = countSeat; InitializeComponent(); routeLb.Text = busDate.Source + " - " + busDate.Destination; timeLb.Text = busDate.ArivalTime; seatLb.Text = bookData.seatNo; dateLb.Text = bookData.dateOfTicket.ToString(); bookNoLb.Text = bookData.Id.ToString(); unlbl.Text = user.username.ToUpper(); } catch (Exception) { this.Hide(); } }
public int Save(BusInfo businfo) { SqlConnection con = new SqlConnection(connectionString); con.Open(); string query = "insert into Businfo(BusNo, BusNameID, Source_Station, destination_Station, FDate, Todate,sTime, eTime, interStation, maxSeat, availSeat, Description, SetPrice) values(@BusNo, @BusNameid, @source_Station, @destination_Station, @FDate,@tdate, @sTime, @eTime, @interStation, @MaxSeat,@availSeat, @description , @seatPrice);"; SqlCommand cm = new SqlCommand(query, con); cm.Parameters.Clear(); cm.Parameters.AddWithValue("BusNo", businfo.busNo); cm.Parameters.AddWithValue("BusNameid", businfo.BusNameId); cm.Parameters.AddWithValue("source_Station", businfo.sourceStation); cm.Parameters.AddWithValue("destination_Station", businfo.desStation); cm.Parameters.AddWithValue("FDate", businfo.Fdate); cm.Parameters.AddWithValue("tdate", businfo.Tdate); cm.Parameters.AddWithValue("sTime", businfo.sTime); cm.Parameters.AddWithValue("eTime", businfo.ETime); cm.Parameters.AddWithValue("interStation", businfo.interStation); cm.Parameters.AddWithValue("MaxSeat", businfo.maxSeat); cm.Parameters.AddWithValue("availSeat", businfo.maxSeat); cm.Parameters.AddWithValue("description", businfo.description); cm.Parameters.AddWithValue("seatPrice", businfo.SetPrice); int rowcount = cm.ExecuteNonQuery(); con.Close(); return(rowcount); }
void OnBusCreated(object sender, BusInfo busInfo) { Activity.RunOnUiThread(async delegate { await OnRefreshViewAsync(); }); }
public ActionResult BusTimes(PostcodeSelection selection) { var apiOutput = ApiClass.MakeApiCalls(selection.Postcode); var info = new BusInfo(selection.Postcode, apiOutput); return(PartialView(info)); }
protected void DropDownList3_SelectedIndexChanged(object sender, EventArgs e) { string x = DropDownList3.SelectedValue.ToString(); BusInfo db = new BusInfo(); db.delete_schedule(x); Label3.Text = "Bus Schedule Deleted Successfully"; }
private static String MergeXml(params string[] xml) { string body_temp, numOfRows_str, pageNo_str , head = xml[0].Substring(0, xml[0].IndexOf("<msgBody>") + "<msgBody>".Length) , body = (body = xml[0].Substring(xml[0].IndexOf("<msgBody>") + "<msgBody>".Length)).Substring(0, body.IndexOf("</msgBody>")) , tail = xml[0].Substring(xml[0].IndexOf("</msgBody>")); int numOfRows, pageNo; numOfRows_str = (numOfRows_str = (head.Substring(head.IndexOf("<numOfRows>") + "<numOfRows>".Length))).Substring(0, numOfRows_str.IndexOf("</numOfRows>")); numOfRows = BusInfo.ConvertStrToNaturalNumber(numOfRows_str); pageNo_str = (pageNo_str = (head.Substring(head.IndexOf("<pageNo>") + "<pageNo>".Length))).Substring(0, pageNo_str.IndexOf("</pageNo>")); pageNo = BusInfo.ConvertStrToNaturalNumber(pageNo_str); for (int i = 1; i < xml.Length; i++) { numOfRows_str = (numOfRows_str = (xml[i].Substring(0, xml[i].IndexOf("<msgBody>") + "<msgBody>".Length).Substring(xml[i].Substring(0, xml[i].IndexOf("<msgBody>") + "<msgBody>".Length).IndexOf("<numOfRows>") + "<numOfRows>".Length))).Substring(0, numOfRows_str.IndexOf("</numOfRows>")); numOfRows += BusInfo.ConvertStrToNaturalNumber(numOfRows_str); pageNo_str = (pageNo_str = (xml[i].Substring(0, xml[i].IndexOf("<msgBody>") + "<msgBody>".Length).Substring(xml[i].Substring(0, xml[i].IndexOf("<msgBody>") + "<msgBody>".Length).IndexOf("<pageNo>") + "<pageNo>".Length))).Substring(0, pageNo_str.IndexOf("</pageNo>")); pageNo += BusInfo.ConvertStrToNaturalNumber(pageNo_str); body_temp = (body_temp = xml[i].Substring(xml[i].IndexOf("<msgBody>") + "<msgBody>".Length)).Substring(0, body_temp.IndexOf("</msgBody>")); body += body_temp; } head = head.Substring(0, head.IndexOf("<numOfRows>") + "<numOfRows>".Length) + numOfRows + head.Substring(head.IndexOf("</numOfRows>")); head = head.Substring(0, head.IndexOf("<pageNo>") + "<pageNo>".Length) + pageNo + head.Substring(head.IndexOf("</pageNo>")); return(head + body + tail); }
protected void Page_Load(object sender, EventArgs e) { BusInfo obj = new BusInfo(); string busid = (string)Session["busno"]; GridView1.DataSource = obj.viewdetails(busid); GridView1.DataBind(); }
private BusInfo[] EnumerateQribSub(BusInfo busInfo) { List <BusInfo> busInfos = new List <BusInfo>(); Type siliconUSBQribBusType = typeof(SiliconUSBQRIBBus); BusInfo usbIICBus = new BusInfo { AssemblyName = siliconUSBQribBusType.Assembly.GetName().Name, ClassFullName = siliconUSBQribBusType.FullName, DriverProvider = "NI", DriverDescription = "Silicon USB Qrib IIC", DriverValue = "IIC", UiqueValue = busInfo.UiqueValue + "IIC", ReadableValue = "Silicon USB::Qrib::IIC" + busInfo.DriverValue, Type = BusType.QRIB, CacheResource = true, EnableLog = false, Parent = busInfo, ReadTimeOut = 500, WriteTimeOut = 500, }; busInfos.Add(usbIICBus); //枚举qbert return(busInfos.ToArray()); }
private MAD.Device GetDevice(BusInfo bus) { return(_devices.GetOrAdd(bus.VehicleId.ToString(), id => { var registryMgr = MAD.RegistryManager.CreateFromConnectionString(_hubServiceConnectionString); try { return registryMgr.AddDeviceAsync(new MAD.Device(id)).Result; } catch (Microsoft.Azure.Devices.Common.Exceptions.DeviceAlreadyExistsException) { return registryMgr.GetDeviceAsync(id).Result; } catch (AggregateException ex) { if (ex.InnerException != null && ex.InnerException is Microsoft.Azure.Devices.Common.Exceptions.DeviceAlreadyExistsException) { return registryMgr.GetDeviceAsync(id).Result; } else { throw; } } })); }
protected void DropDownList2_SelectedIndexChanged(object sender, EventArgs e) { string x = DropDownList2.SelectedValue.ToString(); BusInfo dr = new BusInfo(); dr.route_delete(x); Label3.Text = "Route Deleted Successfully"; }
public async Task <IActionResult> PutBusInfo(string id, BusInfo busInfo) { if (id != busInfo.BusNo) { return(BadRequest()); } _context.Entry(busInfo).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!BusInfoExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }
public ActionResult BusInfo(PostcodeSelection selection) { // Add some properties to the BusInfo view model with the data you want to render on the page. // Write code here to populate the view model with info from the APIs. // Then modify the view (in Views/Home/BusInfo.cshtml) to render upcoming buses. var postcode = new BusInfo(selection.Postcode); try { var coordinates = ApiFetcher.GetCoordinates(postcode.PostCode); var stopPoints = ApiFetcher.GetStopPoints(coordinates.result); var busStops = new List <BusStop>(); foreach (var stopPoint in stopPoints) { var buses = ApiFetcher.GetBuses(stopPoint); foreach (var bus in buses) { bus.timeToStation = bus.timeToStation / 60; } var busStop = new BusStop(buses, stopPoint.commonName); busStops.Add(busStop); } return(View(busStops)); } catch { return(View()); } }
public override bool GetInfo(ref BusInfo info) { info.MediaType = MediaTypes.Audio; // current definition is within 32 bits info.ChannelCount = (int)VstExtensions.NumberOfSetBits((uint)SpeakerArrangement); return(base.GetInfo(ref info)); }
public virtual bool GetInfo(ref BusInfo info) { info.BusType = BusType; info.Flags = Flags; info.Name = Name; return(true); }
protected void Page_Load(object sender, EventArgs e) { BusInfo obj = new BusInfo(); string busid = (string)Session["busno"]; GridView1.DataSource = obj.viewdetails(busid); GridView1.DataBind(); }
protected void DropDownList3_SelectedIndexChanged(object sender, EventArgs e) { string x = DropDownList3.SelectedValue.ToString(); BusInfo db = new BusInfo(); db.delete_schedule(x); Label3.Text = "Bus Schedule Deleted Successfully"; }
protected void DropDownList2_SelectedIndexChanged(object sender, EventArgs e) { string x = DropDownList2.SelectedValue.ToString(); BusInfo dr = new BusInfo(); dr.route_delete(x); Label3.Text = "Route Deleted Successfully"; }
public static void Navigate(Context context, BusInfo busInfo, bool allowAdd) { Intent intent = new Intent(context, typeof(BusRoutesActivity)); intent.PutExtra("bus", JsonConvert.SerializeObject(busInfo)); intent.PutExtra("allow_add", allowAdd); context.StartActivity(intent); }
public ActionResult BusInfo(PostcodeSelection selection) { // Add some properties to the BusInfo view model with the data you want to render on the page. // Write code here to populate the view model with info from the APIs. // Then modify the view (in Views/Home/BusInfo.cshtml) to render upcoming buses. var info = new BusInfo(selection.Postcode); return(View(info)); }
protected void BtnProceed_Click(object sender, EventArgs e) { TransactionInfo tnew = new TransactionInfo(); BusInfo bus = new BusInfo(); Session["no_of_seats"] = Convert.ToString(ListSeats.Items.Count); Session["tid"] = Convert.ToString(tnew.GenerateTID()); Session["fare"] = Convert.ToInt32(bus.GetFare((string)Session["bid"], Convert.ToInt32(TxtNumber.Text))); for (int i = 0; i < ListSeats.Items.Count; i++) { BookSeat(Convert.ToInt32(ListSeats.Items[i].Text), (string)Session["bid"]); } switch (ListSeats.Items.Count) { case 1: Session["seat0"] = (ListSeats.Items[0].Text); Session["seat1"] = "NULL"; Session["seat2"] = "NULL"; Session["seat3"] = "NULL"; Session["seat4"] = "NULL"; break; case 2: Session["seat0"] = ListSeats.Items[0].Text; Session["seat1"] = ListSeats.Items[1].Text; Session["seat2"] = "NULL"; Session["seat3"] = "NULL"; Session["seat4"] = "NULL"; break; case 3: Session["seat0"] = ListSeats.Items[0].Text; Session["seat1"] = ListSeats.Items[1].Text; Session["seat2"] = ListSeats.Items[2].Text; Session["seat3"] = "NULL"; Session["seat4"] = "NULL"; break; case 4: Session["seat0"] = ListSeats.Items[0].Text; Session["seat1"] = ListSeats.Items[1].Text; Session["seat2"] = ListSeats.Items[2].Text; Session["seat3"] = ListSeats.Items[3].Text; Session["seat4"] = "NULL"; break; case 5: Session["seat0"] = ListSeats.Items[0].Text; Session["seat1"] = ListSeats.Items[1].Text; Session["seat2"] = ListSeats.Items[2].Text; Session["seat3"] = ListSeats.Items[3].Text; Session["seat4"] = ListSeats.Items[4].Text; break; } Response.Redirect("PaymentOptions.aspx"); }
private void BindControls() { BusController busController = new BusController(); BusInfo busInfo = busController.SelectByBusID(this.cboBusCode.SelectedValue.ToString()); this.cboBusCode.SelectedValue = busInfo.BusID; this.txtBusNumber.Text = busInfo.BusNo; this.cboBusType.SelectedValue = busInfo.BusTypeID; this.lblTotalSeat.Text = Convert.ToString(busInfo.TotalSeats); }
/// <summary> /// Defines actions to be performed when a button is pressed /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void information_Click(object sender, RoutedEventArgs e) { Button a = (Button)sender; tempBus = (BO.Bus)a.DataContext; var ab = new BusInfo(tempBus); ab.Height = 300; ab.Width = 600; ab.Show(); }
public ActionResult BusInfo(PostcodeSelection selection) { var coordinate = postcodeApiHelper.GetPostcodeCoordinates(selection.Postcode); var stopPoints = tflApiHelper.GetStopPoints(coordinate); var stops = stopPoints .Take(2) .Select(stop => tflApiHelper.GetTopFiveBuses(stop.naptanId)); var info = new BusInfo(stops); return(View(info)); }
public ActionResult BusInfo(PostcodeSelection selection) { // Add some properties to the BusInfo view model with the data you want to render on the page. // Write code here to populate the view model with info from the APIs. // Then modify the view (in Views/Home/BusInfo.cshtml) to render upcoming buses. var webpageTables = new List <WebpageTable>(); List <BusStationData> busStationData; try { busStationData = APIFun.GetBusStationDataFromPostcode(selection.Postcode, 2); } catch (BadPostcodeException except) { return(RedirectToAction("Index", new { errorMessage = $"That postcode ({selection.Postcode}) is not valid. Please enter another." })); } foreach (var busStation in busStationData) { var newWebpageTable = new WebpageTable(); newWebpageTable.data = new List <WebpageTableLine>(); newWebpageTable.title = busStation.commonName; var busData = APIFun.GetSoonestBusesForNaptanID(busStation.naptanId, 5); foreach (var bus in busData) { var newWebpageTableLine = new WebpageTableLine(); newWebpageTableLine.lineName = bus.lineName; newWebpageTableLine.destinationName = bus.destinationName; var time = bus.timeToStation / 60; if (time == 0) { newWebpageTableLine.arrivalMessage = "Due"; } else if (time == 1) { newWebpageTableLine.arrivalMessage = "1 min"; } else { newWebpageTableLine.arrivalMessage = $"{time} mins"; } newWebpageTable.data.Add(newWebpageTableLine); } webpageTables.Add(newWebpageTable); } var info = new BusInfo(selection.Postcode) { TableData = webpageTables }; return(View(info)); }
public ActionResult BusInfo(PostcodeSelection selection) { if (selection.Postcode == null) { selection.Postcode = ""; } var apiOutput = ApiClass.MakeApiCalls(selection.Postcode); var info = new BusInfo(selection.Postcode, apiOutput); return(View(info)); }
private void DataGridView1_CellClick_1(object sender, DataGridViewCellEventArgs e) { try { var busid = dataGridView1.SelectedRows[0].Cells[1].Value; busId.Text = busid.ToString(); var user = db.BusInfoes.Where(a => a.BusNo.Equals(busId.Text)).FirstOrDefault(); busUser = user; } catch (Exception) { } }
public ActionResult BusInfo(PostcodeSelection selection) { try { var info = new BusInfo(selection.Postcode); return(View(info)); } catch { return(View("Error")); } }
void OnBusRemoved(object sender, BusInfo e) { Activity.RunOnUiThread(delegate { var item = busAdapter.Items.FirstOrDefault(x => x.Id == e.Id); if (item != null) { busAdapter.Items.Remove(item); busAdapter.NotifyDataSetChanged(); } }); }
public BusInfo[] EnumerateBusInfos() { List <BusInfo> busInfos = new List <BusInfo>(); uint deviceNum = 0; int ret = SiliconUSBBusNative.SI_GetNumDevices(ref deviceNum); if (ret != SiliconUSBBusNative.SI_SUCCESS) { return(busInfos.ToArray()); } for (uint i = 0; i < deviceNum; i++) { StringBuilder sb = new StringBuilder(SiliconUSBBusNative.SI_MAX_DEVICE_STRLEN); ret = SiliconUSBBusNative.SI_GetProductString(i, sb, SiliconUSBBusNative.SI_RETURN_SERIAL_NUMBER); if (ret == SiliconUSBBusNative.SI_SUCCESS) { string strSerialNumber = sb.ToString(); BusInfo busInfo = new BusInfo { AssemblyName = typeof(SiliconUSBBus).Assembly.FullName, ClassFullName = typeof(SiliconUSBBus).FullName, DriverDescription = "Silicon USB Device", DriverValue = strSerialNumber, Parent = null, CacheResource = true, DriverProvider = "NI", EnableLog = false, ReadableValue = "NI USB " + strSerialNumber, ReadTimeOut = 500, WriteTimeOut = 500, Type = BusType.USB, UiqueValue = "USB" }; busInfos.Add(busInfo); //如果是qrib则枚举级联的设备 if (strSerialNumber.IndexOf("qrib", StringComparison.OrdinalIgnoreCase) >= 0) { try { busInfos.AddRange(EnumerateQribSub(busInfo)); } catch (Exception ex) { Debug.WriteLine("枚举QRIB(" + strSerialNumber + ")级联设备出错:" + ex.Message + "\n" + ex.StackTrace); } } } } return(busInfos.ToArray()); }
protected void Button1_Click(object sender, EventArgs e) { if (TextBox1.Text.Trim().Length > 0 && TextBox2.Text.Trim().Length > 0 && TextBox3.Text.Trim().Length > 0 && TextBox4.Text.Trim().Length > 0 && TextBox5.Text.Trim().Length>0) { BusInfo bi = new BusInfo(); bi.BusSchedule(DropDownList1.SelectedValue.ToString(), TextBox1.Text.ToString(), DropDownList2.SelectedValue.ToString(), TextBox2.Text.ToString(), TextBox3.Text.ToString(), TextBox5.Text.ToString(), TextBox4.Text.ToString()); Label2.Text = "Bus Scheduled Successfully"; } else { Label2.Text = "Enter all the feilds"; } }
/// <summary> /// Initializes a new instance of the <see cref="RouterProcessor" /> class. /// </summary> /// <param name="identification">The identification.</param> /// <param name="inputGateway">The message receiver.</param> /// <param name="routerOutputHelper">The bus sender helper.</param> internal RouterProcessor(Identification identification, IInputGateway <byte[], RouterHeader> inputGateway, IRouterOutputHelper routerOutputHelper) { JoinedBusInfo = BusInfo.Create(); ConfigureStateMachine(); _inputGateway = inputGateway; _identification = identification; _routerOutputHelper = routerOutputHelper; _inputGateway.OnMessage += MessageReceived; _stateMachine.ChangeState(ProcessorStatus.Configured); _serializer = new JsonDataContractSerializer(); }
protected void Button1_Click(object sender, EventArgs e) { if (TextBox1.Text.Trim().Length > 0 && TextBox2.Text.Trim().Length > 0 && TextBox3.Text.Trim().Length > 0 && TextBox4.Text.Trim().Length > 0 && TextBox5.Text.Trim().Length > 0) { BusInfo bi = new BusInfo(); bi.BusSchedule(DropDownList1.SelectedValue.ToString(), TextBox1.Text.ToString(), DropDownList2.SelectedValue.ToString(), TextBox2.Text.ToString(), TextBox3.Text.ToString(), TextBox5.Text.ToString(), TextBox4.Text.ToString()); Label2.Text = "Bus Scheduled Successfully"; } else { Label2.Text = "Enter all the feilds"; } }
protected void Button2_Click(object sender, EventArgs e) { if (TextBox6.Text.Trim().Length > 0 && TextBox6.Text.Trim().Length > 0 && TextBox6.Text.Trim().Length > 0) { BusInfo rt = new BusInfo(); rt.edit_routes(DropDownList1.SelectedValue.ToString(), TextBox5.Text.ToString(), TextBox6.Text.ToString(), TextBox7.Text.ToString()); Label1.Text = "Routes Edited Succesfully"; TextBox5.Text = ""; TextBox6.Text = ""; TextBox7.Text = ""; } else Label1.Text = "Enter all the details"; }
protected void Button1_Click(object sender, EventArgs e) { if (TextBox1.Text.Trim().Length > 0 && TextBox2.Text.Trim().Length > 0 && TextBox3.Text.Trim().Length > 0) { BusInfo rt = new BusInfo(); rt.add_routes(TextBox1.Text.ToString(), TextBox2.Text.ToString(), TextBox3.Text.ToString()); Label2.Text= "New Routes Added Succesfully"; TextBox1.Text = ""; TextBox2.Text = ""; TextBox3.Text = ""; } else Label2.Text= "Enter all the details"; }
protected void Button1_Click(object sender, EventArgs e) { if (TextBox1.Text.Trim().Length > 0 && TextBox2.Text.Trim().Length > 0 && TextBox3.Text.Trim().Length > 0 && TextBox4.Text.Trim().Length > 0) { BusInfo bn = new BusInfo(); bn.NewBus(TextBox2.Text.ToString(), TextBox3.Text.ToString(), TextBox4.Text.ToString(),TextBox1.Text.ToString()); Label2.Text = "New Bus added Successfully"; TextBox1.Text = ""; TextBox2.Text = ""; TextBox3.Text = ""; TextBox4.Text = ""; } else Label2.Text = "Enter all the values"; }
public BusInfo GetInfo(BUS bus) { BusInfo ret = new BusInfo(); ret.BusName = bus.busName; ret.BusNumber = bus.busNumber; ret.Price = bus.price; ret.CarType = bus.carType; ret.FORM = bus.form; ret.Distance = (bus.distance.HasValue)? (float)bus.distance.Value : 0; ret.Company = bus.company; ret.ForwardDirection = bus.forwardDirection; ret.BackwardDirection = bus.backwardDirection; ret.TimeBetweenBus = bus.timeBetweenBus; ret.RunTime = bus.runTime ; ret.Quantity = bus.quantity.HasValue ? bus.quantity.Value : 0; return ret; }