コード例 #1
0
 public object Get([System.Web.Http.ModelBinding.ModelBinder] GetPagedListParams parms)
 {
     return(new
     {
         Students = DpManagementService.GetGraduateStudentsForUser(WebSecurity.CurrentUserId, parms),
         PercentageGraphs = PercentageService.GetPercentageGraphsForLecturerAll(WebSecurity.CurrentUserId, parms)
     });
 }
コード例 #2
0
        private void Run_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                ExceptionLabel.Foreground = Brushes.DarkRed;
                if (AccuracyComboBox.SelectedItem == null)
                {
                    throw new Exception(Properties.Resources.ExceptionLabelAccuracyNOTChosen);
                }

                var random               = new Random();
                var solver               = new ClassLibrary.Logic.Solver();
                var accuracy             = double.Parse(AccuracyComboBox.Text);
                var parametersForDefined = FileProcessing.ReadSolutionForPersistenceTest(_filename);

                if (parametersForDefined == null)
                {
                    throw new Exception(Properties.Resources.ExceptionLabelIncorrectFileFormat);
                }

                (double, double)cParameters  = PercentFinder.GetCsRange(parametersForDefined);
                (double, double)abParameters = PercentFinder.GetABRange(parametersForDefined);
                (double, double)lParameters  = PercentFinder.GetLRange(parametersForDefined);

                DistributionParametersService distributionParameters = new DistributionParametersService();
                var distributionParametersIds = distributionParameters.GetAppropriateIds(
                    cParameters, abParameters, lParameters);

                if (distributionParametersIds.Count < 5)
                {
                    throw new Exception(Properties.Resources.ExceptionLabelNOTEnoughData);
                }

                PercentageService percentageService = new PercentageService();
                var percentages = percentageService.GetAppropriate(parametersForDefined.A.Length, distributionParametersIds, parametersForDefined.Alpha.Length);

                if (percentages.Count < 5)
                {
                    throw new Exception(Properties.Resources.ExceptionLabelNOTEnoughDataForParameters);
                }

                var valueFromDB = percentages.Average();

                //var percent = PercentFinder.FindPercentOfChange(parametersForDefined, solver, random);
                parametersForDefined.Clear();
                var percent = PercentFinder.SearchMeanPercent(PercentFinder.FindPercentOfChange, parametersForDefined, accuracy, solver, random);

                ExceptionLabel.Content = "";
                var window = new Result(valueFromDB, percent, percentages);
                window.Show();
            }
            catch (Exception ex)
            {
                ExceptionLabel.Content = ex.Message;
            }
        }
コード例 #3
0
        private HttpResponseMessage SavePercentageResult(PercentageResultData percentageResult)
        {
            if (!ModelState.IsValid)
            {
                return(Request.CreateErrorResponse(HttpStatusCode.BadRequest, ModelState));
            }

            PercentageService.SavePercentageResult(WebSecurity.CurrentUserId, percentageResult);
            return(new HttpResponseMessage(HttpStatusCode.OK));
        }
コード例 #4
0
        public HttpResponseMessage Post([FromBody] DipomProjectConsultationMarkData consultationMark)
        {
            if (!ModelState.IsValid)
            {
                return(Request.CreateErrorResponse(HttpStatusCode.BadRequest, ModelState));
            }

            PercentageService.SaveConsultationMark(WebSecurity.CurrentUserId, consultationMark);
            return(new HttpResponseMessage(HttpStatusCode.OK));
        }
コード例 #5
0
 public HttpResponseMessage Post([FromBody] /*DateTime consultationDate, int subject*/ CourseProjectConsultationDateData consultationDate)
 {
     /* if (!ModelState.IsValid)
      * {
      *   return Request.CreateErrorResponse(HttpStatusCode.BadRequest, ModelState);
      * }
      */
     PercentageService.SaveConsultationDate(WebSecurity.CurrentUserId, consultationDate.Day, consultationDate.SubjectId);
     return(new HttpResponseMessage(HttpStatusCode.OK));
 }
コード例 #6
0
        public object Get([System.Web.Http.ModelBinding.ModelBinder] GetPagedListParams parms)
        {
            var subjectId = 0;

            if (parms.Filters.ContainsKey("subjectId"))
            {
                subjectId = int.Parse(parms.Filters["subjectId"]);
            }
            return(new
            {
                Students = CpManagementService.GetGraduateStudentsForUser(WebSecurity.CurrentUserId, subjectId, parms),
                PercentageGraphs = PercentageService.GetPercentageGraphsForLecturerAll(WebSecurity.CurrentUserId, parms)
            });
        }
コード例 #7
0
        public object Get([System.Web.Http.ModelBinding.ModelBinder] GetPagedListParams parms)
        {
            var lecturerId = WebSecurity.CurrentUserId;

            if (parms.Filters.ContainsKey("lecturerId"))
            {
                lecturerId = int.Parse(parms.Filters["lecturerId"]);
            }

            return(new
            {
                Students = DpManagementService.GetGraduateStudentsForUser(lecturerId, parms, false),
                DipomProjectConsultationDates = PercentageService.GetConsultationDatesForUser(lecturerId)
            });
        }
        private void FindPercentButton_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                var accuracy = double.Parse(AccuracyComboBox.Text);
                var random   = new Random();
                var solver   = new ClassLibrary.Logic.Solver();
                //var parametersForDefined = FileProcessing.ReadSolutionForPersistenceTest(_filename);

                (double, double)cParameters  = PercentFinder.GetCsRange(_data.ParametersForDefined);
                (double, double)abParameters = PercentFinder.GetABRange(_data.ParametersForDefined);
                (double, double)lParameters  = PercentFinder.GetLRange(_data.ParametersForDefined);

                DistributionParametersService distributionParameters = new DistributionParametersService();
                var distributionParametersIds = distributionParameters.GetAppropriateIds(
                    cParameters, abParameters, lParameters);
                if (distributionParametersIds.Count < 5)
                {
                    throw new Exception(Properties.Resources.ExceptionLabelNOTEnoughData);
                }

                PercentageService percentageService = new PercentageService();
                var percentages = percentageService.GetAppropriate(_data.ParametersForDefined.A.Length, distributionParametersIds, _data.R);

                if (percentages.Count < 5)
                {
                    throw new Exception(Properties.Resources.ExceptionLabelNOTEnoughDataForParameters);
                }

                var valueFromDB = percentages.Average();

                //var percent = PercentFinder.FindPercentOfChange(parametersForDefined, solver, random);
                _data.ParametersForDefined.Clear();
                var percent = PercentFinder.SearchMeanPercent(PercentFinder.FindPercentOfChange, _data.ParametersForDefined, accuracy, solver, random);

                var window = new Result(valueFromDB, percent, percentages);
                window.Show();
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
コード例 #9
0
 public void Delete(int id)
 {
     PercentageService.DeleteConsultationDate(WebSecurity.CurrentUserId, id);
 }