コード例 #1
0
 public ActionResult Add(StudentInfoViewModel model)
 {
     if (!CheckStudentExist(model.Number))
     {
         Student student = new Student
         {
             Number   = model.Number,
             Name     = model.Name,
             Gender   = model.Gender,
             Major    = model.Major,
             Password = "******"
         };
         db.Students.Add(student);
         int i = db.SaveChanges();
         if (i > 0)
         {
             return(GetAllStudentsView());
         }
         else
         {
             return(Json(new { code = 1, data = "添加失败" }));
         }
     }
     else
     {
         return(Json(new { code = 1, data = "该学生已存在" }));
     }
 }
コード例 #2
0
        public async Task <IActionResult> StudentInfo(string studentId, string schoolId, DateTime Month)
        {
            AppUser student = await _userService.GetUserAsync(studentId);

            DateTime curDate = DateTime.Now;

            if (student == null)
            {
                TempData["ErrorMessage"] = "Учня не знайдено";
                return(RedirectToAction(nameof(Index)));
            }
            if (Month.Year < 2000)
            {
                Month = curDate;
            }
            IEnumerable <Subscription> userSubscriptions = _subscriptionsService.GetUserSubscriptions(student.Id, schoolId, Month);
            StudentInfoViewModel       model             = new StudentInfoViewModel
            {
                Student       = student,
                Subscriptions = userSubscriptions,
                Month         = Month,
                ScholId       = schoolId,
            };

            ViewBag.schoolOwner = _teacherSecvice.IsItThisSchoolOwner(schoolId, HttpContext.User.FindFirstValue(ClaimTypes.NameIdentifier));
            ViewBag.curDate     = curDate;
            ViewBag.teacherId   = HttpContext.User.FindFirstValue(ClaimTypes.NameIdentifier);
            return(View(model));
        }
コード例 #3
0
        public ActionResult Modify(int Id)
        {
            Student _student           = db.Students.SingleOrDefault(d => d.Id == Id);
            StudentInfoViewModel model = new StudentInfoViewModel();

            if (_student != null)
            {
                model.Id     = _student.Id;
                model.Number = _student.Number;
                model.Name   = _student.Name;
                model.Gender = _student.Gender;
                model.Major  = _student.Major;
            }
            List <SelectListItem> majorList = new List <SelectListItem>();

            foreach (string s in GetMajors())
            {
                majorList.Add(new SelectListItem
                {
                    Selected = true,
                    Text     = s,
                    Value    = s
                });
            }
            ViewBag.Majors = majorList;

            return(PartialView("PartialModifyStudent", model));
        }
コード例 #4
0
        public async Task <IActionResult> AddTeacherInfo(StudentInfoViewModel model)
        {
            //if (ModelState.IsValid)
            //{
            //    StudentInfoDTO studentInfoDTO = new StudentInfoDTO()
            //    {
            //        studentName = model.studentName,
            //        studentMiddleName = model.studentMiddleName,
            //        studentLastName = model.studentLastName,
            //        studentSex = model.studentSex,
            //        bday = model.bday,
            //        phone = model.phone,
            //        homeAddress = model.homeAddress,
            //        email = model.email,
            //        StudentFirstParentName = model.StudentFirstParentName,
            //        StudentFirstParentPhone = model.StudentFirstParentPhone,
            //        StudentSecondParentName = model.StudentSecondParentName,
            //        StudentSecondParentPhone = model.StudentSecondParentPhone
            //    };
            //    if (studentInfo.FindStudentInfo(model.studentName, model.studentLastName, model.bday, model.phone) == null)
            //    {
            //        await studentInfo.CreateStudentInfo(studentInfoDTO);
            //        return RedirectToAction("VHomeUser", "Home");
            //    }
            //    else
            ModelState.AddModelError("Name", "Даний студент вже існує");
            //}

            return(View(model));
        }
