Exemple #1
0
        public ActionResult getStudentResponses(StudentEntry studentinfo)
        {
            Student student = new Student
            {
                FirstName               = studentinfo.firstName,
                LastName                = studentinfo.lastname,
                PhoneNumber             = studentinfo.phonenumber,
                Email                   = studentinfo.email,
                StudentGrade            = studentinfo.studentgrade,
                FirstParentFirstName    = studentinfo.parent1firstname,
                FirstParentPhoneNumber  = studentinfo.parent1phonenumber,
                FirstParentEmail        = studentinfo.parent1email,
                SecondParentFirstName   = studentinfo.parent2firstname,
                SecondParentPhoneNumber = studentinfo.parent2phonenumber,
                SecondParentEmail       = studentinfo.parent2email,
                Date = studentinfo.date
            };

            try
            {
                StudentClient tableStorage = new StudentClient();
                tableStorage.Add(student);
                return(Content("ok"));
            }
            catch (Exception ex)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.NotFound, ex.Message));
            }
        }
        public ActionResult getStudentResponses(Student pStudent)
        {
            try
            {
                StudentClient tableStorage = new StudentClient();
                tableStorage.Add(pStudent);
                //email to student
                string emailBody = EmailTemplateHelper.GetTemplate("StudentEmail");
                emailBody = string.Format(emailBody, pStudent.FirstName);
                EmailHelper.SendEmail(pStudent.Email, "*****@*****.**", "Your Registration Follow up", emailBody, true);
                //email to student's parent
                string emailBody2 = EmailTemplateHelper.GetTemplate("Parent_InitiatedByStudent");
                emailBody2 = string.Format(emailBody2, pStudent.FirstParentFirstName, pStudent.FirstName);
                EmailHelper.SendEmail(pStudent.FirstParentEmail, "*****@*****.**", "Following up on behalf of " + pStudent.FirstName, emailBody2, true);

                //if second parent's info was filled out, send email to second parent
                if (pStudent.SecondParentEmail != null)
                {
                    string emailBody3 = EmailTemplateHelper.GetTemplate("Parent_InitiatedByStudent");
                    emailBody3 = string.Format(emailBody3, pStudent.SecondParentFirstName, pStudent.FirstName);
                    EmailHelper.SendEmail(pStudent.SecondParentEmail, "*****@*****.**", "Following up on behalf of " + pStudent.FirstName, emailBody3, true);
                }
                return(Content(JsonConvert.SerializeObject(new { }), "application/json"));
            }
            catch (Exception ex)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.NotFound, ex.Message));
            }
        }
Exemple #3
0
        protected void btnAdd_Click(object sender, EventArgs e)
        {
            Student model = new Student();

            model.ID      = Convert.ToInt32(this.txt_id.Text);
            model.Name    = this.txt_name.Text;
            model.Age     = Convert.ToInt32(this.txt_age.Text);
            model.Grade   = this.txt_grade.Text;
            model.Address = this.txt_address.Text;
            if (proxy.Exist(model.ID))
            {
                proxy.Update(model);
            }
            else
            {
                proxy.Add(model);
            }

            BindData();
        }