예제 #1
0
        private void ShowDeleteAlert(StudentDetailsModel studentDetailsModel)
        {
            try
            {
                //set alert for executing the task
                if (alert == null)
                {
                    alert = new Android.Support.V7.App.AlertDialog.Builder(Activity);
                }

                alert.SetMessage("Are you sure you want to Delete Student Details?");
                alert.SetCancelable(false);

                alert.SetPositiveButton("Yes", (senderAlert, args) =>
                {
                    _studentDetailsViewModel.DeleteStudentData(studentDetailsModel);
                });

                alert.SetNegativeButton("No", (senderAlert, args) =>
                {
                    //perform your own task for this conditional button click
                });
                //run the alert in UI thread to display in the screen

                alert.Show();
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.Message);
            }
        }
예제 #2
0
        public static void StudentSendMail(StudentDetailsModel studentDetailsModel)
        {
            var message = new MimeMessage();

            message.From.Add(new MailboxAddress("Random student", "*****@*****.**"));
            message.To.Add(new MailboxAddress("Gorgan Gabriel", "*****@*****.**"));
            message.Subject = "Constestatie";

            var emailText = @"Buna ziua,
                Ma numesc " + studentDetailsModel.Name +
                            " si sunt in grupa " + studentDetailsModel.Group +
                            @".  As dori sa fac contestatie.
               
                -Multumesc!";

            message.Body = new TextPart("plain")
            {
                Text = emailText
            };

            using (var client = new SmtpClient())
            {
                // For demo-purposes, accept all SSL certificates (in case the server supports STARTTLS)
                client.ServerCertificateValidationCallback = (s, c, h, e) => true;

                client.Connect("smtp.gmail.com", 465, true);

                // Note: only needed if the SMTP server requires authentication
                client.Authenticate("*****@*****.**", "mypassword.notsarcastic");

                client.Send(message);
                client.Disconnect(true);
            }
        }
예제 #3
0
        public ActionResult SavePersonalDetails(FormCollection formCollection)
        {
            PersonalDetails personalDetails = new PersonalDetails();

            if (!string.IsNullOrEmpty(formCollection["PersonalDetails.ApplicantName"]))
            {
                personalDetails.ApplicantName = formCollection["PersonalDetails.ApplicantName"].ToString();
            }
            if (!string.IsNullOrEmpty(formCollection["PersonalDetails.MotherName"]))
            {
                personalDetails.MotherName = formCollection["PersonalDetails.MotherName"].ToString();
            }
            if (!string.IsNullOrEmpty(formCollection["PersonalDetails.FatherName"]))
            {
                personalDetails.FatherName = formCollection["PersonalDetails.FatherName"].ToString();
            }
            if (!string.IsNullOrEmpty(formCollection["PersonalDetails.RegistrationNo"]))
            {
                personalDetails.RegistrationNo = formCollection["PersonalDetails.RegistrationNo"].ToString();
            }
            if (!string.IsNullOrEmpty(formCollection["PersonalDetails.NatureOfDocument"]))
            {
                personalDetails.NatureOfDocument = formCollection["PersonalDetails.NatureOfDocument"].ToString();
            }
            if (!string.IsNullOrEmpty(formCollection["PersonalDetails.ReasonOfApplying"]))
            {
                personalDetails.ReasonOfApplying = formCollection["PersonalDetails.ReasonOfApplying"].ToString();
            }
            StudentDetailsDal   studentDetailsDal   = new StudentDetailsDal();
            StudentDetailsModel studentDetailsModel = new StudentDetailsModel();

            studentDetailsModel.PersonalDetails = personalDetails;
            personalDetails.StudentId           = studentDetailsDal.AddPersonalDetails(personalDetails);
            return(PartialView("PersonalDetails", studentDetailsModel));
        }
        public async Task <IActionResult> GetStudentDetails(int studentId)
        {
            StudentDetailsDto studentDetailsDto = await _studentService.GetStudentDetailsAsync(studentId);

            StudentDetailsModel studentDetailsModel = _mapper.Map <StudentDetailsModel>(studentDetailsDto);

            return(Ok(studentDetailsModel));
        }
