Exemplo n.º 1
0
        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");
            }
        }
Exemplo n.º 2
0
        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";
                }
            }
        }
Exemplo n.º 4
0
 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)
                             ));
 }
Exemplo n.º 5
0
 public DevicePage(Frame fm, Cab c)
 {
     InitializeComponent();
     this.systemFrame = fm;
     this.cab         = c;
     init();
 }
Exemplo n.º 6
0
 public ParametersSettingsWindow(Cab c)
 {
     InitializeComponent();
     type     = paraSettingsWindowType.onCab;
     this.cab = c;
     init();
 }
Exemplo n.º 7
0
        public async Task <Cab> AddAsync(Cab cab)
        {
            _dbContext.Cabs.Add(cab);
            await _dbContext.SaveChangesAsync();

            return(cab);
        }
Exemplo n.º 8
0
        public async Task <Cab> UpdateAsync(Cab cab)
        {
            _dbContext.Entry(cab).State = EntityState.Modified;
            await _dbContext.SaveChangesAsync();

            return(cab);
        }
Exemplo n.º 9
0
        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");
        }
Exemplo n.º 10
0
        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)
            {
            }
        }
Exemplo n.º 11
0
        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();
            }
        }
Exemplo n.º 12
0
        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);
        }
Exemplo n.º 13
0
 public HistoryWindow(Cab c)
 {
     InitializeComponent();
     this.cab = c;
     Title    = c.Name;
     type     = HistoryWindowType.TYPE_CAB;
 }
Exemplo n.º 14
0
        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;
            }
        }
Exemplo n.º 15
0
 //针对一个监测点是多个设备 没有柜子概念
 public DevicePage(Frame fm, Building b)
 {
     InitializeComponent();
     this.systemFrame = fm;
     this.building    = b; //如果没有柜子可以把所有需要显示的设备放在一个柜子里面进行显示
     this.cab         = b.Cabs[0];
     init();
 }
Exemplo n.º 16
0
 public void CreateCab(Cab newCab)
 {
     if (_cabs.ContainsKey(newCab.ID))
     {
         throw new Exception("Cab already exists");
     }
     _cabs.Add(newCab.ID, newCab);
 }
Exemplo n.º 17
0
 /// <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;
 }
Exemplo n.º 18
0
 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));
     });
 }
Exemplo n.º 19
0
        public void CreateCab(Cab cab)
        {
            if (Cabs.ContainsKey(cab.Id))
            {
                throw new CustomException("CAB_ALREADY_EXISTS", 409);
            }

            Cabs.Add(cab.Id, cab);
        }
Exemplo n.º 20
0
 public CabUI(Frame frame, Cab cab)
 {
     InitializeComponent();
     systemframe = frame;
     this._cab   = cab;
     init();
     initEnventListner();
     this.deviceList = new List <DeviceUI>();
 }
Exemplo n.º 21
0
        void Cablist_DoubleClick(object sender, MouseEventArgs e)
        {
            Console.WriteLine("添加一个柜子");
            Cab cab = new Cab();
            //添加在界面上
            SingleCab cabinfo = new SingleCab(cab);

            CabList.Items.Add(cabinfo);
        }
Exemplo n.º 22
0
 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));
     }
 }
Exemplo n.º 23
0
 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);
     }
 }
Exemplo n.º 24
0
        public void FinishTrip(Cab cab)
        {
            if (cab.CurrentTrip == null)
            {
                throw new CustomException("TRIP_NOT_FOUND", 400);
            }

            cab.CurrentTrip.FinishTrip();
            cab.CurrentTrip = null;
        }
Exemplo n.º 25
0
 //删除一个柜子
 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();
 }
Exemplo n.º 26
0
        public void WhenIdProvided_ShouldSetId()
        {
            // Arrange
            var id = _fixture.Create <Id <Cab> >();

            // Act
            var actual = new Cab(id, _location);

            // Assert
            actual.Id.Should().Be(id);
        }
Exemplo n.º 27
0
        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));
        }
Exemplo n.º 28
0
        public void WhenSameInstance_ShouldBeEqual()
        {
            // Arrange
            var cab = new Cab(_id, _location);

            // Act
            var actual = cab.Equals(cab);

            // Assert
            actual.Should().BeTrue();
        }
Exemplo n.º 29
0
        public ActionResult EndRide(Cab cab, Customer customer)
        {
            CabService cabService = new CabService();

            cabService.UpdateCabLocation(cab, customer);

            CustomerService customerService = new CustomerService();

            customerService.RemoveCustomer(customer);
            return(Ok());
        }
Exemplo n.º 30
0
        public void WhenLocationProvided_ShouldSetLocation()
        {
            // Arrange
            var location = _fixture.Create <Location>();

            // Act
            var actual = new Cab(_id, location);

            // Assert
            actual.CurrentLocation.Should().Be(location);
        }
Exemplo n.º 31
0
        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();
        }
Exemplo n.º 32
0
			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();
			}