示例#1
0
        private void FinishExam()
        {
            APIServices api = new APIServices();

            CalculatePoints();
            double a = Points;
            string grade;


            if ((a / CurrentlyExam.MaxPoints) > 0.75)
            {
                grade = "Väl Godkänd";
            }
            else if ((a / CurrentlyExam.MaxPoints) > 0.5)
            {
                grade = "Godkänd";
            }
            else
            {
                grade = "Icke Godkänd";
            }


            api.PostStudentsResults(new StudentsResults()
            {
                Grade    = grade,
                TestId   = CurrentlyExam.ID,
                PersonId = App.LoggedInUser.Id
            });
        }
示例#2
0
        async System.Threading.Tasks.Task SaveProfile()
        {
            int id = Int32.Parse(Application.Current.Properties["id"].ToString());

            if (PasswordError == false && NameError == false)
            {
                bool success = await APIServices.UpdateUser(id, ProfileData.Name, ProfileData.Password, Constants.updateProfileEndPoint);

                if (success)
                {
                    await Application.Current.MainPage.DisplayAlert("Updated", "Successful", "OK");
                    await ProfileDataCommand();
                }
                else
                {
                    await Application.Current.MainPage.DisplayAlert("Update Failed", "Try Again", "OK");
                }
            }
            else
            {
                await Application.Current.MainPage.DisplayAlert("Invalid Input", "Enter Again", "OK");
            }


            ProfileData = await APIServices.GetProfileData(Constants.profileEndpoint, id);
        }
 public PutAndPostDialog(Book b)
 {
     thisBook      = b;
     bookViewModel = new BookViewModel();
     APIServices   = new APIServices();
     this.InitializeComponent();
 }
        public async Task <FileResult> Download(string fileId, string fileName)
        {
            //return File(Path.Combine(Server.MapPath("~/App_Data/Upload/"), p), System.Net.Mime.MediaTypeNames.Application.Octet, d);
            CustomerFile custFile = await APIServices.DownloadFile(fileId).ConfigureAwait(false);

            return(File(custFile.DocumentData, System.Net.Mime.MediaTypeNames.Application.Octet, fileName));
        }
示例#5
0
        async System.Threading.Tasks.Task ProductNumberDataCommand()
        {
            CardsCollection = await APIServices.GetProductNumber(Constants.productMenuEndPoint);

            IsLoading        = false;
            IsMenuRefreshing = false;
        }
        async System.Threading.Tasks.Task TotalMessageDataCommand()
        {
            int id = Int32.Parse(Application.Current.Properties["id"].ToString());

            MessageCollection = await APIServices.GetSpecificMessageData(Constants.specificMessageEndpoint, Message.sender, Message.productId, id);

            IsLoading = false;
        }
        public AcceptOrderPageVM()
        {
            AcceptCommand = new Command(AcceptPressedCommand);

            var response = APIServices.GetRequest(ApiPaths.ticketStatuses);

            Statuses = JsonConvert.DeserializeObject <ObservableCollection <TicketStatuses> >(response);
        }
 protected void Application_Start()
 {
     AreaRegistration.RegisterAllAreas();
     FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters);
     RouteConfig.RegisterRoutes(RouteTable.Routes);
     BundleConfig.RegisterBundles(BundleTable.Bundles);
     APIServices.InitializeClient();
 }
示例#9
0
        async System.Threading.Tasks.Task ProfileDataCommand()
        {
            int id = Int32.Parse(Application.Current.Properties["id"].ToString());



            ProfileData = await APIServices.GetProfileData(Constants.profileEndpoint, id);
        }
        public DeleteTestPage()
        {
            this.InitializeComponent();
            aPIServices = new APIServices();

            testViewModel = new TestViewModel();
            Get();
        }
示例#11
0
 public CreateTestPage()
 {
     this.InitializeComponent();
     aPIServices   = new APIServices();
     testViewModel = new TestViewModel();
     exam          = new Test();
     Number        = 0;
 }
