Exemplo n.º 1
0
        protected void buttonPermissionApprove_ServerClick(object sender, EventArgs e)
        {
            try
            {
                string nric = ViewState["GridViewPatientSelectedNRIC"].ToString();

                short permission = 0;

                if (CheckBoxTypeHeightMeasurement.Checked)
                {
                    permission += new HeightMeasurement().permissionFlag;
                }
                if (CheckBoxTypeWeightMeasurement.Checked)
                {
                    permission += new WeightMeasurement().permissionFlag;
                }
                if (CheckBoxTypeTemperatureReading.Checked)
                {
                    permission += new TemperatureReading().permissionFlag;
                }
                if (CheckBoxTypeBloodPressureReading.Checked)
                {
                    permission += new BloodPressureReading().permissionFlag;
                }
                if (CheckBoxTypeECGReading.Checked)
                {
                    permission += new ECGReading().permissionFlag;
                }
                if (CheckBoxTypeMRI.Checked)
                {
                    permission += new MRI().permissionFlag;
                }
                if (CheckBoxTypeXRay.Checked)
                {
                    permission += new XRay().permissionFlag;
                }
                if (CheckBoxTypeGait.Checked)
                {
                    permission += new Gait().permissionFlag;
                }

                patientBLL.ApproveRequest(nric, permission);
                Bind_GridViewTherapist();
                Update_UpdatePanelPermissions(nric);
                ScriptManager.RegisterStartupScript(this, GetType(), "alert", "toastr['success']('Request Approved, Permissions of " + nric + " has been Updated.');", true);
            }
            catch
            {
                ScriptManager.RegisterStartupScript(this, GetType(), "alert", "toastr['error']('Error occured when Updating Permissions.');", true);
            }
        }
Exemplo n.º 2
0
        protected void buttonRequest_ServerClick(object sender, EventArgs e)
        {
            try
            {
                string nric       = ViewState["GridViewPatientSelectedNRIC"].ToString();
                short  permission = 0;

                if (CheckBoxTypeHeightMeasurement.Checked)
                {
                    permission += new HeightMeasurement().permissionFlag;
                }
                if (CheckBoxTypeWeightMeasurement.Checked)
                {
                    permission += new WeightMeasurement().permissionFlag;
                }
                if (CheckBoxTypeTemperatureReading.Checked)
                {
                    permission += new TemperatureReading().permissionFlag;
                }
                if (CheckBoxTypeBloodPressureReading.Checked)
                {
                    permission += new BloodPressureReading().permissionFlag;
                }
                if (CheckBoxTypeECGReading.Checked)
                {
                    permission += new ECGReading().permissionFlag;
                }
                if (CheckBoxTypeMRI.Checked)
                {
                    permission += new MRI().permissionFlag;
                }
                if (CheckBoxTypeXRay.Checked)
                {
                    permission += new XRay().permissionFlag;
                }
                if (CheckBoxTypeGait.Checked)
                {
                    permission += new Gait().permissionFlag;
                }

                therapistBLL.SubmitRequest(nric, permission);
                ScriptManager.RegisterStartupScript(this, GetType(), "alert", "$('#modalSelectPermissions').modal('hide');toastr['success']('Request Submitted to " + nric + " for Permissions.');", true);
                Bind_GridViewPatient();
            }
            catch
            {
                ScriptManager.RegisterStartupScript(this, GetType(), "alert", "$('#modalSelectPermissions').modal('hide');toastr['error']('Error occured when Submitting Request.');", true);
            }
        }
Exemplo n.º 3
0
        public async Task <JsonResult> CreateHeight(MeasurementViewModel viewModel)
        {
            var user = await userManager.FindByIdAsync(User.Identity.GetUserId());

            if (user == null)
            {
                return(Json(HttpStatusCode.Unauthorized.ToString()));
            }
            if (ModelState.IsValid)
            {
                var measurement = new HeightMeasurement
                {
                    MeasurementDate = viewModel.MeasurementDate,
                    Value           = Convert.ToDouble(viewModel.Value)
                };
                var oldMeasurement = heightMeasurementService.Find(m =>
                                                                   m.ApplicationUser.Id == user.Id &&
                                                                   m.MeasurementDate == measurement.MeasurementDate).ToList();
                if (oldMeasurement.Count == 0)
                {
                    measurement.ApplicationUser = user;
                    heightMeasurementService.Create(measurement);
                    return(Json("Created successfully"));
                }
                else
                {
                    oldMeasurement.First().Value = measurement.Value;
                    heightMeasurementService.Update(oldMeasurement.First());
                    return(Json("Updated successfully"));
                }
            }
            string errors = "";

            foreach (var modelState in ModelState.Values)
            {
                foreach (var error in modelState.Errors)
                {
                    errors += error.ErrorMessage + ". ";
                }
            }
            // error
            return(Json(errors));
        }