예제 #5
0
        public static void ProfessorSendMail(GradeDetailsModel gradeDetailsModel, StudentDetailsModel student)
        {
            var message = new MimeMessage();

            message.From.Add(new MailboxAddress("Florin Olariu", "*****@*****.**"));
            message.To.Add(new MailboxAddress(student.Name, student.Email));
            message.Subject = "[" + gradeDetailsModel.ExamName + "]" + " Nota Examen";

            var attachment = new MimePart("image", "gif")
            {
                Content                 = new MimeContent(File.OpenRead($"..\\EMS.Presentation\\ClientApp\\src\\assets\\{gradeDetailsModel.ExamName}\\barem.png")),
                ContentDisposition      = new ContentDisposition(ContentDisposition.Attachment),
                ContentTransferEncoding = ContentEncoding.Base64,
                FileName                = Path.GetFileName($"..\\EMS.Presentation\\ClientApp\\src\\assets\\{gradeDetailsModel.ExamName}\\barem.png")
            };

            var body = new TextPart("plain")
            {
                Text = "Buna ziua, " + student.Name +
                       @"
                        Va anunt ca lucrarea dumneavoastra la materia " + gradeDetailsModel.ExamName +
                       " a fost corectata si nota este " + gradeDetailsModel.Value +
                       @".
                        Intrati in aplicatie si alegeti daca sunteti de acord cu aceasta nota sau nu. 
                        Mai jos am atasat baremul." +
                       "-O zi buna!"
            };


            var multipart = new Multipart("mixed");

            multipart.Add(body);
            multipart.Add(attachment);

            message.Body = multipart;

            using (var client = new SmtpClient())
            {
                // For demo-purposes, accept all SSL certificates (in case the server supports STARTTLS)
                client.ServerCertificateValidationCallback = (s, c, h, e) => true;

                client.Connect("smtp.gmail.com", 465, true);

                // Note: only needed if the SMTP server requires authentication
                client.Authenticate("*****@*****.**", "mypassword.notsarcastic");

                client.Send(message);
                client.Disconnect(true);
            }
        }
        public async Task <IActionResult> TeacherIndex()
        {
            List <StudentDetailsModel> students = new List <StudentDetailsModel>();
            string roleName = "Student";
            var    users    = await _userManager.GetUsersInRoleAsync(roleName);

            foreach (var item in users)
            {
                var model = new StudentDetailsModel();
                model.Id          = item.Id;
                model.StudentName = item.UserName;
                students.Add(model);
            }
            return(View(students));
        }
예제 #7
0
        // GET: Student/Details/5
        public async Task <IActionResult> Details(int?id)
        {
            if (id == null)
            {
                return(NotFound());
            }
            var model = new StudentDetailsModel();

            model.Student = await stu.GetByIdAsync(id.Value);

            var clse = cls.GetClassByStudentId(id.Value);

            model.className = clse.Name;
            if (model == null)
            {
                return(NotFound());
            }

            return(View(model));
        }
예제 #8
0
        private void StudentDataInsertAndUpdate()
        {
            try
            {
                if (IsNewStudent)
                {
                    _studentDetails           = new StudentDetailsModel();
                    _studentDetails.StudentID = GetLastStudentID();
                }
                if (IsAdmin)
                {
                    _studentDetails.Name         = editTextEditName.Text.Trim();
                    _studentDetails.Gender       = GetRadiobuttonValue();
                    _studentDetails.StudentClass = editTextClass.Text.Trim();
                }
                _studentDetails.Birthdate  = textViewEditBirthDate.Text.Trim();
                _studentDetails.Address    = editTextEditAddress.Text.Trim();
                _studentDetails.Street     = editTextEditStreet.Text.Trim();
                _studentDetails.State      = editTextEditState.Text.Trim();
                _studentDetails.City       = editTextEditCity.Text.Trim();
                _studentDetails.PostalCode = editTextEditPostalCode.Text.Trim();
                _studentDetails.Country    = editTextEditCountry.Text.Trim();
                _studentDetails.ContactNo  = editTextEditContactNo.Text.Trim();
                _studentDetails.EmailID    = editTextEditEmail.Text.Trim();

                if (IsNewStudent)
                {
                    //New insert student
                    _studentDetailsViewModel.SaveStudentData(_studentDetails, IsAdmin);
                }
                else
                {
                    //Update Student
                    _studentDetailsViewModel.UpdateStudentData(_studentDetails, IsAdmin);
                }
            }
            catch (Exception Ex)
            {
                Console.WriteLine(Ex.Message);
            }
        }
        public async Task <StudentDetailsModel> GetStudentDetailsAsync(Guid id)
        {
            var channel = new Channel(channelTarget, ChannelCredentials.Insecure);

            try
            {
                var client  = new StudentsGrpcService.StudentsGrpcServiceClient(channel);
                var request = new GetStudentDetailsRequest()
                {
                    Id = id.ToString()
                };

                var student = await client.GetStudentDetailsAsync(request);

                var studentModel = new StudentDetailsModel()
                {
                    Id          = Guid.Parse(student.Id),
                    Name        = student.Name,
                    Address     = student.Address,
                    YearOfBirth = student.YearOfBirth,
                    Grades      = student.Grades.Select(g => new GradeModel()
                    {
                        CourseName = g.CourseName,
                        CourseId   = Guid.Parse(g.CourseId),
                        Marks      = g.Marks.ToList()
                    }).ToList()
                };


                return(studentModel);
            }
            finally
            {
                await channel.ShutdownAsync();
            }
        }
