Пример #1
0
        private void loadUnRegStudents()
        {
            string regList = new StudentRegistrationService().GetStudentRegistrationByBatchIdBGroup(cmbProgram.GridView.GetRowValues(cmbProgram.GridView.FocusedRowIndex, "Bgroup").ToString(), new SessionManager().GetUserId(Session));

            gvStudents.DataSource = new StudentService().GetAllUnRegStudent(regList, new SessionManager().GetUserId(Session));
            gvStudents.DataBind();
        }
Пример #2
0
        public void ThrowExceptionIfStudentInvalid()
        {
            var mockStudentRepository = MockRepository.GenerateMock <IStudentRepository>();
            var mockStudentValidator  = MockRepository.GenerateMock <IStudentValidator>();
            var toRegister            = new Student();

            mockStudentValidator.Stub(sv => sv.ValidateStudent(toRegister)).Return(false);
            var sut = new StudentRegistrationService(mockStudentRepository, mockStudentValidator);

            Assert.Throws <Exception>(() => sut.RegisterNewStudent(toRegister));
        }
Пример #3
0
        public void SaveTheStudentIfStudentValid()
        {
            var mockStudentRepository = MockRepository.GenerateMock <IStudentRepository>();
            var mockStudentValidator  = MockRepository.GenerateMock <IStudentValidator>();
            var toRegister            = new Student();

            mockStudentValidator.Stub(sv => sv.ValidateStudent(toRegister)).Return(true);
            var sut = new StudentRegistrationService(mockStudentRepository, mockStudentValidator);

            sut.RegisterNewStudent(toRegister);

            mockStudentRepository.AssertWasCalled(msr => msr.Save(toRegister));
        }
Пример #4
0
        public void SaveTheCreatedStudentIfStudentValid()
        {
            var mockStudentRepository = MockRepository.GenerateMock <IStudentRepository>();
            var mockStudentValidator  = MockRepository.GenerateMock <IStudentValidator>();

            mockStudentValidator.Stub(sv => sv.ValidateStudent(Arg <Student> .Is.Anything)).Return(true);
            var sut = new StudentRegistrationService(mockStudentRepository, mockStudentValidator);

            const int    studentId = 314159;
            const string firstName = "First";
            const string lastName  = "Last";

            sut.RegisterNewStudent(studentId, firstName, lastName);

            mockStudentRepository.AssertWasCalled(
                msr => msr.Save(Arg <Student> .Matches(s => HasCorrectDetails(s, studentId, firstName, lastName))));
        }
Пример #5
0
        protected void gvFeesBatch_BatchUpdate(object sender, DevExpress.Web.Data.ASPxDataBatchUpdateEventArgs e)
        {
            e.Handled = true;
            string fbatch   = "";
            string studFees = "";

            for (int i = 0; i < e.UpdateValues.Count; i++)
            {
                //get all batch of the same program/course
                // List<int> batchIDs = new ClassSchedulerServices().GetClassSchedulerIDs(int.Parse(cmbProgram.GridView.GetRowValues(cmbProgram.GridView.FocusedRowIndex, "ClassID").ToString()), cmbProgram.GridView.GetRowValues(cmbProgram.GridView.FocusedRowIndex, "Bgroup").ToString(), new SessionManager().GetUserId(Session));

                // foreach (int batchID in batchIDs)
                // {
                //prepare the data for all the batches fees
                //fbatch += "('" + int.Parse(e.UpdateValues[i].NewValues[2].ToString()) + "','" + int.Parse(cmbProgram.GridView.GetRowValues(cmbProgram.GridView.FocusedRowIndex, "ID").ToString()) + "','" + double.Parse(e.UpdateValues[i].NewValues[0].ToString()) + "','" + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + "','" + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + "','" + cmbProgram.GridView.GetRowValues(cmbProgram.GridView.FocusedRowIndex, "Bgroup").ToString() + "'),";
                //get all the sudent registered under that batch by the batch IDs
                List <StudentRegistration> batchRegStud = new StudentRegistrationService().GetAllStudentRegistrationByBatchIdBgroup(int.Parse(cmbProgram.GridView.GetRowValues(cmbProgram.GridView.FocusedRowIndex, "ID").ToString()), cmbProgram.GridView.GetRowValues(cmbProgram.GridView.FocusedRowIndex, "Bgroup").ToString(), new SessionManager().GetUserId(Session));
                if (batchRegStud.Count > 0)
                {
                    foreach (StudentRegistration studUserId in batchRegStud)
                    {
                        studFees += "('" + int.Parse(e.UpdateValues[i].NewValues[2].ToString()) + "','" + cmbProgram.GridView.GetRowValues(cmbProgram.GridView.FocusedRowIndex, "ID").ToString() + "','" + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + "','" + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + "','" + studUserId.StuduserId + "','" + cmbProgram.GridView.GetRowValues(cmbProgram.GridView.FocusedRowIndex, "Bgroup").ToString() + "','" + double.Parse(e.UpdateValues[i].NewValues[0].ToString()) + "'),";
                    }
                }
                //}
            }
            //if (fbatch.Length != 0 && studFees.Length != 0)
            if (studFees.Length != 0)
            {
                //new FeesBatchesService().AddFeesBatchesList(fbatch.TrimEnd(','), new SessionManager().GetUserId(Session));
                new StudentFeesService().AddStudentFeesList(studFees.TrimEnd(','), new SessionManager().GetUserId(Session));

                //Session["alertmsg"] = "1";
                ScriptManager.RegisterStartupScript(this, GetType(), ",toastr", "toastr.success('Saved Successfully','Message')", true);
            }
            else
            {
                //Session["alertmsg"] = "2";
                ScriptManager.RegisterStartupScript(this, GetType(), ",toastr", "toastr.info('Oops something is not right! No student registered for this batch','Message')", true);
            }
            loadBatchFees();
            uPanel.Update();
        }