示例#12
0
 public StudentViewModel()
 {
     APIServices  = new APIServices();
     _studentlist = new ObservableCollection <Person>();
     httpClient   = new HttpClient();
     Person       = new ObservableCollection <Person>();
     Person.Add(App.LoggedInUser);
 }
示例#13
0
        public AppointmentPage()
        {
            aPIServices = new APIServices();
            clientappointmentViewModel = new ClientAppointmentViewModel();
            clientappointmentViewModel.appointments = new ObservableCollection <ClientAppointment>();

            this.InitializeComponent();
            GetAllAppointments();
        }
示例#14
0
        public MainPage()

        {
            bookViewModel = new BookViewModel();
            APIServices   = new APIServices();

            this.InitializeComponent();
            GetAllbooks();
        }
示例#15
0
        public LoginViewModel()
        {
            this.apiService   = new APIServices();
            this.IsRemembered = true;
            this.IsEnabled    = true;

            this.Email    = "*****@*****.**";
            this.Password = "******";
        }
        public ActionResult Run()
        {
            string word = APIServices.readOutput();

            return(View("Index", new HelloWorldCppViewModel()
            {
                ServerMessage = word
            }));
        }
        public Tickets GetTicketFromId()
        {
            string source = SelectedTicket.TicketsID.ToString();

            var response = APIServices.GetRequest(ApiPaths.tickets, source);

            var ticket = JsonConvert.DeserializeObject <Tickets>(response);

            return(ticket);
        }
        public async Task <object> AddEditEmpolyees(string empObj)
        {
            MultipartFormDataContent multiForm = new MultipartFormDataContent
            {
                { new StringContent(empObj ?? ""), "empObj" }
            };
            object str = await APIServices.Post <object>($"/api/home/AddEditEmpolyees", multiForm);

            return(str);
        }
        public async Task <ActionResult> Edit(Customer customer)
        {
            if (ModelState.IsValid)
            {
                bool result = await APIServices.EditCustomer(customer, Request.Files).ConfigureAwait(false);

                return(RedirectToAction("Index"));
            }

            return(View(customer));
        }
        public ActiveTestsPage()
        {
            this.InitializeComponent();

            testViewModel            = new TestViewModel();
            apiServices              = new APIServices();
            studentsResultsViewModel = new StudentsResultsViewModel();
            writeTestPage            = new WriteTestPage();

            GetTests();
        }
        public StudentsResultsPage()
        {
            this.InitializeComponent();

            studentViewModel         = new StudentViewModel();
            studentsResultsViewModel = new StudentsResultsViewModel();
            apiServices   = new APIServices();
            testViewModel = new TestViewModel();

            GetStudentsResults();
        }
示例#22
0
        public SlotPage()
        {
            clientScheduleViewModel   = new ClientScheduleViewModel();
            clientSlotViewModel       = new ClientSlotViewModel();
            clientSlotViewModel.slots = new ObservableCollection <ClientSlot>();
            aPIServices = new APIServices();

            this.InitializeComponent();
            GetAllSlots();
            GetAllSchedules();
        }
