示例#1
0
        public async Task <ActionResult> CreateEvent(EventViewModel model)
        {
            var helper = new StudentHelper();

            var upsert = await helper.UpsertEvent(UpsertMode.Admin, model);

            if (upsert.i_RecordId() > 0)
            {
                if (model.IsEmpty())
                {
                    model.EventId = upsert.i_RecordId();

                    return(View("Event", model));
                }
                else
                {
                    ShowSuccess(upsert.ErrorMsg);
                }
            }
            else
            {
                ShowError(upsert.ErrorMsg);
            }

            return(RedirectToAction("Index"));
        }
        private string GetAuthenticatedUserNetname()
        {
            var firstName = User.FindFirstValue(ClaimTypes.GivenName);
            var lastName  = User.FindFirstValue(ClaimTypes.Surname);

            return(StudentHelper.GenerateNetName(firstName, lastName));
        }
        public void FindPendingPicture()
        {
            const string name     = "testFirst";
            const string lastName = "testLast";


            var netname = StudentHelper.GenerateNetName(name, lastName);

            var users = new List <STUDENT>()
            {
                new STUDENT
                {
                    NETNAME     = netname,
                    ID          = 21941097,
                    FIRSTNAME   = name,
                    LASTNAME    = lastName,
                    DOB         = DateTime.UtcNow,
                    UGRADSTATUS = "U"
                },
                new STUDENT
                {
                    NETNAME     = "test",
                    ID          = 11941097,
                    FIRSTNAME   = name,
                    LASTNAME    = lastName,
                    DOB         = DateTime.UtcNow,
                    UGRADSTATUS = "U"
                },
            };

            _mySetStudent.Object.AddRange(users);
            ConnectMocksToDataStore(users);



            var pictures = new List <PICTURE>()
            {
                new PICTURE
                {
                    PICTURE_DATA    = null,
                    STUDENT_NETNAME = netname,
                    STATUS          = Status.Approved.ToString(),
                    CREATED         = new DateTime(1989, 11, 06)
                }, new PICTURE
                {
                    PICTURE_DATA    = null,
                    STUDENT_NETNAME = "test",
                    STATUS          = Status.Approved.ToString(),
                    CREATED         = new DateTime(1989, 11, 06)
                },
            };

            _mySetPicture.Object.AddRange(pictures);
            ConnectPictureMocksToDataStore(pictures);


            var picture = _picture.FindPendingPicture(21941097);

            Assert.Equal(Status.Approved.ToString(), picture.STATUS);
        }
示例#4
0
        /// <summary>
        /// POST: api/Messages
        /// Receive a message from a user and reply to it
        /// </summary>
        public async Task <HttpResponseMessage> Post([FromBody] Activity activity)
        {
            if (activity.Type == ActivityTypes.Message)
            {
                var connector = new ConnectorClient(new Uri(activity.ServiceUrl));
                var state     = activity.GetStateClient();
                var userData  = await state.BotState.GetUserDataAsync(activity.ChannelId, activity.From.Id);

                var user = userData.GetProperty <StudentHelper>("profile");
                if (user != null)
                {
                    _sh = user;
                }

                _bot.DefaultPredicates.updateSetting("name", _sh.Name);
                _bot.DefaultPredicates.updateSetting("course", _sh.Course);
                _bot.DefaultPredicates.updateSetting("group", _sh.Group);

                var text = await Reply(activity.Text);

                var reply = activity.CreateReply(text);
                userData.SetProperty("profile", _sh);
                await state.BotState.SetUserDataAsync(activity.ChannelId, activity.From.Id, userData);

                await connector.Conversations.ReplyToActivityAsync(reply);
            }
            else
            {
                HandleSystemMessage(activity);
            }
            var response = Request.CreateResponse(HttpStatusCode.OK);

            return(response);
        }
        public void FindById()
        {
            const string name     = "testFirst";
            const string lastName = "testLast";


            var users = new List <STUDENT>()
            {
                new STUDENT
                {
                    NETNAME     = StudentHelper.GenerateNetName(name, lastName),
                    ID          = 21941097,
                    FIRSTNAME   = name,
                    LASTNAME    = lastName,
                    DOB         = DateTime.UtcNow,
                    UGRADSTATUS = "U"
                }
            };


            _mySetStudent.Object.AddRange(users);

            ConnectMocksToDataStore(users);


            var student = _repo.FindByIdAsync(21941097).Result;

            Assert.Equal(21941097, student.Id);
            Assert.Equal("testFirst", student.FirstName);
        }
