Пример #1
0
        public ActionResult DeleteConfirmed(int id)
        {
            logger.Info("Delete HttpPost Method Start" + " at " + DateTime.UtcNow);
            logger.Info("Delete HttpPost Method ServiceOperator Id" + id + " at " + DateTime.UtcNow);
            ServiceOperator serviceoperator = db.ServiceOperators.Find(id);

            db.ServiceOperators.Remove(serviceoperator);
            db.SaveChanges();
            logger.Info("Delete HttpPost Method ServiceOperator removed at " + DateTime.UtcNow);
            logger.Info("Delete HttpPost Method End" + " at " + DateTime.UtcNow);
            return(RedirectToAction("Index"));
        }
Пример #2
0
        //
        // GET: /ServiceOperator/Details/5
        /// <summary>
        /// This mehod will give details for seleced Service Operator.
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        public ActionResult Details(int id = 0)
        {
            logger.Info("Details Method Start" + " at " + DateTime.UtcNow);
            logger.Info("Details Method ServiceOperators Id" + id + " at " + DateTime.UtcNow);
            ServiceOperator serviceoperator = db.ServiceOperators.Find(id);

            if (serviceoperator == null)
            {
                logger.Info("Details Method ServiceOperators not found at " + DateTime.UtcNow);
                return(HttpNotFound());
            }
            logger.Info("Details Method End" + " at " + DateTime.UtcNow);
            return(View(serviceoperator));
        }
Пример #3
0
        private void SaveButton_TouchUpInside(object sender, EventArgs e)
        {
            double recordValue = 0;

            if (this.singleRecordSwitch.On)
            {
                if (Double.TryParse(this.excerciseRecordTextField.Text, out recordValue))
                {
                    ServiceOperator.GetInstance().SaveUserActivityRecord((int)this.userSetsPickerView.SelectedRowInComponent(0), (int)this.userExcercisePickerView.SelectedRowInComponent(0), recordValue);
                    this.PerformSegue("mainToResultsSegue", this);
                }
                else
                {
                    // TODO: Error message to the user
                }
            }
            else if (this.timerSwitch.On)
            {
                this.nsTimer = NSTimer.CreateRepeatingTimer(1, delegate {
                    int minutes = this.timerSeconds / 60;
                    int hours   = minutes / 60;
                    this.timerSeconds++;

                    this.timerInfoLabel.Text = hours + ":" + minutes + ":" + this.timerSeconds % 60;
                });
                if (!this.timerEnabled)
                {
                    this.timerEnabled = true;

                    NSRunLoop.Current.AddTimer(this.nsTimer, NSRunLoopMode.Default);

                    this.userGPSLocationData = new List <GPSLocationData> ();
                    this.Manager.StartLocationUpdates();
                    this.SaveButton.SetTitle("Stop", UIControlState.Normal);
                }
                else
                {
                    this.StoreGPSLocation(this.Manager.GetCurrentLocation());
                    this.Manager.StopLocationUpdates();
                    this.nsTimer.Invalidate();
                    this.nsTimer.Dispose();
                    this.nsTimer = null;
                    ServiceOperator.GetInstance().SaveUserActivityRecord((int)this.userSetsPickerView.SelectedRowInComponent(0), (int)this.userExcercisePickerView.SelectedRowInComponent(0), this.timerSeconds * 1000);
                    this.userGPSLocationData.Clear();
                    //this.timer.Stop ();
                    this.PerformSegue("mainToResultsSegue", this);
                }
            }
        }
Пример #4
0
        //
        // GET: /ServiceOperator/Edit/5
        /// <summary>
        /// This method will edit selected Service Operator.
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        public ActionResult Edit(int id = 0)
        {
            logger.Info("Edit Get Method Start" + " at " + DateTime.UtcNow);
            logger.Info("Edit Get Method Serviceoperator Id " + id + " at " + DateTime.UtcNow);
            ServiceOperator serviceoperator = db.ServiceOperators.Find(id);

            if (serviceoperator == null)
            {
                logger.Info("Edit Get Method ServiceOperator not found " + " at " + DateTime.UtcNow);
                return(HttpNotFound());
            }
            ViewBag.ServiceTypeId = new SelectList(db.ServiceTypes, "ServiceTypeId", "ServiceTypeName", serviceoperator.ServiceTypeId);
            logger.Info("Edit Get Method End" + " at " + DateTime.UtcNow);
            return(View(serviceoperator));
        }
Пример #5
0
        public ActionResult Create(ServiceOperator serviceoperator)
        {
            logger.Info("Create HttpPost Method Start" + " at " + DateTime.UtcNow);
            if (ModelState.IsValid)
            {
                db.ServiceOperators.Add(serviceoperator);
                db.SaveChanges();
                logger.Info("Create HttpPost Method Service Operator added" + " at " + DateTime.UtcNow);
                return(RedirectToAction("Index"));
            }

            ViewBag.ServiceTypeId = new SelectList(db.ServiceTypes, "ServiceTypeId", "ServiceTypeName", serviceoperator.ServiceTypeId);
            logger.Info("Create HttpPost Method End" + " at " + DateTime.UtcNow);
            return(View(serviceoperator));
        }