Пример #6
0
        public rptFeesSlip(string studUserId, int batchId)
        {
            InitializeComponent();
            xrPicheader.ImageUrl = "~/pictures/letter_head.jpg";


            StudentRegistration st = new StudentRegistrationService().GetStudentRegistrationByBatchId(batchId, studUserId, "1");

            xrID.Text       = st.xIndexNo;
            xrAcademic.Text = st.xAcademicYear;
            xrProgram.Text  = st.xProgram;
            xrONames.Text   = st.xONames;
            xrSname.Text    = st.xSName;
            xrFName.Text    = st.xFNames;
            xrTerm.Text     = st.xTerm;

            List <StudentFees> stf = new StudentFeesService().GetStudentFees(studUserId, batchId, "1");

            this.DataSource = stf;
            xrFees.DataBindings.Add("Text", stf, "xFeeTitle");
            xrFeeAmt.DataBindings.Add("Text", stf, "Feevalue");

            xrFessTotal.DataBindings.Add("Text", stf, "Feevalue");
        }
Пример #7
0
        protected void btnSave_Click(object sender, EventArgs e)
        {
            string        studAttend         = "";
            List <object> studUserIds        = new List <object>();
            List <string> uncheckstudUserIds = new List <string>();
            int           lessonId           = 0;

            if (studAttendance == "Daily Attendance")
            {
                if (new StudentLessonAttendanceService().ExistStudentDatchAttendance(int.Parse(cmbProgram.GridView.GetRowValues(cmbProgram.GridView.FocusedRowIndex, "ID").ToString()), dtPayDate.Date, new SessionManager().GetUserId(this.Session)) == true)
                {
                    ScriptManager.RegisterStartupScript(this, GetType(), ",toastr", "toastr.info('Attendance is already recorded','Message')", true);
                    return;
                }

                lessonId = 0;
            }
            else if (studAttendance == "Per Subject/Course")
            {
                lessonId = int.Parse(cmbLessons.Value.ToString());
                if (new StudentLessonAttendanceService().ExistStudentLessonAttendance(int.Parse(cmbProgram.GridView.GetRowValues(cmbProgram.GridView.FocusedRowIndex, "ID").ToString()), lessonId, dtPayDate.Date, new SessionManager().GetUserId(this.Session)) == true)
                {
                    ScriptManager.RegisterStartupScript(this, GetType(), ",toastr", "toastr.info('Attendance is already recorded','Message')", true);
                    return;
                }
            }

            studUserIds        = gvStudents.GetSelectedFieldValues("StuduserId");
            uncheckstudUserIds = new StudentRegistrationService().GetStudentRegistrationByBatchIdBGroupNotInList(int.Parse(cmbProgram.GridView.GetRowValues(cmbProgram.GridView.FocusedRowIndex, "ID").ToString()), cmbProgram.GridView.GetRowValues(cmbProgram.GridView.FocusedRowIndex, "Bgroup").ToString(), string.Join(",", studUserIds.ToArray()), new SessionManager().GetUserId(this.Session));
            if (studUserIds.Count > 0)
            {
                if (cmbProgram.Value != null)
                {
                    //studuserid`, `batchid`, `bgroup`,lessonid, `present`, `createdate`, `modifydate`
                    foreach (object studUserId in studUserIds)
                    {
                        studAttend += "('" + studUserId.ToString() + "','" + cmbProgram.GridView.GetRowValues(cmbProgram.GridView.FocusedRowIndex, "ID").ToString() + "','" + cmbProgram.GridView.GetRowValues(cmbProgram.GridView.FocusedRowIndex, "Bgroup").ToString() + "','" + lessonId + "','" + 1 + "','" + dtPayDate.Date.ToString("yyyy-MM-dd HH:mm:ss") + "','" + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + "'),";
                    }

                    foreach (string uncheckstudUserId in uncheckstudUserIds)
                    {
                        studAttend += "('" + uncheckstudUserId + "','" + cmbProgram.GridView.GetRowValues(cmbProgram.GridView.FocusedRowIndex, "ID").ToString() + "','" + cmbProgram.GridView.GetRowValues(cmbProgram.GridView.FocusedRowIndex, "Bgroup").ToString() + "','" + lessonId + "','" + 0 + "','" + dtPayDate.Date.ToString("yyyy-MM-dd HH:mm:ss") + "','" + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + "'),";
                    }

                    if (new StudentLessonAttendanceService().AddStudentLessonAttendanceList(studAttend, new SessionManager().GetUserId(this.Session)))
                    {
                        ScriptManager.RegisterStartupScript(this, GetType(), ",toastr", "toastr.success('Saved Successfully','Message')", true);
                    }
                    else
                    {
                        ScriptManager.RegisterStartupScript(this, GetType(), ",toastr", "toastr.error('Saving Failed','Message')", true);
                    }
                }
                else
                {
                    cmbProgram.IsValid = false;
                }
            }
            else
            {
                ScriptManager.RegisterStartupScript(this, GetType(), ",toastr", "toastr.info('Select at least a student','Message')", true);
            }
            clearfields();
            uPanel.Update();
        }