示例#1
0
        /// <summary>
        /// 更新ReportCard
        /// </summary>
        /// <param name="ReportCard">ReportCard</param>
        public int UpdateReportCard(ReportCard reportCard)
        {
            LogHelper.Info("TestPaperUrl" + reportCard.TestPaperUrl + "");

            int i = ExecuteUpdate("JNyulu.UpdateReportCard", reportCard);

            return(i);
        }
示例#2
0
        public async Task <ActionResult> RenderSignature(string studentId)
        {
            ReportCard student = await Db.ReportCards.FindAsync(studentId);

            byte[] photoBack = student.PrincipalSignature;

            return(File(photoBack, "image/png"));
        }
示例#3
0
        public ActionResult DeleteConfirmed(int id)
        {
            ReportCard reportCard = db.ReportCards.Find(id);

            db.ReportCards.Remove(reportCard);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
示例#4
0
        // Deletes Report Card in database by id
        public async Task <bool> DeleteReport(int reportId)
        {
            ReportCard outcome = await _context.ReportCards.Where(x => x.ReportCardId == reportId).FirstAsync();

            _context.ReportCards.Remove(outcome);
            var saveResult = await _context.SaveChangesAsync();

            return(saveResult == 1);
        }
示例#5
0
        public async Task <ActionResult> DeleteConfirmed(int id)
        {
            ReportCard reportCard = await Db.ReportCards.FindAsync(id);

            Db.ReportCards.Remove(reportCard);
            await Db.SaveChangesAsync();

            return(RedirectToAction("Index"));
        }
        public async Task <IActionResult> Edit(ReportCard editedReportCard, string returnUrl)
        {
            var successful = await _reportCardService.ApplyEditReportCard(editedReportCard);

            if (!successful)
            {
                return(BadRequest("Could not edit report card."));
            }

            return(RedirectToAction("View", "ReportCard", new { editedReportCard.Student.StudentId, returnUrl }));
        }
        public async Task <IActionResult> Add(ReportCard newReportCard, string returnUrl)
        {
            var successful = await _reportCardService.SubmitNewReportCard(newReportCard);

            if (!successful)
            {
                return(BadRequest("Could not add report card."));
            }

            return(RedirectToAction("View", "ReportCard", new { newReportCard.Student.StudentId, returnUrl }));
        }
示例#8
0
        private IList <CustomReportCardsExportModel> BuildReportCardsData(ReportCard inowData, string logoAddress, ReportCardsInputModel inputModel)
        {
            var res         = new List <CustomReportCardsExportModel>();
            var currentDate = ServiceLocator.Context.NowSchoolTime;

            foreach (var student in inowData.Students)
            {
                res.AddRange(student.Recipients.Select(recipient => CustomReportCardsExportModel.Create(inowData, student, recipient, logoAddress, currentDate, inputModel)));
            }
            return(res);
        }
示例#9
0
        public ReportCardViewModel(ReportCard reportCard)
        {
            Warnings = reportCard.Warnings;
            Errors   = reportCard.Errors;

            Cancel = Command.Create(() =>
            {
                Result = false;
                ((IDeactivate)this).Deactivate(true);
            });
        }
        public bool ShowActionReport(ReportCard reportcard, string title, string errorsMessage = "", string warningsMessage = "")
        {
            var messageBox = reportCardViewModelFactory(reportcard);

            messageBox.Title           = title;
            messageBox.ErrorsMessage   = errorsMessage;
            messageBox.WarningsMessage = warningsMessage;
            var result = ShowOverlayDialog(messageBox);

            return(result ?? false);
        }
示例#11
0
 public ActionResult Edit([Bind(Include = "Id,StudentPts,UserId,AssignmentsId,HasBeenGraded")] ReportCard reportCard)
 {
     if (ModelState.IsValid)
     {
         db.Entry(reportCard).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     ViewBag.AssignmentsId = new SelectList(db.Assignments, "Id", "AssignmentName", reportCard.AssignmentsId);
     ViewBag.UserId        = new SelectList(db.Peoples, "Id", "FirstName", reportCard.UserId);
     return(View(reportCard));
 }
        public async Task <IActionResult> PostReportCard([FromBody] ReportCard reportCard)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            _context.ReportCard.Add(reportCard);
            await _context.SaveChangesAsync();

            return(CreatedAtAction("GetReportCard", new { id = reportCard.AutoId }, reportCard));
        }
示例#13
0
        public void TestOfficialXlsx()
        {
            ReportCardModel model = new ReportCardModel()
            {
                SettingParameters = new SettingParameters()
                {
                    TabelNumber = "7751-00-548", Year = 2021, IdDepartment = 8,
                    Type        = new Type()
                    {
                        IdType = 1, NameType = "Полный"
                    },
                    View = new View()
                    {
                        IdView = 0, NameView = "Первичный"
                    },
                    Mouth = new Mouth()
                    {
                        NumberMouthString = "09", NameMouth = "Сентябрь", NumberMouth = 9
                    }
                }
            };
            SqlConnectionType sql          = new SqlConnectionType();
            SelectImns        selectFrames = new SelectImns();
            XmlReadOrWrite    xml          = new XmlReadOrWrite();
            SelectSql         select       = new SelectSql();

            select.SelectCardModelLeader(ref model);
            var command        = string.Format(selectFrames.UserReportCard, model.SettingParameters.LeaderD.NameDepartment, $"{model.SettingParameters.Year}-{model.SettingParameters.Mouth.NumberMouthString}-01");
            var userReportCard = sql.XmlString("Data Source=i7751-app020;Initial Catalog=imns51;Integrated Security=True;MultipleActiveResultSets=True", command);

            userReportCard = string.Concat("<SettingParameters>", userReportCard, "</SettingParameters>");
            model.SettingParameters.UsersReportCard = ((SettingParameters)xml.ReadXmlText(userReportCard, typeof(SettingParameters))).UsersReportCard;
            foreach (var usersReportCard in model.SettingParameters.UsersReportCard)
            {
                var commandVacation = string.Format(selectFrames.ItemVacationNew, usersReportCard.Tab_num, $"{model.SettingParameters.Year}", $"{model.SettingParameters.Year}");
                var userVacation    = sql.XmlString("Data Source=i7751-app020;Initial Catalog=imns51;Integrated Security=True;MultipleActiveResultSets=True", commandVacation);
                userVacation = string.Concat("<UsersReportCard>", userVacation, "</UsersReportCard>");
                usersReportCard.ItemVacation = ((UsersReportCard)xml.ReadXmlText(userVacation, typeof(UsersReportCard))).ItemVacation;
                var commandDisability = string.Format(selectFrames.Disability, usersReportCard.Tab_num, $"{model.SettingParameters.Year}");
                var userDisability    = sql.XmlString("Data Source=i7751-app020;Initial Catalog=imns51;Integrated Security=True;MultipleActiveResultSets=True", commandDisability);
                userDisability             = string.Concat("<UsersReportCard>", userDisability, "</UsersReportCard>");
                usersReportCard.Disability = ((UsersReportCard)xml.ReadXmlText(userDisability, typeof(UsersReportCard))).Disability;
                var commandBusiness = string.Format(selectFrames.Business, usersReportCard.Tab_num, $"{model.SettingParameters.Year}");
                var userBusiness    = sql.XmlString("Data Source=i7751-app020;Initial Catalog=imns51;Integrated Security=True;MultipleActiveResultSets=True", commandBusiness);
                userBusiness             = string.Concat("<UsersReportCard>", userBusiness, "</UsersReportCard>");
                usersReportCard.Business = ((UsersReportCard)xml.ReadXmlText(userBusiness, typeof(UsersReportCard))).Business;
            }
            ReportCard report = new ReportCard();

            report.CreateDocument("D:\\Testing\\", model);
        }
示例#14
0
        public void ReportCard_Standing()
        {
            // Arrange
            var expectedStanding = STANDING.SumaCumLaude;

            // Act
            var reportCard = new ReportCard
            {
                Average = 95
            };

            // Assert
            Assert.AreEqual(expectedStanding, reportCard.Standing);
        }
示例#15
0
        // GET: ReportCards/Delete/5
        public ActionResult Delete(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            ReportCard reportCard = db.ReportCards.Find(id);

            if (reportCard == null)
            {
                return(HttpNotFound());
            }
            return(View(reportCard));
        }
示例#16
0
        // GET: ReportCards/Details/5
        public async Task <ActionResult> Details(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            ReportCard reportCard = await Db.ReportCards.FindAsync(id);

            if (reportCard == null)
            {
                return(HttpNotFound());
            }
            return(View(reportCard));
        }
示例#17
0
        public ActionResult SubmitGrade([Bind(Include = "Id,StudentPts,MaxPts,UserId,AssignmentsId")] ReportCard reportCard)
        {
            reportCard.HasBeenGraded = true;
            if (ModelState.IsValid)
            {
                db.Entry(reportCard).State = EntityState.Modified;
                db.SaveChanges();

                return(RedirectToAction("FindClassForAssignments"));
            }
            ViewBag.AssignmentId = new SelectList(db.Assignments, "Id", "AssignmentName", reportCard.AssignmentsId);
            ViewBag.UserId       = new SelectList(db.Peoples, "Id", "FirstName", reportCard.UserId);
            return(RedirectToAction("FindClassForAssignments"));
            //return View(reportCard);
        }
示例#18
0
        /// <summary>
        /// 插入ReportCard
        /// </summary>
        /// <param name="ReportCard">ReportCard</param>
        public int InsertReportCard(ReportCard reportCard)
        {
            Hashtable _map = new Hashtable();

            _map.Add("EmployeeID", reportCard.EmployeeID);
            _map.Add("STID", reportCard.STID);
            _map.Add("ExamDate", reportCard.ExamDate);
            _map.Add("TestPaperUrl", reportCard.TestPaperUrl);

            _map.Add("ID", reportCard.ID);

            reportCard.ID = (int)ExecuteInsert("JNyulu.InsertReportCard", _map);

            return(reportCard.ID);
        }
示例#19
0
        // GET: ReportCards/Edit/5
        public ActionResult Edit(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            ReportCard reportCard = db.ReportCards.Find(id);

            if (reportCard == null)
            {
                return(HttpNotFound());
            }
            ViewBag.AssignmentsId = new SelectList(db.Assignments, "Id", "AssignmentName", reportCard.AssignmentsId);
            ViewBag.UserId        = new SelectList(db.Peoples, "Id", "FirstName", reportCard.UserId);
            return(View(reportCard));
        }
示例#20
0
        /// <summary>
        /// 插入ReportCard
        /// </summary>
        /// <param name="reportCard">ReportCard</param>
        public int InsertReportCard(ReportCard reportCard)
        {
            int _id = -1;

            try
            {
                //_daoManager.BeginTransaction();
                _id = _reportCardDao.InsertReportCard(reportCard);
                //_daoManager.CommitTransaction();
            }
            catch (Exception ex)
            {
                //_daoManager.RollBackTransaction();
                throw ex;
            }
            return(_id);
        }
示例#21
0
        // Puts new report card into database
        public async Task <bool> SubmitNewReportCard(ReportCard newReportCard)
        {
            //gets the student the report card is for from the database
            Student student = await _context.Students.Where(x => x.StudentId == newReportCard.Student.StudentId).FirstAsync();

            newReportCard.Student = student;
            await _context.ReportCards.AddAsync(newReportCard);

            //adds report to the student
            student.ReportCards.Add(newReportCard);

            //updates student in database
            _context.Entry(await _context.Students.FirstAsync(x => x.StudentId == student.StudentId)).CurrentValues.SetValues(student);

            var saveResult = await _context.SaveChangesAsync();

            return(saveResult == 1);
        }
        private void OnCreateAllReports(object sender, RoutedEventArgs e)
        {
            if (!UserViewModel.CurrentUser.CanExportReportCards)
            {
                MessageBox.Show("You do not have permission to export report cards!");
                return;
            }

            var dialog = new WPFFolderBrowser.WPFFolderBrowserDialog("Pick a folder to save all the report cards");
            var result = dialog.ShowDialog();

            if (result.HasValue && result.Value)
            {
                var grades   = (List <StudentByClass>)grd.ItemsSource;
                var students = grades.Select(g => {
                    var student = _gradebook.Students.FirstOrDefault(s => s.Name.Equals(g.StudentName, StringComparison.OrdinalIgnoreCase));
                    if (!String.IsNullOrEmpty(g.LetterGrade))
                    {
                        return(student);
                    }
                    return(null);
                });

                int notExported = 0, exported = 0;
                foreach (var student in students)
                {
                    if (student != null)
                    {
                        var report   = new ReportCard(student);
                        var filename = System.IO.Path.Combine(dialog.FileName, report.GetDefaultReportCardFilename(MarkingPeriod.Current.Key) + ".pdf");
                        report.CreateReportCard(filename, MarkingPeriod.Current);
                        exported++;
                    }
                    else
                    {
                        notExported++;
                    }
                }
                if (notExported > 0)
                {
                    MessageBox.Show(notExported + " student(s) could not be exported because they had no grade set!\n\n" + exported + " student(s) were successfully written.");
                }
            }
        }
示例#23
0
        private void LoadFromModel(ReportCard model)
        {
            StudentId       = model.StudentId;
            BehaviourTypeId = model.BehaviourTypeId;
            StartDate       = model.StartDate;
            EndDate         = model.EndDate;
            Comments        = model.Comments;
            Active          = model.Active;

            if (model.Student != null)
            {
                Student = new StudentModel(model.Student);
            }

            if (model.BehaviourType != null)
            {
                BehaviourType = new IncidentTypeModel(model.BehaviourType);
            }
        }
示例#24
0
 public IActionResult Get(int reportCardId)
 {
     try
     {
         ReportCard reportCard = _reportCardRepository.GetReportCardById(reportCardId);
         if (reportCard == null)
         {
             return(NotFound());
         }
         // IEnumerable<OrderItemViewModel> orderItemViewModel = _mapper.Map<IEnumerable<OrderItem>, IEnumerable<OrderItemViewModel>>(reportCard.Items);
         // return Ok(orderItemViewModel);
         return(Ok(reportCard));
     }
     catch (Exception e)
     {
         _logger.LogError($"Failed to fetch Items: {e}");
         return(BadRequest());
     }
 }
示例#25
0
        public void TestGetReportCard()
        {
            // Define variables
            Dictionary <string, List <object> > serviceData = new Dictionary <string, List <object> >()
            {
                { "courses", _testCourseData.ToList <object>() },
                { "assignments", _testAssignmentData.ToList <object>() },
                { "lettergradescales", _testLetterGradeScaleData.ToList <object>() }
            };
            BaseGradeService service = new BaseGradeService(serviceData);

            // Run test
            ReportCard card = service.GetReportCard(
                DateTime.Parse("1/1/2020"),
                DateTime.Parse("1/1/2020") + new TimeSpan(7 * 9, 0, 0, 0));

            // Assertions
            Assert.AreEqual(1, card.Assignments.Count);
        }
示例#26
0
        /// <summary>
        /// 删除Employee
        /// </summary>
        /// <param name="id">自增型ID</param>
        public int DeleteEmployeeByID(int id)
        {
            Registration _registration = new Registration();

            _registration.EmployeeID = id;
            IList <Registration> _registrationList = _registrationService.GetBaseRegistration(_registration);

            foreach (Registration Registration in _registrationList)
            {
                _registrationService.DeleteRegistrationByID(Registration.ID);
            }

            ReportCard _reportCard = new ReportCard();

            _reportCard.EmployeeID = id;
            IList <ReportCard> _reportCardList = _reportCardService.GetBaseReportCard(_reportCard);

            foreach (ReportCard reportCard in _reportCardList)
            {
                _reportCardService.DeleteReportCardByID(reportCard.ID);
            }

            Assessment _assessment = new Assessment();

            _assessment.EmployeeID = id;
            IList <Assessment> _assessmentList = _assessmentService.GetBaseAssessment(_assessment);

            foreach (Assessment studentAssessment in _assessmentList)
            {
                _assessmentService.DeleteAssessmentByID(studentAssessment.ID);
            }

            int[] _userID = new int[] { id };
            IList <DeviceToken> _deviceTokenList = _deviceTokenService.GetDeviceToken(string.Empty, string.Empty, _userID);

            foreach (DeviceToken deviceTokenRegisterInfo in _deviceTokenList)
            {
                _deviceTokenService.DeleteDeviceTokenByID(deviceTokenRegisterInfo.ID);
            }

            return(_employeeDao.DeleteEmployeeByID(id));
        }
示例#27
0
        public static CustomReportCardsExportModel Create(ReportCard reportCard, Student studentData, ReportCardAddressData recipient, string logoRef, DateTime reportDate
                                                          , ReportCardsInputModel inputModel)
        {
            var res = new CustomReportCardsExportModel
            {
                AcadYear        = reportCard.AcadYear,
                LogoHref        = logoRef,
                AcadSessionName = reportCard.AcadSessionName,
                ReportDate      = reportDate.ToString("M/dd/yyyy hh:mm:ss tt", CultureInfo.InvariantCulture),
                CopyRight       = $"Copyright (c) {DateTime.Now.Year} Chalkable",
                School          = new SchoolReportCardsExportModel
                {
                    Address1 = reportCard.School.Address1,
                    Address2 = reportCard.School.Address2,
                    City     = reportCard.School.City,
                    Name     = reportCard.School.Name,
                    Phone    = FormatSchoolPhone(reportCard.School.Phone),
                    State    = reportCard.School.State,
                    Zip      = reportCard.School.Zip
                },
                Student                  = StudentReportCardsExportModel.Create(reportCard.GradingPeriod, studentData, recipient, inputModel.IncludeGradedStandardsOnly, inputModel.IncludeComments),
                IncludeSignature         = inputModel.IncludeParentSignature,
                RecipientType            = inputModel.RecipientType,
                IncludeMeritDemerit      = inputModel.IncludeMeritDemerit,
                TraditionalGradingScales = new List <GradingScaleExportModel <TraditionalGradingScaleRangeExportModel> >(),
                StandardsGradingScales   = new List <GradingScaleExportModel <StandardsGradingScaleRangeExportModel> >(),
                IdToPrint                = inputModel.IdToPrint != 0 // 0 - this is NONE option on ui.
            };

            if (inputModel.IncludeGradingScaleTraditional)
            {
                res.TraditionalGradingScales = GradingScaleExportModel <TraditionalGradingScaleRangeExportModel> .Create(reportCard.GradingScales,
                                                                                                                         studentData.Sections, s => s.GradingScaleId, TraditionalGradingScaleRangeExportModel.Create);
            }
            if (inputModel.IncludeGradingScaleStandards)
            {
                res.StandardsGradingScales = GradingScaleExportModel <StandardsGradingScaleRangeExportModel> .Create(reportCard.GradingScales,
                                                                                                                     studentData.Sections, s => s.StandardGradingScaleId, StandardsGradingScaleRangeExportModel.Create);
            }
            return(res);
        }
示例#28
0
        async Task UpgradeServiceControlInstance(InstanceDetailsViewModel model, ServiceControlInstance instance, ServiceControlUpgradeOptions upgradeOptions)
        {
            using (var progress = model.GetProgressObject($"UPGRADING {model.Name}"))
            {
                var reportCard   = new ReportCard();
                var restartAgain = model.IsRunning;

                var stopped = await model.StopService(progress);

                if (!stopped)
                {
                    eventAggregator.PublishOnUIThread(new RefreshInstances());

                    reportCard.Errors.Add("Failed to stop the service");
                    reportCard.SetStatus();
                    windowManager.ShowActionReport(reportCard, "ISSUES UPGRADING INSTANCE", "Could not upgrade instance because of the following errors:");

                    return;
                }

                reportCard = await Task.Run(() => serviceControlInstaller.Upgrade(instance, upgradeOptions, progress));

                if (reportCard.HasErrors || reportCard.HasWarnings)
                {
                    windowManager.ShowActionReport(reportCard, "ISSUES UPGRADING INSTANCE", "Could not upgrade instance because of the following errors:", "There were some warnings while upgrading the instance:");
                }
                else
                {
                    if (restartAgain)
                    {
                        var serviceStarted = await model.StartService(progress);

                        if (!serviceStarted)
                        {
                            reportCard.Errors.Add("The Service failed to start. Please consult the ServiceControl logs for this instance");
                            windowManager.ShowActionReport(reportCard, "UPGRADE FAILURE", "Instance reported this error after upgrade:");
                        }
                    }
                }
            }
        }
示例#29
0
        public void ShowGoodGpaIndicator()
        {
            // Arrange
            Student janice = new Student()
            {
                FirstName = "Janice",
                LastName  = "Zoomer",
                DOB       = new DateTime(2007, 8, 10),
                Grades    = new List <decimal> {
                    3, 3.6m, 4, 4
                }
            };

            ReportCard reportCard = new ReportCard(janice);

            // Act
            string heading = reportCard.GenerateHeading();

            // Assert
            Assert.IsTrue(heading.EndsWith("***"));
        }
示例#30
0
        /// <summary>
        /// Creates or updates resources based on the natural key values of the supplied resource. The POST operation can be used to create or update resources. In database terms, this is often referred to as an &quot;upsert&quot; operation (insert + update).  Clients should NOT include the resource &quot;id&quot; in the JSON body because it will result in an error (you must use a PUT operation to update a resource by &quot;id&quot;). The web service will identify whether the resource already exists based on the natural key values provided, and update or create the resource appropriately.
        /// </summary>
        /// <param name="body">The JSON representation of the &quot;reportCard&quot; resource to be created or updated.</param>
        /// <returns>A RestSharp <see cref="IRestResponse"/> instance containing the API response details.</returns>
        public IRestResponse PostReportCards(ReportCard body)
        {
            var request = new RestRequest("/reportCards", Method.POST);

            request.RequestFormat = DataFormat.Json;

            // verify required params are set
            if (body == null)
            {
                throw new ArgumentException("API method call is missing required parameters");
            }
            request.AddBody(body);
            var response = client.Execute(request);

            var location = response.Headers.FirstOrDefault(x => x.Name == "Location");

            if (location != null && !string.IsNullOrWhiteSpace(location.Value.ToString()))
            {
                body.id = location.Value.ToString().Split('/').Last();
            }
            return(response);
        }
 private void OnGenerateReportCard(object sender, RoutedEventArgs e)
 {
     if (!UserViewModel.CurrentUser.CanExportReportCards)
     {
         MessageBox.Show("You do not have permission to export a report card!");
         return;
     }
     var report = (StudentReport) grdStudentReport.SelectedItem;
     MarkingPeriod mp = MarkingPeriod.Current;
     if (report != null)
         mp = MarkingPeriods.Singleton.Find(MarkingPeriodKey.Parse(report.Quarter));
     try
     {
         var reportCard = new ReportCard(_student);
         reportCard.CreateReportCard(null, mp);
     }
     catch (System.IO.IOException)
     {
         MessageBox.Show("Error writing the report card! Check to ensure you have permission to write to this folder and that the file is not currently in use.");
     }
 }