private async void SecurityCabOptions_Button_Clicked(object sender, EventArgs e) { //get cab and check against cab_status. Cab cab = CabController.GetCab(int.Parse(applicationid)); if (cab == null) { await Navigation.PushAsync(new NavigationPage(new FillCabDetailsPage(applicationid))); } else if (cab.cab_status == "ARRIVED") { await DisplayAlert("Error", "Ride is already in transit", "OK"); } else if (cab.cab_status == "CANCELLED") { await DisplayAlert("Error", "Cab has been Cancelled", "OK"); } else { cab.cab_status = "ARRIVED"; cab.arrival_time = DateTime.UtcNow.ToString(); CabController.UpdateCab(cab); await DisplayAlert("Cab has arrived.", "Employee has been notified.", "OK"); } }
private async void CabsListView_ItemClick(object sender, ItemClickEventArgs e) { Cab cabDetails = e.ClickedItem as Cab; if (_source == null || _source == "") { await new MessageDialog("Please Enter Source").ShowAsync(); return; } if (_destination == null || _destination == "") { await new MessageDialog("Please Enter Destination").ShowAsync(); return; } if (_destination != null && _source != null) { Dictionary <string, object> Parameters = new Dictionary <string, object>(); Parameters.Add("eta", cabDetails.Eta); Parameters.Add("price", cabDetails.FareData.Surge); Parameters.Add("distance", cabDetails.Distance); Parameters.Add("time", cabDetails.Time); Parameters.Add("source", _source); Parameters.Add("destination", _destination); Arguments data = new Arguments(null); data.AddType(VoiceCommandType.NO_VOICE, true); data.Values = Parameters; Frame.Navigate(typeof(BookingPage), data); } }
protected void dgvCab_RowCommand(object sender, GridViewCommandEventArgs e) { int rIndex = Convert.ToInt32(e.CommandArgument); GridViewRow rw = dgvCab.Rows[rIndex]; if (e.CommandName == "cmdEdit") { Cab c = new Cab(); Settings s = new Settings(); Branch b = new Branch(); txtID.Text = ((Label)rw.Cells[0].Controls[1]).Text; drop_down_list_type.ClearSelection(); string typeValue = s.GetTypeAccordingToTypeId(connString, Convert.ToInt32(((Label)rw.Cells[1].Controls[1]).Text)); drop_down_list_type.Items.FindByValue(typeValue).Selected = true; txtNo.Text = ((Label)rw.Cells[2].Controls[1]).Text; drop_down_list_branch.ClearSelection(); string loc = b.GetLocationAccordingToBranchId(connString, Convert.ToInt32(((Label)rw.Cells[3].Controls[1]).Text)); drop_down_list_branch.Items.FindByValue(loc).Selected = true; } else if (e.CommandName == "cmdDelete") { Cab CObj = new Cab(); CObj.cab_id = Convert.ToInt32(((Label)rw.Cells[0].Controls[1]).Text); if (CObj.RemoveCab(connString)) { lbl_error_message.Text = "Deleted Successfully"; LoadCab(); } else { lbl_error_message.Text = "Sorry,Error Occurred"; } } }
private static void WriteCabNode(XElement parent, Cab cab) { parent.Add(new XElement("Cab", new XElement("Position", $"{cab.PositionX}, {cab.PositionY}, {cab.PositionZ}"), new XElement("DriverCar", cab.DriverCar) )); }
public DevicePage(Frame fm, Cab c) { InitializeComponent(); this.systemFrame = fm; this.cab = c; init(); }
public ParametersSettingsWindow(Cab c) { InitializeComponent(); type = paraSettingsWindowType.onCab; this.cab = c; init(); }
public async Task <Cab> AddAsync(Cab cab) { _dbContext.Cabs.Add(cab); await _dbContext.SaveChangesAsync(); return(cab); }
public async Task <Cab> UpdateAsync(Cab cab) { _dbContext.Entry(cab).State = EntityState.Modified; await _dbContext.SaveChangesAsync(); return(cab); }
private void Cab_Combox_SelectionChanged(object sender, SelectionChangedEventArgs e) { // Cab_Combox.ItemsSource = null; Device_Combox.ItemsSource = null; ComboBox c = (ComboBox)sender; int select = c.SelectedIndex; if (select < 0) { return; } Cab cab = cabs[select]; List <string> devicename = new List <string>(); devices.Clear(); for (int i = 0; i < cab.Devices.Count; i++) { devicename.Add(cab.Devices[i].SubSystemName); devices.Add(cab.Devices[i]); } Device_Combox.ItemsSource = devicename; // Console.WriteLine("Cab_Combox_SelectionChanged"); }
void subSystemNode_MouseLeftButtonDown(object sender, MouseButtonEventArgs e) { if (e.Handled) { return; } MyTreeViewItem treeNode = (MyTreeViewItem)sender; MyTreeViewItem cabNode = (MyTreeViewItem)treeNode.Parent; if (cabNode.NodeObject is Building) { return; } Cab cab = (Cab)cabNode.NodeObject; List <Device> subsys = (List <Device>)treeNode.NodeObject; if (page.Content is CabsPage) //当前在cab页面 ,跳转到设备页面 { page.Content = new DevicePage(page, cab); } else if (page.Content is DevicePage) { } }
private async void BookCabButton_Clicked(object sender, EventArgs e) { bool confirm = await DisplayAlert("Confirm", "Are you sure you want to approve this application?", "Yes", "No"); if (confirm) { Cab cab = new Cab { cab_no = CabNoEntry.Text, applicationid = int.Parse(applicationid), expected_arrival_time = (DateTime.Today + ExpectedArrivalTimePicker.Time).ToString("o"), driver_name = DriverNameEntry.Text, driver_contact_no = DriverContactEntry.Text, cab_status = "BOOKED", booking_time = DateTime.UtcNow.ToString("s") }; //Send Cab Details here, this cab is being created in database for the first time CabController.AddCab(cab); //Pop back to Security HomePage Navigation.PopAsync(); Navigation.PopAsync(); } }
public void Initialize() { // Create test data _customerId = _fixture.Create <Id <Customer> >(); _customerLocation = _fixture.Create <Location>(); _cab = _fixture.Create <Cab>(); _trainStationLocation = _fixture.Create <Location>(); _currentTime = _fixture.Create <DateTime>(); _estimatedTimeOfArrival = _currentTime.AddMinutes(_fixture.Create <int>()); // Setup stubs _locationProvider = Substitute.For <IProvideLocation>(); _locationProvider.GetTrainStationLocation().Returns(_trainStationLocation); _cabProvider = Substitute.For <IProvideCab>(); _cabProvider.GetNearestAvailableCab(Arg.Any <Location>()).Returns(_cab); _timeProvider = Substitute.For <IProvideTime>(); _timeProvider.GetCurrentTime().Returns(_currentTime); _trafficInformationProvider = Substitute.For <IProvideTrafficInformation>(); _trafficInformationProvider.GetTimeOfArival(Arg.Any <DateTime>(), Arg.Any <Kilometer>()).Returns(_estimatedTimeOfArrival); _trafficInformationProvider.GetDistanceBetweenLocations(Arg.Any <Location>(), Arg.Any <Location>()).Returns(_fixture.Create <Kilometer>()); // Create subject under test _sut = new CabRideService(_locationProvider, _cabProvider, _timeProvider, _trafficInformationProvider); }
public HistoryWindow(Cab c) { InitializeComponent(); this.cab = c; Title = c.Name; type = HistoryWindowType.TYPE_CAB; }
public int AddCab(cabdto cabdetails) { try { if (!_context.Cab.Any(r => r.VehicleNo == cabdetails.VehicleNo && r.IsDeleted == false)) { var CabDetail = new Cab { Capacity = Int32.Parse(cabdetails.Capacity), Model = cabdetails.Model, VehicleNo = cabdetails.VehicleNo }; _context.Cab.Add(CabDetail); _context.SaveChanges(); } else { throw new Exception(); } return(1); } catch (Exception e) { throw e; } }
//针对一个监测点是多个设备 没有柜子概念 public DevicePage(Frame fm, Building b) { InitializeComponent(); this.systemFrame = fm; this.building = b; //如果没有柜子可以把所有需要显示的设备放在一个柜子里面进行显示 this.cab = b.Cabs[0]; init(); }
public void CreateCab(Cab newCab) { if (_cabs.ContainsKey(newCab.ID)) { throw new Exception("Cab already exists"); } _cabs.Add(newCab.ID, newCab); }
/// <summary> /// Instantiate a new CabinetWorkItem. /// </summary> /// <param name="fileRows">The collection of files in this cabinet.</param> /// <param name="cabinetFile">The cabinet file.</param> /// <param name="maxThreshold">Maximum threshold for each cabinet.</param> /// <param name="compressionLevel">The compression level of the cabinet.</param> /// <param name="binderFileManager">The binder file manager.</param> public CabinetWorkItem(FileRowCollection fileRows, string cabinetFile, int maxThreshold, Cab.CompressionLevel compressionLevel, BinderFileManager binderFileManager) { this.cabinetFile = cabinetFile; this.compressionLevel = compressionLevel; this.fileRows = fileRows; this.binderFileManager = binderFileManager; this.maxThreshold = maxThreshold; }
private void DeviceGroupStatusChage(object sender, PropertyChangedEventArgs e) { this.Dispatcher.Invoke(DispatcherPriority.Normal, (ThreadStart) delegate() { Cab c = (Cab)sender; info_panel.Children.RemoveAt(0); info_panel.Children.Add(new LabelAndText("监测点状态 : ", cab.State.Equals("Normal") ? "正常" : "异常", Colors.White)); }); }
public void CreateCab(Cab cab) { if (Cabs.ContainsKey(cab.Id)) { throw new CustomException("CAB_ALREADY_EXISTS", 409); } Cabs.Add(cab.Id, cab); }
public CabUI(Frame frame, Cab cab) { InitializeComponent(); systemframe = frame; this._cab = cab; init(); initEnventListner(); this.deviceList = new List <DeviceUI>(); }
void Cablist_DoubleClick(object sender, MouseEventArgs e) { Console.WriteLine("添加一个柜子"); Cab cab = new Cab(); //添加在界面上 SingleCab cabinfo = new SingleCab(cab); CabList.Items.Add(cabinfo); }
public IActionResult PostCabs([FromBody] Cab cab) { using (var scope = new TransactionScope()) { _cabRepository.InsertCab(cab); scope.Complete(); return(CreatedAtAction(nameof(GetCabs), new { id = cab.BookId }, cab)); } }
public MyCabControlSystem(int noOfcabs, int noOfStops) { this.noOfcabs = noOfcabs; this.noOfStops = noOfStops; for (int i = 0; i < noOfcabs; i++) { Cab cab = new Cab(i); cabs.Add(cab); } }
public void FinishTrip(Cab cab) { if (cab.CurrentTrip == null) { throw new CustomException("TRIP_NOT_FOUND", 400); } cab.CurrentTrip.FinishTrip(); cab.CurrentTrip = null; }
//删除一个柜子 public void deleteCab(Frame sysFram, Cab c) { for (int i = 0; i < CabList.Items.Count; i++) { if (((CabUI)cabListSource[i]).CabInUI.CabId == c.CabId) { cabListSource.RemoveAt(i); } } ApplyDataBinding(); }
public void WhenIdProvided_ShouldSetId() { // Arrange var id = _fixture.Create <Id <Cab> >(); // Act var actual = new Cab(id, _location); // Assert actual.Id.Should().Be(id); }
public async Task <IActionResult> Create([Bind("BookId,BookTime,JourneyTime,JourneyPlace")] Cab cab) { if (ModelState.IsValid) { _context.Add(cab); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } return(View(cab)); }
public void WhenSameInstance_ShouldBeEqual() { // Arrange var cab = new Cab(_id, _location); // Act var actual = cab.Equals(cab); // Assert actual.Should().BeTrue(); }
public ActionResult EndRide(Cab cab, Customer customer) { CabService cabService = new CabService(); cabService.UpdateCabLocation(cab, customer); CustomerService customerService = new CustomerService(); customerService.RemoveCustomer(customer); return(Ok()); }
public void WhenLocationProvided_ShouldSetLocation() { // Arrange var location = _fixture.Create <Location>(); // Act var actual = new Cab(_id, location); // Assert actual.CurrentLocation.Should().Be(location); }
public void WhenSame_ComparisonShouldBeFalse() { // Arrange var cab = new Cab(_id, _location); var sameCab = new Cab(_id, _location); // Act var actual = cab != sameCab; // Assert actual.Should().BeFalse(); }
internal Train () { this.Acceleration = new Acceleration(); this.Performance = new Performance(); this.Delay = new Delay(); this.Move = new Move(); this.Brake = new Brake(); this.Pressure = new Pressure(); this.Handle = new Handle(); this.Cab = new Cab(); this.Car = new Car(); this.Device = new Device(); this.MotorP1 = new Motor(); this.MotorP2 = new Motor(); this.MotorB1 = new Motor(); this.MotorB2 = new Motor(); }