示例#23
0
        public WriteTestPage()
        {
            this.InitializeComponent();

            testViewModel    = new TestViewModel();
            studentViewModel = new StudentViewModel();
            person           = new Person();
            aPIServices      = new APIServices();
            studentsResults  = new StudentsResults();
            studentViewModel = new StudentViewModel();
        }
        public MainPage()
        {
            aPIServices = new APIServices();
            pnr         = new List <string>()
            {
                "191212121212", "191111111111", "190101010101", "201212121212"
            };
            ClientPatientViewModel          = new ClientPatientViewModel();
            ClientPatientViewModel.Patients = new ObservableCollection <ClientPatient>();
            this.InitializeComponent();
            BackButton.Visibility = Visibility.Collapsed;
            GetAllPatients();

            //Patient pat = new Patient();

            //pat.Identifier = new List<Identifier>();
            //Identifier newIdentifier = new Identifier();
            //newIdentifier.Value = "5";
            //pat.Identifier.Add(newIdentifier);

            //pat.Name = new List<HumanName>();
            //HumanName newName = new HumanName();
            //newName.Text = "Steven Matetcho";
            //newName.Use = HumanName.NameUse.Official;
            //pat.Name.Add(newName);
            //newName = new HumanName();
            //newName.Text = "Steve";
            //newName.Use = HumanName.NameUse.Nickname;
            //pat.Name.Add(newName);

            //pat.Telecom = new List<ContactPoint>();
            //ContactPoint newContact = new ContactPoint();
            //newContact.Value = "040 - 11 22 33";
            //newContact.Use = ContactPoint.ContactPointUse.Work;
            //newContact.Rank = 2;
            //pat.Telecom.Add(newContact);

            //newContact = new ContactPoint();
            //newContact.Value = "076 - 45 45 46";
            //newContact.Use = ContactPoint.ContactPointUse.Home;
            //newContact.Rank = 1;
            //pat.Telecom.Add(newContact);

            //pat.Gender = AdministrativeGender.Male;

            //pat.BirthDate = "06/05/1996";

            //pat.Active = true;

            //ClientPatientViewModel.Patient = pat;

            // ClientPatientViewModell = new ClientPatientViewModel();
        }
        public PostAndPutAppointmentDialog(ClientAppointment app)
        {
            Statuses = new List <string>()
            {
                "Proposed", "Pending", "Booked", "Arrived", "Fulfilled", "CheckedIn", "Waitlist", "Noshow", "EnteredInError"
            };
            thisAppointment = app;

            //clientAppointmentViewModel = new ClientAppointmentViewModel();
            aPIServices = new APIServices();
            this.InitializeComponent();
        }
        public async Task <ActionResult> Edit(string id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            Customer customer = await APIServices.GetCustomerWithCustomerId(id).ConfigureAwait(false);

            if (customer == null)
            {
                return(HttpNotFound());
            }
            return(View(customer));
        }
        public async Task <ActionResult> Create(Customer customer)
        {
            ViewBag.Status = string.Empty;

            if (ModelState.IsValid)
            {
                bool result = await APIServices.CreateCustomers(customer, Request.Files).ConfigureAwait(false);

                //if (result)
                //    ViewBag.Status = "Data Saved Successfully.";

                //return View(customer);
            }
            return(RedirectToAction("Index"));
        }
        async System.Threading.Tasks.Task RejectCommand(StatusUpdateModel s)
        {
            result = await APIServices.UpdateStatus(s, Constants.updateUserStatusEndpoint);

            if (result)
            {
                await Application.Current.MainPage.DisplayAlert("Success", "User Rejected", "ok");

                await Application.Current.MainPage.Navigation.PushAsync(new UsersView(2, "Pending User"));
            }
            else
            {
                await Application.Current.MainPage.DisplayAlert("Error", "Please try again", "ok");
            }
        }
        public async Task <ActionResult> Register(RegisterViewModel model)
        {
            if (ModelState.IsValid)
            {
                MultipartFormDataContent multiForm = new MultipartFormDataContent
                {
                    { new StringContent(model.Email ?? ""), "Email" },
                    { new StringContent(model.Password ?? ""), "Password" }
                };
                var response = await APIServices.Post <Dictionary <string, string> >("/api/account/RegisterUser", multiForm);

                return(RedirectToAction("Login", "Account"));
            }

            return(View(model));
        }
        /// <summary>
        /// Function to save the HTML of a article to a local file.
        /// </summary>
        /// <param name="title">The title of the article to get the html from and the name of file to be saved to</param>
        /// <returns>Nothing</returns>
        public async static Task SaveHTMLFileToStorage(string title)
        {
            //Debug.WriteLine("Title: " + title);
            string HTMLText = "";

            //Call the API service to get the HTML text from wikipedia
            HTMLText = await APIServices.GetAllHTMLFromWikipediaArticle(title);

            //Get the path to the file where it will be stored
            title = HTMLHandler.ReplaceColons(title);
            string fileName = Path.Combine(dirPath, (title + ".wik"));

            //Write to file
            File.WriteAllText(fileName, HTMLText);
            //Debug.WriteLine("Wrote To file: " + Path.Combine(dirPath, (title + ".wik")));
        }