示例#6
0
        public void When_creating_a_student_should_not_leave_any_tracked_components()
        {
            using (var startup = new OwinStartup(DatabaseName, _localEducationAgencyIds))
            {
                var trackedComponents     = startup.GetTrackedComponents();
                int trackedComponentCount = trackedComponents.Count();
                trackedComponentCount.ShouldBe(0);

                using (var server = TestServer.Create(startup.Configuration))
                {
                    using (var client = new HttpClient(server.Handler))
                    {
                        client.Timeout = DefaultHttpClientTimeout;

                        client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue(
                            "Bearer",
                            Guid.NewGuid()
                            .ToString());

                        var createResponse = StudentHelper.CreateStudent(client, DataSeedHelper.RandomName, DataSeedHelper.RandomName);
                        createResponse.ResponseMessage.EnsureSuccessStatusCode();
                        createResponse.ResponseMessage.StatusCode.ShouldBe(HttpStatusCode.Created);
                    }

                    trackedComponents     = startup.GetTrackedComponents();
                    trackedComponentCount = trackedComponents.Count();

                    trackedComponentCount.ShouldBe(
                        0,
                        "Tracked Components: " + string.Join(", ", trackedComponents.Select(tc => tc.Key.ToString())));
                }
            }
        }
示例#7
0
 /// <summary>
 /// Reloads the data grid view when the search bar is empty.
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void txtSearch_TextChanged(object sender, EventArgs e)
 {
     if (string.IsNullOrEmpty(txtSearch.Text))
     {
         StudentHelper.LoadStudents(dgvStudents);
     }
 }
示例#8
0
 protected void btnCheck_Click(object sender, EventArgs e)
 {
     if (txtNum.Text.Length == 0)
     {
         Response.Write(JSHelper.ShowAlert("输入不能为空!"));
     }
     else
     {
         var user = UserHelper.Select(txtNum.Text);
         if (user == null)
         {
             lblName.Text = "不存在该老师或学生<br/>";
         }
         else
         {
             var teac = TeacherHelper.Select(user.UserID);
             if (teac != null)
             {
                 lblName.Text = teac.Name;
             }
             else
             {
                 var stu = StudentHelper.Select(user.UserID);
                 if (stu != null)
                 {
                     lblName.Text = stu.Name;
                 }
                 else
                 {
                     lblName.Text = "不存在该老师或学生<br/>";
                 }
             }
         }
     }
 }
示例#9
0
        public ActionResult ChangeFees(string gender, string roomType1)
        {
            StudentHelper     helper  = new StudentHelper();
            TransactionHelper tHelper = new TransactionHelper();

            // populate the room type list such that the appropriate option is selected
            try
            {
                int roomTypeID = helper.GetRoomTypes().Where(y => y.val.Equals(roomType1)).First().id;
                ViewBag.roomTypeList = new SelectList(db.RoomTypes.ToList(), "id", "val", roomTypeID);
            }
            catch (InvalidOperationException)
            {
                ViewBag.roomTypeList = new SelectList(db.RoomTypes, "id", "val");
            }

            // populate the gender list such that the appropriate option is selected
            try
            {
                int genId = helper.GetGenders().Where(x => x.val.Equals(gender)).First().id;
                ViewBag.hostelTypeList = new SelectList(db.Genders.ToList(), "id", "val", genId);
            }
            catch (InvalidOperationException)
            {
                ViewBag.hostelTypeList = new SelectList(db.Genders, "id", "val");
            }

            // add the mess charges to the model
            ViewBag.messChargesModel  = tHelper.ConstructViewModelForMessFeeChange();
            TempData["canChangeMess"] = tHelper.CanChangeMessFees();

            return(View());
        }