예제 #10
0
        public static void ProfessorSendMailUpdate(GradeDetailsModel gradeDetailsModel, StudentDetailsModel student)
        {
            var message = new MimeMessage();

            message.From.Add(new MailboxAddress("Florin Olariu", "*****@*****.**"));
            message.To.Add(new MailboxAddress(student.Name, student.Email));
            message.Subject = "[" + gradeDetailsModel.ExamName + "]" + " Nota Examen";

            var body = new TextPart("plain")
            {
                Text = "Buna ziua, " + student.Name +
                       @"
                        Va anunt ca lucrarea dumneavoastra la materia " + gradeDetailsModel.ExamName +
                       " a fost recorectata si nota este " + gradeDetailsModel.Value +
                       "-O zi buna!"
            };


            var multipart = new Multipart("mixed");

            multipart.Add(body);

            message.Body = multipart;

            using (var client = new SmtpClient())
            {
                // For demo-purposes, accept all SSL certificates (in case the server supports STARTTLS)
                client.ServerCertificateValidationCallback = (s, c, h, e) => true;

                client.Connect("smtp.gmail.com", 465, true);

                // Note: only needed if the SMTP server requires authentication
                client.Authenticate("*****@*****.**", "mypassword.notsarcastic");

                client.Send(message);
                client.Disconnect(true);
            }
        }
예제 #11
0
        private string BindAddress(StudentDetailsModel studentDetails)
        {
            StringBuilder strAddress = new StringBuilder();

            if (!string.IsNullOrEmpty(studentDetails.Address))
            {
                strAddress.AppendLine(studentDetails.Address);
                editTextEditAddress.Text = studentDetails.Address;
            }
            else
            {
                editTextEditAddress.Text = string.Empty;
            }

            if (!string.IsNullOrEmpty(studentDetails.Street))
            {
                strAddress.Append(studentDetails.Street);
                editTextEditStreet.Text = studentDetails.Street;
            }
            else
            {
                editTextEditStreet.Text = string.Empty;
            }

            if (!string.IsNullOrEmpty(studentDetails.City))
            {
                strAddress.Append("," + studentDetails.City);
                editTextEditCity.Text = studentDetails.City;
            }
            else
            {
                editTextEditCity.Text = string.Empty;
            }

            if (!string.IsNullOrEmpty(studentDetails.State))
            {
                strAddress.Append("," + studentDetails.State);
                editTextEditState.Text = studentDetails.State;
            }
            else
            {
                editTextEditState.Text = string.Empty;
            }

            if (!string.IsNullOrEmpty(studentDetails.Country))
            {
                strAddress.Append("," + studentDetails.Country);
                editTextEditCountry.Text = studentDetails.Country;
            }
            else
            {
                editTextEditCountry.Text = string.Empty;
            }

            if (!string.IsNullOrEmpty(studentDetails.PostalCode))
            {
                strAddress.Append("," + studentDetails.PostalCode);
                editTextEditPostalCode.Text = studentDetails.PostalCode;
            }
            else
            {
                editTextEditPostalCode.Text = string.Empty;
            }
            return(strAddress.ToString());
        }
예제 #12
0
 private void GetStudentData()
 {
     _studentDetailsViewModel.GetStudentData(StudentID);
     _studentDetails = _studentDetailsViewModel.studentDetails;
 }
예제 #13
0
        public ActionResult Index()
        {
            StudentDetailsModel studentDetailsModel = new StudentDetailsModel();

            return(View(studentDetailsModel));
        }