Пример #6
0
 public ActionResult Edit(ServiceOperator serviceoperator)
 {
     logger.Info("Edit HttpPost Method Start" + " at " + DateTime.UtcNow);
     logger.Info("Edit HttpPost Method Serviceoperator Id " + serviceoperator.ServiceOperatorId + " at " + DateTime.UtcNow);
     if (ModelState.IsValid)
     {
         db.Entry(serviceoperator).State = EntityState.Modified;
         db.SaveChanges();
         logger.Info("Edit HttpPost Method ServiceOperator details updated " + " at " + DateTime.UtcNow);
         return(RedirectToAction("Index"));
     }
     ViewBag.ServiceTypeId = new SelectList(db.ServiceTypes, "ServiceTypeId", "ServiceTypeName", serviceoperator.ServiceTypeId);
     logger.Info("Edit HttpPost Method End" + " at " + DateTime.UtcNow);
     return(View(serviceoperator));
 }
Пример #7
0
        public override void ViewDidLoad()
        {
            base.ViewDidLoad();
            ServiceOperator.GetInstance().StartSignalR();
            ServiceOperator.GetInstance().LoadUserData();
            ServiceOperator.GetInstance().IsDataUpdateRequiredForMobileClientEvent += (object sender, MyFitnessXamarinApps.SignalR.SignalRClientEventArgs e) => {
                UIApplication.SharedApplication.InvokeOnMainThread(new Action(() =>
                {
                    ServiceOperator.GetInstance().LoadUserData();
                    this.userSetsPickerView.Model      = new SetsUIPickerViewModel(this.userExcercisePickerView);
                    this.userExcercisePickerView.Model = new ExcercisesUIPickerViewController(0);
                    //Create Alert
                    var okAlertController = UIAlertController.Create("Data update", "Data has changed on the server. Updating UI!", UIAlertControllerStyle.Alert);

                    //Add Action
                    okAlertController.AddAction(UIAlertAction.Create("OK", UIAlertActionStyle.Default, null));

                    // Present Alert
                    PresentViewController(okAlertController, true, null);
                }));
            };

            this.userSetsPickerView.Model         = new SetsUIPickerViewModel(this.userExcercisePickerView);
            this.userExcercisePickerView.Model    = new ExcercisesUIPickerViewController(0);
            this.timerSwitch.ValueChanged        += TimerSwitch_ValueChanged;
            this.singleRecordSwitch.ValueChanged += SingleRecordSwitch_ValueChanged;
            this.SaveButton.TouchUpInside        += SaveButton_TouchUpInside;
            this.timerInfoLabel.Text              = String.Empty;
            //ServiceOperator.GetInstance().GetUserSets()



            Manager.LocationUpdated += HandleLocationChanged;


            /*UIApplication.Notifications.ObserveDidEnterBackground ((sender, args) => {
             *      Manager.LocationUpdated -= HandleLocationChanged;
             * });
             *
             * UIApplication.Notifications.ObserveDidBecomeActive ((sender, args) => {
             *      Manager.LocationUpdated += HandleLocationChanged;
             * });*/
        }
Пример #8
0
        protected SocketMessage SortSocketMessage(SocketMessage request)
        {
            if (request == null)
            {
                throw new ArgumentNullException(nameof(request));
            }
            if (request.Headers.BodyType == typeof(ServiceGroupModel))
            {
                using (var op = new ServiceOperator(request))
                {
                    return(op.Operate());
                }
            }

            if (request.Headers.BodyType == typeof(ScriptModel))
            {
                using (var op = new ScriptOperator(request))
                {
                    return(op.Operate());
                }
            }
            throw new ArgumentException("Unknown Message Type!", nameof(request.Headers.BodyType));
        }
 private void LoginButton_TouchUpInside(object sender, EventArgs e)
 {
     ServiceOperator.InitializeInstance(this.UserIDTextField.Text);
     ServiceOperator.GetInstance().LoginUser(this.UserIDTextField.Text, PasswordTextField.Text);
     this.PerformSegue("loginToMainSegue", this);
 }
Пример #10
0
 public override string GetTitle(UIPickerView pickerView, nint row, nint component)
 {
     return(ServiceOperator.GetInstance().GetUserSets()[(int)this.SetID].Exercises[(int)row].Name);
 }
Пример #11
0
 public override nint GetRowsInComponent(UIPickerView pickerView, nint component)
 {
     return(ServiceOperator.GetInstance().GetUserSets()[(int)this.SetID].Exercises.Count);
 }