示例#10
0
        public DTO.LABURNUM.COM.StudentModel ParentStudentLogin(DTO.LABURNUM.COM.StudentModel model)
        {
            if (new FrontEndApi.ApiClientApi().IsClientValid(model.ApiClientModel.UserName, model.ApiClientModel.Password))
            {
                DTO.LABURNUM.COM.StudentModel studentmodel = new DTO.LABURNUM.COM.StudentModel();
                long studentId;
                if (model.IsStudentLogin)
                {
                    studentId = new FrontEndApi.StudentApi().IsStudentValid(model.StudentUserName, model.StudentPassword);
                }
                else
                {
                    studentId = new FrontEndApi.StudentApi().IsParentValid(model.ParentUserName, model.ParentPassword);
                }

                if (studentId > 0)
                {
                    studentmodel = new StudentHelper(new FrontEndApi.StudentApi().GetStudentByStudentId(studentId)).MapSingle();
                }
                return(studentmodel);
            }
            else
            {
                return(null);
            }
        }
示例#11
0
 /// <summary>
 /// Populates the id combo box based on the name picked from the student name combo box.
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void cmbStudentName_SelectedIndexChanged(object sender, EventArgs e)
 {
     if (cmbStudentName.SelectedIndex > -1)
     {
         StudentHelper.LoadIds(cmbStudentName.SelectedItem.ToString(), cmbId);
     }
 }
示例#12
0
 //public async Task<IActionResult> Index(string sortOrder)
 public IActionResult Index(string sortByProp, string sortDir, int PageNo = 1)
 {
     using (StudentHelper helper = new StudentHelper())
     {
         var list = helper.GetList(PageNo, sortByProp, sortDir);
         ViewBag.PageNo     = PageNo;
         ViewBag.SortDir    = ((string.IsNullOrEmpty(sortDir) || sortDir == "DESC") ? "ASC" : "DESC");
         ViewBag.sortByProp = sortByProp;
         int MaxPageNo = 1;
         if (list.TotalRecords > 0)
         {
             if (list.TotalRecords % Startup.PageSize == 0)
             {
                 MaxPageNo = list.TotalRecords / Startup.PageSize;
             }
             else
             {
                 MaxPageNo = (list.TotalRecords / Startup.PageSize) + 1;
             }
         }
         ViewData["MaxPageNo"]    = MaxPageNo;
         ViewData["TotalRecords"] = list.TotalRecords;
         return(View(list.lstStudentModel));
     }
 }
示例#13
0
 /// <summary>
 ///Loads active books into the data grid view.
 ///Load selected student ids into the id combo box.
 ///Loads student names in the student name combo box.
 ///Sets the due date to 10 days from today.
 ///Initializes the id combo box to index -1.
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void IssueBook_Load(object sender, EventArgs e)
 {
     BookHelper.LoadActive(dgvIssueBook);
     StudentHelper.LoadNames(cmbStudentName);
     cmbId.SelectedIndex = -1;
     dtpDueDate.Value    = dtpDueDate.Value.AddDays(10);
 }
        /// <summary>
        /// Action method to change the room
        /// </summary>
        /// <param name="userInput">the form filled by the user</param>
        /// <returns></returns>
        public ActionResult ChangeRoomAllotment(ChangeRoomViewModel userInput)
        {
            // get the student, current allotment and room
            string        bid    = (string)TempData.Peek("bid");
            StudentHelper helper = new StudentHelper();

            return(Content(helper.PerformRoomChange(userInput, bid)));
        }
示例#15
0
        private void btnGenerateJGKZ_Click(object sender, EventArgs e)
        {
            Console.WriteLine("Generating JGKZ for " + _StudentList.Count + " students...");
            List <String> classList = StudentHelper.getJGKZsForStudents(_StudentList);

            Console.WriteLine("JGKZ generated successfully");
            ConsoleHelper.OutputStr(_StudentList, classList);
        }
示例#16
0
        private StudentHelper GetHelper(Student Student)
        {
            var helper = new StudentHelper(Student);

            helper.ServiceUserId = GetUserId();

            return(helper);
        }