コード例 #5
0
        private void btnAddStudent_Click(object sender, EventArgs e)
        {
            try
            {
                var studentInfo = new StudentInfoViewModel
                {
                    Course        = (byte)this.numCourse.Value,
                    Faculty       = this.textBoxFaculty.Text,
                    FacultyNumber = this.textBoxFacultyNumber.Text,
                    FirstName     = this.textBoxFirstName.Text,
                    SecondName    = this.textBoxSecondName.Text,
                    LastName      = this.textBoxLastName.Text,
                    Status        = (StudentStatus)this.comboStatus.SelectedValue,
                    Group         = byte.Parse(this.textBoxGroup.Text),
                    Degree        = (Degree)this.comboOks.SelectedValue,
                    Potok         = this.textBoxPotok.Text,
                    Speciality    = this.textBoxSpeciality.Text
                };

                var studentsContoller = new StudentsController(new StudentInfoSystemData());

                studentsContoller.AddStudent(studentInfo);
                MessageBox.Show(
                    "Успешно добавихте нов студент!",
                    "Успешно добавен студент",
                    MessageBoxButtons.OK,
                    MessageBoxIcon.Information);
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "Грешки", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
コード例 #6
0
 protected override void OnNavigatedFrom(NavigationEventArgs e)
 {
     base.OnNavigatedFrom(e);
     MajorScoreViewModel.Dispose();
     SecondMajorScoreViewModel.Dispose();
     StudentInfoViewModel.Dispose();
 }
コード例 #7
0
        public ActionResult AddFeeType()
        {
            StudentInfoViewModel model = new StudentInfoViewModel();

            model.FeeTypeList     = _studentService.GetFeeTypeList();
            model.SessionNameList = _studentService.GetSessionList();
            model.CourseList      = _studentService.GetCourseList();
            return(View(model));
        }
コード例 #8
0
 protected override void OnNavigatingFrom(NavigatingCancelEventArgs e)
 {
     base.OnNavigatingFrom(e);
     Window.Current.SizeChanged -= CurrentWindow_SizeChanged;
     StudentInfoViewModel.Dispose();
     WellknownDataViewModel.Dispose();
     ExamsViewModel.Dispose();
     ScheduleViewModel.Dispose();
 }
コード例 #9
0
        public ActionResult Create()
        {
            StudentInfoViewModel model = new StudentInfoViewModel();

            ViewBag.GenderId             = new SelectList(db.Gender.OrderBy(m => m.GenderName), "Id", "GenderName");
            ViewBag.AdmittedDepartmentId = new SelectList(db.Department.OrderBy(m => m.Name), "Id", "Name");
            ViewBag.BranchId             = new SelectList(db.Company.OrderBy(m => m.CompanyName), "CompanyKey", "CompanyName");

            return(View(model));
        }
コード例 #10
0
        public ActionResult viewStudent(int admid)
        {
            booktrackingdbEntities db = new booktrackingdbEntities();

            var model = new StudentInfoViewModel();

            model.StudentListing = db.Students.ToList();

            return(View(model));
        }
コード例 #11
0
        public ActionResult Index()
        {
            booktrackingdbEntities db = new booktrackingdbEntities();

            var model = new StudentInfoViewModel();

            model.StudentListing = db.Students.Where(x => x.FirstName == "Pete").ToList();

            return(View(model));
        }
コード例 #12
0
        public ActionResult Edit(int id)
        {
            var entity = db.StudentInfo.Find(id);

            StudentInfoViewModel model = new StudentInfoViewModel();

            model.Id                               = entity.Id;
            model.StudentPhoto                     = entity.StudentPhoto;
            model.StudentNameBangla                = entity.StudentNameBangla;
            model.StudentNameEnglish               = entity.StudentNameEnglish;
            model.StudentNameArabic                = entity.StudentNameArabic;
            model.StudentDateOfBirth               = entity.StudentDateOfBirth;
            model.GenderId                         = entity.GenderId;
            model.Nationality                      = entity.Nationality;
            model.FatherNameBangla                 = entity.FatherNameBangla;
            model.FatherNameEnglish                = entity.FatherNameEnglish;
            model.FatherMobile                     = entity.FatherMobile;
            model.FatherIsAlive                    = entity.FatherIsAlive;
            model.FatherOccupation                 = entity.FatherOccupation;
            model.MotherNameBangla                 = entity.MotherNameBangla;
            model.MotherNameEnglish                = entity.MotherNameEnglish;
            model.MotherIsAlive                    = entity.MotherIsAlive;
            model.MotherMobile                     = entity.MotherMobile;
            model.GuardianName                     = entity.GuardianName;
            model.GuardianOccupation               = entity.GuardianOccupation;
            model.GuardianHouseNo                  = entity.GuardianHouseNo;
            model.GuardianVillage                  = entity.GuardianVillage;
            model.GuardianPostOffice               = entity.GuardianPostOffice;
            model.GuardianThana                    = entity.GuardianThana;
            model.GuardianDistrict                 = entity.GuardianDistrict;
            model.RelationWithGuardian             = entity.RelationWithGuardian;
            model.YearlyIncomeGuardian             = entity.YearlyIncomeGuardian;
            model.PermanentAddressHouse            = entity.PermanentAddressHouse;
            model.PermanentAddressVillage          = entity.PermanentAddressVillage;
            model.PermanentAddressPostOffice       = entity.PermanentAddressPostOffice;
            model.PermanentAddressThana            = entity.PermanentAddressThana;
            model.PermanentAddressDistrict         = entity.PermanentAddressDistrict;
            model.HonarablePersonNameInArea        = entity.HonarablePersonNameInArea;
            model.PreviousInstitutionName          = entity.PreviousInstitutionName;
            model.PreviousInstitutionAddress       = entity.PreviousInstitutionAddress;
            model.PreviousInstitutionClass         = entity.PreviousInstitutionClass;
            model.PreviousInstitutionClearanceNo   = entity.PreviousInstitutionClearanceNo;
            model.PreviousInstitutionClearanceDate = entity.PreviousInstitutionClearanceDate;
            model.AdmittedDepartmentId             = entity.AdmittedDepartmentId;


            ViewBag.GenderId             = new SelectList(db.Gender.OrderBy(m => m.GenderName), "Id", "GenderName");
            ViewBag.AdmittedDepartmentId = new SelectList(db.Department.OrderBy(m => m.Name), "Id", "Name");
            ViewBag.BranchId             = new SelectList(db.Company.OrderBy(m => m.CompanyName), "CompanyKey", "CompanyName");

            return(View(model));
        }
コード例 #13
0
        public IActionResult DeletePicture(StudentInfoViewModel student)
        {
            using (this.db)
            {
                var studentToDelete = this.db.Students.Where(c => c.Id == student.Id).Select(x => x).FirstOrDefault();

                this.db.Students.Find(student.Id).PhotoPath = null;

                this.db.SaveChanges();

                return(this.RedirectToAction("Info", new { id = student.Id }));
            }
        }
コード例 #14
0
        public ActionResult PreviousBoardExam(int id)
        {
            StudentInfoViewModel model = new StudentInfoViewModel();

            model.PreviousInstitutionList = new List <StudentInfoPreviousInstitutionViewModel>();
            model.Id = id;

            //var entity = db.StudentInfoPreviousInstitution.Where(m=>m.StudentInfo_FK == id);
            var p = db.StudentInfoPreviousInstitution.Any(m => m.StudentInfo_FK == id);

            if (p == false)
            {
                using (var _sdb = new JamiyahDBEntities())
                {
                    foreach (var item in _sdb.BoardExamination)
                    {
                        StudentInfoPreviousInstitutionViewModel _institutionObj = new StudentInfoPreviousInstitutionViewModel();
                        _institutionObj.ExamName = item.ExminationName;

                        StudentInfoPreviousInstitution _studentInfoPreviousInstitutionEntity = new StudentInfoPreviousInstitution();
                        _studentInfoPreviousInstitutionEntity.ExamName       = _institutionObj.ExamName;
                        _studentInfoPreviousInstitutionEntity.StudentInfo_FK = id;
                        _sdb.StudentInfoPreviousInstitution.Add(_studentInfoPreviousInstitutionEntity);
                        // db.SaveChanges();
                    }
                    //save at the end
                    _sdb.SaveChanges();
                }
            }

            IQueryable <StudentInfoPreviousInstitution> query = db.StudentInfoPreviousInstitution.Where(m => m.StudentInfo_FK == id);

            var data = query.Select(asset => new StudentInfoPreviousInstitutionViewModel()
            {
                Id                  = asset.Id,
                StudentInfo_FK      = asset.StudentInfo_FK,
                ExamName            = asset.ExamName,
                ExamYear            = asset.ExamYear,
                InstitutionName     = asset.InstitutionName,
                InstitutionCode     = asset.InstitutionCode,
                InstitutionDistrict = asset.InstitutionDistrict,
                RegiNo              = asset.RegiNo,
                RollNo              = asset.RollNo,
                Grade               = asset.Grade
            }).ToList();

            model.PreviousInstitutionList = data;

            return(View(model));
        }
コード例 #15
0
        public ActionResult StudentHomePage(string username, string password, string stuid, string requestAdded, string pendingCancelled)
        {
            booktrackingdbEntities db = new booktrackingdbEntities();

            if (requestAdded == "yes")
            {
                TempData["confirm"] = "Book request added.";
            }
            if (pendingCancelled == "yes")
            {
                TempData["confirm"] = "Book request cancelled.";
            }

            if (stuid != null)
            {
                int id = Convert.ToInt32(stuid);
                username = db.Students.Where(x => x.StudentID == id).FirstOrDefault().email;
                password = db.Students.Where(x => x.StudentID == id).FirstOrDefault().password;
            }

            var model = new StudentInfoViewModel();

            model.StudentListing = db.Students.Where(x => x.email == username && x.password == password).ToList();

            if (model.StudentListing.Count() == 0)
            {
                return(RedirectToAction("StudentLogin", new { status = "login failed" }));
            }
            else
            {
                ViewBag.firstname  = model.StudentListing.FirstOrDefault().FirstName;
                ViewBag.lastname   = model.StudentListing.FirstOrDefault().LastName;
                ViewBag.email      = model.StudentListing.FirstOrDefault().email;
                ViewBag.studentid  = model.StudentListing.FirstOrDefault().StudentID;
                ViewBag.classone   = model.StudentListing.FirstOrDefault().ClassOne;
                ViewBag.classtwo   = model.StudentListing.FirstOrDefault().ClassTwo;
                ViewBag.classthree = model.StudentListing.FirstOrDefault().ClassThree;

                model.StudentID = model.StudentListing.FirstOrDefault().StudentID;
                int id = ViewBag.studentid;

                model.OrderListing      = db.Orders.Where(x => x.OStudentID == id).ToList();
                model.OrderListing      = model.OrderListing.Where(x => x.Status == "Pending" || x.Status == "Approved" || x.Status == "Declined").ToList();
                model.CheckedOutListing = db.Orders.Where(x => x.OStudentID == id && x.Status == "Checked Out").ToList();
                model.BookListing       = db.Books.ToList();

                return(View(model));
            }
        }
コード例 #16
0
        public ActionResult Modify(StudentInfoViewModel student)
        {
            Student _student = db.Students.SingleOrDefault(d => d.Id == student.Id);

            if (_student != null)
            {
                _student.Name   = student.Name;
                _student.Number = student.Number;
                _student.Gender = student.Gender;
                _student.Major  = student.Major;
                db.SaveChanges();
                return(GetAllStudentsView());
            }
            return(Json(new { code = 1, data = "修改失败" }));
        }
コード例 #17
0
        public ActionResult updateBalance(int admid)
        {
            booktrackingdbEntities db = new booktrackingdbEntities();

            var model = new StudentInfoViewModel();

            var ordersToUpdate = db.Orders.Where(x => x.DueDate.Value < DateTime.Now).ToList();

            for (int i = 0; i < ordersToUpdate.Count; i++)
            {
                ordersToUpdate[i].Balance = DateTime.Now.Subtract(ordersToUpdate[i].DueDate.Value).Days;
                db.SaveChanges();
            }

            return(RedirectToAction("AdminHomePage", new { admid = admid, balanceUpdated = "yes" }));
        }
コード例 #18
0
        //email
        public ActionResult sendReleaseEmail(int teaid, string declinedReleased, int orderid)
        {
            booktrackingdbEntities db = new booktrackingdbEntities();

            var model = new StudentInfoViewModel();

            var theTeather = db.Teachers.Where(x => x.TeacherID == teaid).FirstOrDefault();
            var theOrder   = db.Orders.Where(x => x.OrderID == orderid).FirstOrDefault();
            var theStu     = db.Students.Where(x => x.StudentID == theOrder.OStudentID).FirstOrDefault();

            int bookid = theOrder.OBookID;

            string teaName  = theTeather.FirstName + " " + theTeather.LastName;
            string stuEmail = theStu.email;
            string teaEmail = theTeather.email;

            string stuName = "Dear " + theStu.FirstName + " " + theStu.LastName + ",";


            string bookName = db.Books.Where(x => x.BookID == bookid).Select(x => x.BookName).FirstOrDefault();
            string isbn     = db.Books.Where(x => x.BookID == bookid).Select(x => x.ISBN).FirstOrDefault();

            string subject = "Book Declined Request Released - High School Textbook Services";

            string body = stuName + "\r\n\r\nThe following declined book request has been released, now the request can be approved."
                          + "\r\n\r\nReleased By: " + teaName + "\r\nTeacher Email: " + teaEmail + "\r\nBook Name: " + bookName + "\r\nISBN: " + isbn;

            SmtpClient client = new SmtpClient();

            client.Port                  = 587;
            client.Host                  = "smtp.gmail.com";
            client.EnableSsl             = true;
            client.Timeout               = 10000;
            client.DeliveryMethod        = SmtpDeliveryMethod.Network;
            client.UseDefaultCredentials = false;
            client.Credentials           = new System.Net.NetworkCredential("*****@*****.**", "sdfg4ESZxll");

            MailMessage mm = new MailMessage("*****@*****.**", stuEmail, subject, body);

            mm.BodyEncoding = UTF8Encoding.UTF8;
            mm.DeliveryNotificationOptions = DeliveryNotificationOptions.OnFailure;

            client.Send(mm);

            return(RedirectToAction("TeacherHomePage", new { teaid = teaid, declinedReleased = declinedReleased }));
        }
コード例 #19
0
        public void UpdateStudent(StudentInfoViewModel vm, HttpPostedFileBase imageFile)
        {
            var updateStudent = GetStudentById(vm.Id);

            updateStudent.Name       = vm.Name;
            updateStudent.FatherName = vm.FatherName;
            updateStudent.DOB        = vm.DOB;
            updateStudent.GradeId    = vm.GradeId;
            updateStudent.Address    = vm.Address;
            updateStudent.RollNo     = vm.RollNo;
            if (imageFile != null)
            {
                updateStudent.Image = imageFile.FileName;
                imageFile.SaveAs(HttpContext.Current.Server.MapPath("~/Images") + "/" + updateStudent.Id.ToString() + "_" + imageFile.FileName);
            }
            Save();
        }
コード例 #20
0
        public StudentInfoViewModel EditStudent(StudentInfo studentInfo)
        {
            var vm = new StudentInfoViewModel
            {
                Id         = studentInfo.Id,
                Address    = studentInfo.Address,
                DOB        = studentInfo.DOB,
                Name       = studentInfo.Name,
                FatherName = studentInfo.FatherName,
                GradeId    = studentInfo.GradeId,
                IsDeleted  = studentInfo.IsDeleted,
                RollNo     = studentInfo.RollNo,
                Image      = studentInfo.Image
            };

            return(vm);
        }
コード例 #21
0
        public ActionResult Index()
        {
            string ApplNo = Convert.ToString(Session["ApplicationNo"]);
            var    data   = new StudentInfoViewModel();

            data = _studentService.GetStudentProfile(ApplNo);
            data.CandidateName               = Session["UserName"].ToString();
            data.GetBoardAndUniversityList   = _studentService.GetBoardAndUniversityList();
            data.GetEvaluationTypeList       = _studentService.GetEvaluationList();
            data.GetBoardAndUniversityListUG = _studentService.GetBoardAndUniversityListUG();
            data.GetStream          = _studentService.GetStreamView();
            data.Resultstatusinfo   = _studentService.GetResultStatusView();
            data.ptaDocumentDetails = _studentService.GetDocumentDetails(ApplNo);
            data.CourseList         = _studentService.GetCourseList();
            data.FeeTypeList        = _studentService.GetFeeTypeList();
            return(View(data));
        }
コード例 #22
0
 private void LoadStudentInfo(StudentInfoViewModel studentInfo)
 {
     if (studentInfo != null)
     {
         this.textBoxFirstName.Text     = studentInfo.FirstName;
         this.textBoxSecondName.Text    = studentInfo.SecondName;
         this.textBoxLastName.Text      = studentInfo.LastName;
         this.textBoxFaculty.Text       = studentInfo.Faculty;
         this.textBoxSpeciality.Text    = studentInfo.Speciality;
         this.textBoxGroup.Text         = studentInfo.Group.ToString();
         this.textBoxPotok.Text         = studentInfo.Potok;
         this.textBoxFacultyNumber.Text = studentInfo.FacultyNumber;
         this.numCourse.Value           = studentInfo.Course;
         this.comboOks.SelectedValue    = studentInfo.Degree;
         this.comboStatus.SelectedValue = studentInfo.Status;
     }
 }
コード例 #23
0
 public ActionResult Edit(StudentInfoViewModel vm, HttpPostedFileBase imageFile)
 {
     if (ModelState.IsValid)
     {
         if (imageFile != null && !(imageFile.FileName.ToLower().EndsWith(".jpg") || imageFile.FileName.ToLower().EndsWith(".png") || imageFile.FileName.ToLower().EndsWith(".gif")))
         {
             ModelState.AddModelError("Image", "Invalid Image Format");
         }
         else
         {
             _studentBl.UpdateStudent(vm, imageFile);
             return(RedirectToAction("Index"));
         }
     }
     ViewBag.GradeId = new SelectList(_gradeBl.GetGrades(), "Id", "ClassName", vm.GradeId);
     return(View(vm));
 }
コード例 #24
0
        public ActionResult sendEmail(int admid)
        {
            booktrackingdbEntities db = new booktrackingdbEntities();

            var model = new StudentInfoViewModel();

            var openOrder = db.Orders.Where(x => x.Status == "Approved" || x.Status == "Checked Out").ToList();
            var lateOrder = openOrder.Where(x => x.DueDate.Value < DateTime.Now).ToList();

            int lateCount = lateOrder.Count();

            for (int i = 0; i < lateCount; i++)
            {
                int    stuID        = lateOrder[i].OStudentID;
                var    lateStu      = db.Students.Where(x => x.StudentID == stuID).FirstOrDefault();
                string lateStuEmail = lateStu.email;
                int    bookID       = lateOrder[i].OBookID;
                string bookName     = db.Books.Where(x => x.BookID == bookID).Select(x => x.BookName).FirstOrDefault();
                string dueDate      = lateOrder[i].DueDate.ToString();
                dueDate = dueDate.Substring(0, dueDate.Length - 12);
                string stuName = "Dear " + lateStu.FirstName + " " + lateStu.LastName + ",";

                string subject = "Book Due - High School Textbook Services";

                string body = stuName + "\r\n\r\nYour textbook is already due, please return the following book to Admin in library."
                              + "\r\n\r\nBook Due: " + bookName + "\r\nDue Date: " + dueDate;

                SmtpClient client = new SmtpClient();
                client.Port                  = 587;
                client.Host                  = "smtp.gmail.com";
                client.EnableSsl             = true;
                client.Timeout               = 10000;
                client.DeliveryMethod        = SmtpDeliveryMethod.Network;
                client.UseDefaultCredentials = false;
                client.Credentials           = new System.Net.NetworkCredential("*****@*****.**", "sdfg4ESZxll");

                MailMessage mm = new MailMessage("*****@*****.**", lateStuEmail, subject, body);
                mm.BodyEncoding = UTF8Encoding.UTF8;
                mm.DeliveryNotificationOptions = DeliveryNotificationOptions.OnFailure;

                client.Send(mm);
            }

            return(RedirectToAction("AdminHomePage", new { admid = admid, emailSent = "yes" }));
        }
コード例 #25
0
        public string AddUpdateFeeTypeDetail(StudentInfoViewModel model)
        {
            string Message = "";

            try
            {
                ptaFeeTypeDetail obj;
                if (model.Id > 0)
                {
                    obj     = _context.ptaFeeTypeDetails.Where(f => f.Id == model.Id).FirstOrDefault();
                    Message = "Successfully Updated!";
                }
                else
                {
                    var data = _context.ptaFeeTypeDetails
                               .Where(f => f.PTACourseMasterId == model.CourseId &&
                                      f.PTASessionMasterId == model.SessionMasterId &&
                                      f.PTAFeeTypeId == model.FeeTypeId).FirstOrDefault();
                    if (data != null)
                    {
                        Message = "This FeeType Detail record already exist!";
                        return(Message);
                    }
                    obj     = new ptaFeeTypeDetail();
                    Message = "Successfully Inserted!";
                }
                obj.PTACourseMasterId  = model.CourseId;
                obj.Amount             = model.Amount;
                obj.PTAFeeTypeId       = model.FeeTypeId;
                obj.IsActive           = model.IsActive;
                obj.PTASessionMasterId = model.SessionMasterId;
                if (model.Id == 0)
                {
                    _context.ptaFeeTypeDetails.Add(obj);
                }
                _context.SaveChanges();
                return(Message);
            }
            catch (Exception ex)
            {
                return(ex.Message);
            }
        }
コード例 #26
0
        protected async override void OnNavigatedTo(NavigationEventArgs e)
        {
            base.OnNavigatedTo(e);
            Analytics.TrackEvent("Navigation", new Dictionary <string, string>()
            {
                { "Page", "Score" }
            });
            Application.Current.GetService <INotificationService>().ClearToast(ToastTypes.ScoreChange);
            bool  signedIn = Application.Current.GetService <ICredentialService>().IsSignedIn;
            Task  studentInfoUpdateTask = StudentInfoViewModel.StartUpdateAsync(signedIn);
            Task  majorUpdateTask       = MajorScoreViewModel.StartUpdateAsync(signedIn);
            await studentInfoUpdateTask;

            if (StudentInfoViewModel.Value.HasSecondMajor && ScoreSectionsPivot.Items.Count == 1)
            {
                ScoreSectionsPivot.Items.Add(secondMajorItem);
            }
            await majorUpdateTask;
        }
コード例 #27
0
ファイル: DevSignInRepo.cs プロジェクト: a2937/tutor-proto
        private StudentInfoViewModel GetCourseInfo(StudentInfoViewModel studentInfoViewModel)
        {
            CourseTable = _db.Set <Course>();

            List <Course> schedule = new List <Course>();
            Course        first    = CourseTable.Where(x => x.CRN == 1).First();
            Course        second   = CourseTable.Where(x => x.CRN == 2).First();
            Course        third    = CourseTable.Where(x => x.CRN == 3).First();
            Course        fourth   = CourseTable.Where(x => x.CRN == 4).First();

            schedule.Add(first);
            schedule.Add(second);
            schedule.Add(third);
            schedule.Add(fourth);

            studentInfoViewModel.classSchedule = schedule;

            return(studentInfoViewModel);
        }
コード例 #28
0
        //email
        public ActionResult sendCancelEmail(int stuid, string pendingCancelled, int bookid, int classid)
        {
            booktrackingdbEntities db = new booktrackingdbEntities();

            var model = new StudentInfoViewModel();

            var theTeather = db.Teachers.Where(x => x.classIDOne == classid || x.classIDTwo == classid || x.classIDThree == classid).FirstOrDefault();
            var theStu     = db.Students.Where(x => x.StudentID == stuid).FirstOrDefault();

            string teaName  = "Dear " + theTeather.FirstName + " " + theTeather.LastName + ",";
            string teaEmail = theTeather.email;

            string stuName = theStu.FirstName + " " + theStu.LastName;


            string bookName = db.Books.Where(x => x.BookID == bookid).Select(x => x.BookName).FirstOrDefault();
            string isbn     = db.Books.Where(x => x.BookID == bookid).Select(x => x.ISBN).FirstOrDefault();

            string subject = "Book Request Cancelled - High School Textbook Services";

            string body = teaName + "\r\n\r\nThe following book request has been cancelled, please login to your account to view more information."
                          + "\r\n\r\nStudent Name: " + stuName + "\r\nBook Requested: " + bookName + "\r\nISBN: " + isbn;

            SmtpClient client = new SmtpClient();

            client.Port                  = 587;
            client.Host                  = "smtp.gmail.com";
            client.EnableSsl             = true;
            client.Timeout               = 10000;
            client.DeliveryMethod        = SmtpDeliveryMethod.Network;
            client.UseDefaultCredentials = false;
            client.Credentials           = new System.Net.NetworkCredential("*****@*****.**", "sdfg4ESZxll");

            MailMessage mm = new MailMessage("*****@*****.**", teaEmail, subject, body);

            mm.BodyEncoding = UTF8Encoding.UTF8;
            mm.DeliveryNotificationOptions = DeliveryNotificationOptions.OnFailure;

            client.Send(mm);

            return(RedirectToAction("StudentHomePage", new { stuid = stuid, pendingCancelled = pendingCancelled }));
        }
コード例 #29
0
        public async Task <IActionResult> AddStudentInfo(StudentInfoViewModel model)
        {
            if (model.StudentSecondParentName == "")
            {
                model.StudentSecondParentName = null;
            }
            if (model.StudentSecondParentPhone == "")
            {
                model.StudentSecondParentPhone = null;
            }
            if (ModelState.IsValid)
            {
                StudentInfoDTO studentInfoDTO = new StudentInfoDTO()
                {
                    studentName       = model.studentName,
                    studentMiddleName = model.studentMiddleName,
                    studentLastName   = model.studentLastName,
                    studentSex        = model.studentSex,
                    bday                     = model.bday,
                    phone                    = model.phone,
                    homeAddress              = model.homeAddress,
                    email                    = model.email,
                    StudentFirstParentName   = model.StudentFirstParentName,
                    StudentFirstParentPhone  = model.StudentFirstParentPhone,
                    StudentSecondParentName  = model.StudentSecondParentName,
                    StudentSecondParentPhone = model.StudentSecondParentPhone
                };
                if (studentInfo.FindStudentInfo(model.studentName, model.studentLastName, model.bday, model.phone) == null)
                {
                    await studentInfo.CreateStudentInfo(studentInfoDTO);

                    return(RedirectToAction("StudentDepartment", "Home"));
                }
                else
                {
                    ModelState.AddModelError("Name", "Даний студент вже існує");
                }
            }

            return(View(model));
        }
コード例 #30
0
        public void AddStudent(StudentInfoViewModel studentInfo)
        {
            this.ValidateStudentInfo(studentInfo);

            this.data.Students.Add(new Student
            {
                Course        = studentInfo.Course,
                Faculty       = studentInfo.Faculty,
                FacultyNumber = studentInfo.FacultyNumber,
                LastName      = studentInfo.LastName,
                SecondName    = studentInfo.SecondName,
                Group         = studentInfo.Group,
                Degree        = studentInfo.Degree,
                Potok         = studentInfo.Potok,
                Speciality    = studentInfo.Speciality,
                FirstName     = studentInfo.FirstName,
                StudentStatus = studentInfo.Status,
            });

            this.data.SaveChanges();
        }