示例#17
0
        private StudentHelper GetHelper(int StudentId)
        {
            StudentHelper helper = new StudentHelper(StudentId);

            helper.ServiceUserId = GetUserId();

            return(helper);
        }
示例#18
0
        /// <summary>
        /// Action method to display the form to add a hostel
        /// </summary>
        /// <returns>a view</returns>
        public ActionResult AddHostel()
        {
            StudentHelper helper = new StudentHelper();

            ViewBag.genderList = new SelectList(helper.GetGenders(), "id", "val");

            return(View());
        }
示例#19
0
        public ActionResult AddHostel(AddHostelViewModel userInput)
        {
            StudentHelper        helper  = new StudentHelper();
            InfrastructureHelper helper1 = new InfrastructureHelper();

            ViewBag.genderList = new SelectList(helper.GetGenders(), "id", "val");

            return(Json(helper1.AddHostel(userInput), JsonRequestBehavior.AllowGet));
        }
示例#20
0
        private static Student AddStudentWithParamsInConstructor()
        {
            Console.WriteLine("Complete los siguientes datos para el próximo estudiante: (Constructor con params)");
            var name     = SchoolHelper.GetStringToEvaluate(StudentName);
            var lastName = SchoolHelper.GetStringToEvaluate(StudentLastname);
            var sex      = StudentHelper.GetSexToEvaluate(StudentSex);
            var age      = StudentHelper.GetAgeToEvaluate(StudentAge);

            return(new Student(name, lastName, sex, age));
        }
示例#21
0
        private void btnShowClasses_Click(object sender, EventArgs e)
        {
            List <String> classList = new List <string>();

            classList = StudentHelper.getCurrentClasses(_StudentList);
            Console.WriteLine("The following " + classList.Count + " class(es) exist this year:");
            ConsoleHelper.OutputStr(classList);

            Console.WriteLine();
        }
        public ActionResult AllocateFirstYear()
        {
            TeacherToRoom assignExam = new TeacherToRoom();
            StudentHelper stud       = new StudentHelper();

            stud.Allot();
            assignExam.Index();
            TempData["notice"] = "Success!";
            return(RedirectToAction("Index"));
        }
示例#23
0
 public EnrollmentsController(PruebaContext context,
                              StudentHelper Helper,
                              CourseHelper CourseHelper,
                              QualificationHelper QualificationHelper)
 {
     _context             = context;
     _studentHelper       = Helper;
     _courseHelper        = CourseHelper;
     _QualificationHelper = QualificationHelper;
 }
示例#24
0
        public async Task <ActionResult> Index(SearchStudentsModel search, string method, int page = 1)
        {
            // Return all Students
            // If not a post-back (i.e. initial load) set the searchModel to session
            if (Request.Form.Count <= 0)
            {
                if (search.IsEmpty() && Session["SearchStudentsModel"] != null)
                {
                    search = (SearchStudentsModel)Session["SearchStudentsModel"];
                }
            }

            var helper = new StudentHelper();

            var model = helper.GetStudentList(search, search.ParsePage(page));

            Session["SearchStudentsModel"] = search;

            if (method == "Event")
            {
                if (model.Students.Count() <= 0)
                {
                    ShowError("Unfortunately, No students found to generate Event For");
                    return(RedirectToAction("Index"));
                }

                var eventModel = new EventViewModel()
                {
                    //Data = model.Students.Where(m => !m.NoParents).Select(m => m.StudentId).ToArray()
                    Students = model.Students.ToList().Where(m => !m.NoParents).ToList()
                };

                return(await CreateEvent(eventModel));
            }

            if (method == "Report")
            {
                if (model.Students.Count() <= 0)
                {
                    ShowError("Unfortunately, No pupils found to generate Report From");
                    return(RedirectToAction("Index"));
                }

                var reportModel = new ReportModel()
                {
                    Students = model.Records.ToList()
                };

                return(CreatePDF(reportModel));
            }

            ParseSearchDefaults(search);

            return(View(model));
        }
        public ActionResult GenerateReport(string reportType)
        {
            StudentHelper     studentHelper     = new StudentHelper();
            TransactionHelper transactionHelper = new TransactionHelper();

            // save the report type for later use
            TempData["queryField"] = reportType;

            // switch based on report type
            switch (reportType)
            {
            case "1":
                return(PartialView("_ReportByBID"));

            case "2":
                ViewBag.dataList = new SelectList(studentHelper.GetGenders(), "id", "val");
                return(PartialView("_ReportByDropDown"));

            case "3":
                // generate a list for the semesters
                List <SelectListItem> temp = new List <SelectListItem>();
                for (int i = 1; i <= 8; i++)
                {
                    temp.Add(new SelectListItem {
                        Text = i + "", Value = i + ""
                    });
                }
                ViewBag.dataList = new SelectList(temp, "Value", "Text");

                return(PartialView("_ReportByDropDown"));

            case "4":
                ViewBag.dataList = new SelectList(studentHelper.GetCourses(), "id", "val");

                return(PartialView("_ReportByDropDown"));

            case "5":
                return(PartialView("_ReportByDate"));

            case "6":
                ViewBag.dataList = new SelectList(transactionHelper.GetPaymentTypes(true), "id", "val");

                return(PartialView("_ReportByDropDown"));

            case "7":
                ViewBag.dataList = new SelectList(transactionHelper.GetAccountHeads(), "id", "val");

                return(PartialView("_ReportByDropDown"));

            case "8":
                return(PartialView("_ReportByAmount"));
            }
            return(Content("An error occurred"));
        }
示例#26
0
        /// <summary>
        /// Loads the selected student information
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void UpdateStudent_Load(object sender, EventArgs e)
        {
            var dt = StudentHelper.GetSigleStudent();

            foreach (DataRow row in dt.Rows)
            {
                txtFirstName.Text = row["FirstName"].ToString();
                txtLastName.Text  = row["LastName"].ToString();
                dtpDOB.Value      = DateTime.Parse(row["DateofBirth"].ToString());
            }
        }
        public ActionResult AddAdditionalFee(AddAdditionalFeeViewModel userInput)
        {
            StudentHelper helper = new StudentHelper();

            //if model is not vaild, do not process furthur
            if (!ModelState.IsValid)
            {
                return(View());
            }

            return(Content(helper.AddAdditionalFee(userInput)));
        }
示例#28
0
        public async Task <StudentApiResponse> GetAllStudents(string sortBy, SortOrder order, int page, int pageSize)
        {
            var students = await _context.Students.Find(FilterDefinition <Student> .Empty)
                           .Sort(string.Format("{{{0}: {1}}}", StudentHelper.FortmatSortBy(sortBy), StudentHelper.GetSortOrder(order)))
                           .Skip((page - 1) * pageSize)
                           .Limit(pageSize)
                           .ToListAsync();

            return(new StudentApiResponse {
                Items = students, TotalCount = await GetStudentCount()
            });
        }
示例#29
0
        /// <summary>
        /// Displays a warning.
        /// Deletes the selected record from the Student table.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btnDelete_Click(object sender, EventArgs e)
        {
            StudentHelper.currentId = int.Parse(dgvStudents.CurrentRow.Cells["StudentId"].Value.ToString());
            DialogResult result = MessageBox.Show("Are you sure you want to delete the record for: " + StudentHelper.currentId + " " + dgvStudents.CurrentRow.Cells["FirstName"].Value.ToString() + " , " + dgvStudents.CurrentRow.Cells["LastName"].Value.ToString() + "?", "Delete Record", MessageBoxButtons.OKCancel, MessageBoxIcon.Warning);

            if (result == DialogResult.OK)
            {
                if (StudentHelper.DeleteRecord() > 0)
                {
                    StudentHelper.LoadStudents(dgvStudents);
                }
            }
        }
        public ActionResult ViewStudent(StudentSearchViewModel userInput)
        {
            StudentHelper           helper    = new StudentHelper();
            string                  error     = "";
            DisplayStudentViewModel viewModel = helper.GetStudentDetails(userInput.bid, out error, true);

            if (viewModel != null)
            {
                ViewBag.bid = userInput.bid;
                return(PartialView("_ViewStudent", viewModel));
            }
            return(Content(error));
        }