Пример #1
0
 protected void uiLinkButtonSignIn_Click(object sender, EventArgs e)
 {
     Student student = new Student();
     student.GetStudentByEmailAndPassword(uiTextBoxEmail.Text, uiTextBoxPassword.Text);
     if (student.RowCount > 0 && uiTextBoxEmail.Text == "Admin")
     {
         Session["CurrentAdminUser"] = student;
         Response.Redirect("applications");
     }
     else
     {
         uiPanelError.Visible = true;
     }
 }
Пример #2
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                Master.PageTitle = "Activate your account";
            }
            if (!string.IsNullOrEmpty(ActivationCode))
            {
                Guid ac;
                Guid.TryParse(ActivationCode, out ac);
                if (ac != Guid.Empty)
                {
                    Student student = new Student();
                    student.GetStudentByActivationCode(ac);
                    if (student.RowCount > 0)
                    {
                        student.IsActive = true;
                        student.Save();
                        EmailTemplates template = new EmailTemplates();
                        template.GetTemplateByStatusID(2); // send international studies info
                        try
                        {
                            MailMessage msg = new MailMessage();
                            string mail = ConfigurationManager.AppSettings["ActivationEMail"];
                            string mailto = student.Email;
                            msg.To.Add(mailto);
                            msg.From = new MailAddress(mail);
                            msg.Subject = template.Subject;
                            msg.IsBodyHtml = true;
                            msg.BodyEncoding = System.Text.Encoding.UTF8;

                            msg.Body = string.Format(Server.HtmlDecode(template.Body), student.FirstName + " " + student.FamilyName);

                            SmtpClient client = new SmtpClient(ConfigurationManager.AppSettings["mailserver"], 25);

                            client.UseDefaultCredentials = false;

                            client.Credentials = new System.Net.NetworkCredential(mail, ConfigurationManager.AppSettings["ActivationMailpass"]);
                            client.Send(msg);
                        }
                        catch (Exception)
                        {

                        }
                        uiPanelReActivate.Visible = false;
                        uiPanelActivated.Visible = true;
                        Session["CurrentUser"] = student;
                    }
                    else
                    {
                        uiPanelReActivate.Visible = true;
                        uiPanelActivated.Visible = false;
                    }

                }
                else
                {
                    uiPanelReActivate.Visible = true;
                    uiPanelActivated.Visible = false;
                }
            }
            else
            {
                uiPanelReActivate.Visible = true;
                uiPanelActivated.Visible = false;
            }
        }
Пример #3
0
        protected void uiLinkButtonActivate_Click(object sender, EventArgs e)
        {
            Student student = new Student();
            student.GetStudentByEmail(uiTextBoxEmail.Text);
            if (student.RowCount > 0)
            {
                uiLabelUserError.Visible = false;

                EmailTemplates template = new EmailTemplates();
                template.GetTemplateByStatusID(1); // activation required
                try
                {
                    MailMessage msg = new MailMessage();
                    string mail = ConfigurationManager.AppSettings["ActivationEMail"];
                    string mailto = uiTextBoxEmail.Text;
                    msg.To.Add(mailto);
                    msg.From = new MailAddress(mail);
                    msg.Subject = template.Subject;
                    msg.IsBodyHtml = true;
                    msg.BodyEncoding = System.Text.Encoding.Unicode;

                    msg.Body = string.Format(Server.HtmlDecode(template.Body), ConfigurationManager.AppSettings["ActivationURL"] + student.ActivationCode.ToString());

                    SmtpClient client = new SmtpClient(ConfigurationManager.AppSettings["mailserver"], 25);

                    client.UseDefaultCredentials = false;

                    client.Credentials = new System.Net.NetworkCredential(mail, ConfigurationManager.AppSettings["ActivationMailpass"]);
                    client.Send(msg);
                    uiPanelActivateSuccess.Visible = true;
                    //Response.Redirect("activate");
                }
                catch (Exception)
                {

                }
            }
            else
            {
                uiLabelUserError.Visible = true;
            }
        }
Пример #4
0
        protected void uiLinkButtonUpdate_Click(object sender, EventArgs e)
        {
            if (uiDropDownListStatus.SelectedIndex != 0 || uiDropDownListStatus.SelectedIndex != -1)
            {
                ApplicationData app = new ApplicationData();
                app.LoadByPrimaryKey(CurrentApp);

                ApplicationStatusHistory history = new ApplicationStatusHistory();
                history.AddNew();
                history.StudentID = app.StudentID;
                history.ApplicationDataID = app.ApplicationDataID;
                history.StatusDate = DateTime.Now;
                history.StatusComment = uiTextBoxComment.Text;
                history.ApplicationStatusID = Convert.ToInt32(uiDropDownListStatus.SelectedValue);
                if (uiDropDownListStatus.SelectedValue == "7") // Tuition  Fees
                {
                    decimal fees = 0;
                    decimal.TryParse(uiTextBoxFees.Text, out fees);
                    history.TuitionFees = fees;
                }
                history.Save();

                EmailTemplates template = new EmailTemplates();
                template.GetTemplateByStatusID(history.ApplicationStatusID);

                Student student = new Student ();
                student.LoadByPrimaryKey(app.StudentID);

                Course course = new Course();
                course.LoadByPrimaryKey(app.SelectedCourseID);

                CourseLangauge lang = new CourseLangauge();
                lang.LoadByPrimaryKey(course.CourseLangaugeID);
                if (template.RowCount > 0)
                {
                    try
                    {
                        MailMessage msg = new MailMessage();
                        string mail = ConfigurationManager.AppSettings["StatusEMail"];
                        string mailto = student.Email;
                        msg.To.Add(mailto);
                        msg.From = new MailAddress(mail);
                        msg.Subject = template.Subject.Replace('\r', ' ').Replace('\n', ' ');
                        msg.IsBodyHtml = true;
                        msg.BodyEncoding = System.Text.Encoding.UTF8;

                        string missingDocs = "";
                        for (int i = 0; i < uiCheckBoxListMissingDocs.Items.Count; i++)
                        {
                            if (uiCheckBoxListMissingDocs.Items[i].Selected)
                            {
                                missingDocs += "<li>" + uiCheckBoxListMissingDocs.Items[i].Text + "</li>";
                            }
                        }

                        string refusalReasons = "";
                        for (int i = 0; i < uiCheckBoxListRefusalReason.Items.Count; i++)
                        {
                            if (uiCheckBoxListRefusalReason.Items[i].Selected)
                            {
                                refusalReasons += "<li>" + uiCheckBoxListRefusalReason.Items[i].Text + "</li>";
                            }
                        }

                        msg.Body = string.Format(Server.HtmlDecode(template.Body.Replace('\r', ' ').Replace('\n', ' ')), student.FirstName + " " + student.FamilyName, student.Email, course.CourseName + " - " + lang.Langauge, missingDocs , refusalReasons, string.IsNullOrEmpty(uiTextBoxComment.Text) ? "N/A" : uiTextBoxComment.Text);

                        // attachments
                        if (Session["CurrentUploadedFiles"] != null)
                        {
                            Hashtable Files;
                            Files = (Hashtable)Session["CurrentUploadedFiles"];

                            if (Files.Count > 0)
                            {
                                AdminAttachment attachment = new AdminAttachment();
                                foreach (DictionaryEntry item in Files)
                                {
                                    msg.Attachments.Add(new Attachment(Server.MapPath("~" + item.Value.ToString())));
                                    attachment.AddNew();
                                    attachment.ApplicationDataID = history.ApplicationDataID;
                                    attachment.ApplicationStatusID = history.ApplicationStatusID;
                                    attachment.AttachmentPath = item.Value.ToString();

                                }
                                attachment.Save();
                                Session["CurrentUploadedFiles"] = null;
                            }

                        }

                        if (history.ApplicationStatusID == 16 || history.ApplicationStatusID == 6) // application refused - refund policy attached
                        {
                            msg.Attachments.Add(new Attachment(Server.MapPath("~/files/Refund_Policy_Agreement.pdf")));
                        }

                        SmtpClient client = new SmtpClient(ConfigurationManager.AppSettings["mailserver"], 25);

                        client.UseDefaultCredentials = false;

                        client.Credentials = new System.Net.NetworkCredential(mail, ConfigurationManager.AppSettings["StatusMailpass"]);
                        client.Send(msg);

                    }
                    catch (Exception)
                    {
                        throw;
                    }
                }
                //BindHistory();
                BindApplicationData();
                BindData();
            }
        }
Пример #5
0
        protected void uiLinkButtonFinish_Click(object sender, EventArgs e)
        {
            uiLabelError.Visible = false;
            int errortab = -1;
            if (uiDropDownListCOI.SelectedIndex == 0)
            {
                uiLabelError.Text += "<br />Country of issue is required.";
                errortab = 0;
            }
            if (uiDropDownListCountry.SelectedIndex == 0)
            {
                uiLabelError.Text += "<br />Citizenship is required.";
                errortab = 0;
            }
            if (uiDropDownListPOB.SelectedIndex == 0)
            {
                uiLabelError.Text += "<br />Place of birth is required.";
                errortab = 0;
            }
            if (uiDropDownListAddressCountry.SelectedIndex == 0)
            {
                uiLabelError.Text += "<br />Country for mailing address is required.";
                if (errortab == -1 || errortab > 2)
                    errortab = 2;
            }

            if (uiDropDownListCourses.SelectedIndex == -1)
            {
                uiLabelError.Text += "<br />Course is required.";
                if (errortab == -1 || errortab > 5)
                    errortab = 5;
            }

            if (errortab > -1)
            {
                ScriptManager.RegisterStartupScript(uiLinkButtonFinish, this.GetType(), "Error", "$(document).ready(function (){ $('#rootwizard').bootstrapWizard('show'," + errortab.ToString() + "); });", true);
                uiLabelError.Visible = true;
                return;
            }

            Student student = new Student();
            student.LoadByPrimaryKey(StudentID);

            ApplicationData application = new ApplicationData();
            application.GetApplicationByStudentID(student.StudentID);
            if (application.RowCount == 0)
                application.AddNew();

            application.FamilyName = uiTextBoxFamilyName.Text;
            application.FirstName = uiTextBoxFirstName.Text;
            application.MiddleName = uiTextBoxMiddleName.Text;
            application.DateOfBirth = DateTime.ParseExact(uiTextBoxDOB.Text, "dd/MM/yyyy", null);
            application.CountryOfBirthID = Convert.ToInt32(uiDropDownListPOB.SelectedValue);
            double height, weight = 0;
            double.TryParse(uiTextBoxHeight.Text, out height);
            double.TryParse(uiTextBoxWeight.Text, out weight);
            application.Hieght = height;
            application.Weight = weight;
            application.GenderID = Convert.ToInt32(uiRadioButtonListGender.SelectedValue);
            application.CitizenShipID = Convert.ToInt32(uiDropDownListCountry.SelectedValue);
            application.PassportNo = uiTextBoxPassNo.Text;
            application.PassportExpiryDate = DateTime.ParseExact(uiTextBoxPassExp.Text, "dd/MM/yyyy", null);
            application.CountryOfIssueID = Convert.ToInt32(uiDropDownListCOI.SelectedValue);

            if (uiFileUploadRecentPhoto.HasFile)
            {
                string path = "/files/" + DateTime.Now.ToString("ddMMyyyyhhmmss_") + uiFileUploadRecentPhoto.FileName;
                uiFileUploadRecentPhoto.SaveAs(Server.MapPath("~" + path));
                application.RecentPhotoPath = path;
            }

            application.FatherFamilyName = uiTextBoxFaFamilyName.Text;
            application.FatherFirstName = uiTextBoxFaFirstName.Text;
            application.FatherOccupation = uiTextBoxFaOccupation.Text;
            application.FatherHomePhone = uiTextBoxFaHomePhone.Text;
            application.FatherBusinessPhone = uiTextBoxFaBusPhone.Text;
            application.FatherCellPhone = uiTextBoxFaMobile.Text;
            application.MotherFamilyName = uiTextBoxMoFamilyName.Text;
            application.MotherFirstName = uiTextBoxMoFirstName.Text;
            application.MotherOccupation = uiTextBoxMoOccupation.Text;

            application.StreetAddress = uiTextBoxStreetAddress.Text;
            application.CountryID = Convert.ToInt32(uiDropDownListAddressCountry.SelectedValue);
            application.City = uiTextBoxCity.Text;
            application.TelephoneNumber = uiTextBoxAddTele.Text;
            application.FaxNumber = uiTextBoxAddFax.Text;
            application.Email = uiTextBoxEmail.Text;
            application.CellPhone = uiTextBoxCellphone.Text;

            application.ResidentAddress = uiTextBoxResAddress.Text;

            application.MasterDegree = uiTextBoxMDS.Text;
            application.University = uiTextBoxMDUniversity.Text;
            DateTime mdDate;
            DateTime.TryParseExact(uiTextBoxMDDate.Text, "dd/MM/yyyy", null, System.Globalization.DateTimeStyles.None, out mdDate);
            if (mdDate != DateTime.MinValue)
                application.DateOfGraduation = mdDate;

            application.BachelorDegree = uiTextBoxBach.Text;
            application.BachelorUniversity = uiTextBoxBachUni.Text;
            DateTime baDate;
            DateTime.TryParseExact(uiTextBoxBachDate.Text, "dd/MM/yyyy", null, System.Globalization.DateTimeStyles.None, out baDate);
            if (baDate != DateTime.MinValue)
                application.BachelorGraduationDate = baDate;

            application.HighScool = uiTextBoxHighSchool.Text;
            application.HighSchoolCollege = uiTextBoxHighCollege.Text;
            DateTime hDate;
            DateTime.TryParseExact(uiTextBoxHighDate.Text, "dd/MM/yyyy", null, System.Globalization.DateTimeStyles.None, out hDate);
            if (hDate != DateTime.MinValue)
                application.HighSchoolGradDate = hDate;

            application.DegreeSpecialization = uiTextBoxDS.Text;
            application.KindOfDegree = uiTextBoxKOD.Text;
            application.College = uiTextBoxCS.Text;
            DateTime dsDate;
            DateTime.TryParseExact(uiTextBoxDDOG.Text, "dd/MM/yyyy", null, System.Globalization.DateTimeStyles.None, out dsDate);
            if (dsDate != DateTime.MinValue)
                application.DegreeDateOfGraduation = dsDate;

            application.EnglishSpeak = Convert.ToInt16(uiHiddenFieldEnglishSpoken.Value);
            application.EnglishWritten = Convert.ToInt16(uiHiddenFieldEnglishWritten.Value);
            application.FrenchSpeak = Convert.ToInt16(uiHiddenFieldFrenchSpoken.Value);
            application.EnglishSpeak = Convert.ToInt16(uiHiddenFieldFrenchWritten.Value);
            application.StudentID = student.StudentID;
            application.SelectedCourseID = Convert.ToInt32(uiDropDownListCourses.SelectedValue);
            application.IsSubmit = true;
            application.Save();
        }
Пример #6
0
        private void BindFields()
        {
            Student student = new Student ();
            student.LoadByPrimaryKey(StudentID);
            ApplicationData app = new ApplicationData();
            app.GetApplicationByStudentID(student.StudentID);
            if (app.RowCount > 0 )
            {
                uiTextBoxFamilyName.Text = app.FamilyName;
                uiTextBoxFirstName.Text = app.FirstName;
                uiTextBoxMiddleName.Text = app.MiddleName;
                if (!(app.IsColumnNull("DateOfBirth")))
                    uiTextBoxDOB.Text = app.DateOfBirth.ToString("dd/MM/yyyy");
                if (!app.IsColumnNull("CountryOfBirthID"))
                    uiDropDownListPOB.SelectedValue = app.CountryOfBirthID.ToString();

                uiTextBoxHeight.Text = app.Hieght.ToString();
                uiTextBoxWeight.Text = app.Weight.ToString();

                uiRadioButtonListGender.SelectedValue = app.GenderID.ToString();
                if (!(app.IsColumnNull("CitizenShipID")))
                    uiDropDownListCountry.SelectedValue = app.CitizenShipID.ToString();
                uiTextBoxPassNo.Text = app.PassportNo;
                if (!app.IsColumnNull("PassportExpiryDate"))
                    uiTextBoxPassExp.Text = app.PassportExpiryDate.ToString("dd/MM/yyyy");
                if (!app.IsColumnNull("CountryOfIssueID"))
                    uiDropDownListCOI.SelectedValue = app.CountryOfIssueID.ToString();

                uiTextBoxFaFamilyName.Text = app.FatherFamilyName;
                uiTextBoxFaFirstName.Text = app.FatherFirstName;
                uiTextBoxFaOccupation.Text = app.FatherOccupation;
                uiTextBoxFaHomePhone.Text = app.FatherHomePhone;
                uiTextBoxFaBusPhone.Text = app.FatherBusinessPhone;
                uiTextBoxFaMobile.Text = app.FatherCellPhone;
                uiTextBoxMoFamilyName.Text = app.MotherFamilyName;
                uiTextBoxMoFirstName.Text = app.MotherFirstName;
                uiTextBoxMoOccupation.Text = app.MotherOccupation;

                uiTextBoxStreetAddress.Text = app.StreetAddress;
                if (!app.IsColumnNull("CountryID"))
                    uiDropDownListAddressCountry.SelectedValue = app.CountryID.ToString();
                uiTextBoxCity.Text = app.City;
                uiTextBoxAddTele.Text = app.TelephoneNumber;
                uiTextBoxAddFax.Text = app.FaxNumber;
                uiTextBoxEmail.Text = app.Email;
                uiTextBoxCellphone.Text = app.CellPhone;

                uiTextBoxResAddress.Text = app.ResidentAddress;

                uiTextBoxMDS.Text = app.MasterDegree;
                uiTextBoxMDUniversity.Text = app.University;
                if (!app.IsColumnNull("DateOfGraduation"))
                    uiTextBoxMDDate.Text = app.DateOfGraduation.ToString("dd/MM/yyyy");

                uiTextBoxBach.Text = app.BachelorDegree;
                uiTextBoxBachUni.Text = app.BachelorUniversity;
                if (!app.IsColumnNull("BachelorGraduationDate"))
                    uiTextBoxBachDate.Text = app.BachelorGraduationDate.ToString("dd/MM/yyyy");

                uiTextBoxHighSchool.Text = app.HighScool;
                uiTextBoxHighCollege.Text = app.HighSchoolCollege;
                if (!app.IsColumnNull("HighSchoolGradDate"))
                    uiTextBoxHighDate.Text = app.HighSchoolGradDate.ToString("dd/MM/yyyy");

                uiTextBoxDS.Text = app.DegreeSpecialization;
                uiTextBoxKOD.Text = app.KindOfDegree;
                uiTextBoxCS.Text = app.College;
                if (!app.IsColumnNull("DegreeDateOfGraduation"))
                    uiTextBoxDDOG.Text = app.DegreeDateOfGraduation.ToString("dd/MM/yyyy");

                if (!app.IsColumnNull("SelectedCourseID"))
                {
                    Course course = new Course();
                    course.LoadByPrimaryKey(app.SelectedCourseID);

                    uiDropDownListLanguage.SelectedValue = course.CourseLangaugeID.ToString();

                    Course courses = new Course();
                    courses.GetCourseByLanguageID(Convert.ToInt32(uiDropDownListLanguage.SelectedValue));
                    if (courses.RowCount > 0)
                        uiDropDownListCourses.DataSource = courses.DefaultView;
                    else
                        uiDropDownListCourses.DataSource = null;
                    uiDropDownListCourses.DataTextField = "DisplayName";
                    uiDropDownListCourses.DataValueField = Course.ColumnNames.CourseID;
                    uiDropDownListCourses.DataBind();

                    uiDropDownListCourses.SelectedValue = app.SelectedCourseID.ToString();
                }

            }
        }
Пример #7
0
        protected void uiLinkButtonSignUp_Click(object sender, EventArgs e)
        {
            Page.Validate();
            if (Page.IsValid)
            {
                if (uiDropDownListCountry.SelectedIndex != 0)
                {
                    uiLabelCountryError.Visible = false;
                    uiLabelUserExist.Visible = false;
                    Student student = new Student();
                    student.GetStudentByEmail(uiTextBoxEmail.Text);
                    if (student.RowCount > 0)
                    {
                        uiLabelUserExist.Visible = true;
                        return;
                    }
                    student.AddNew();
                    student.FamilyName = uiTextBoxFamilyName.Text;
                    student.FirstName = uiTextBoxFirstName.Text;
                    student.MiddleName = uiTextBoxMiddleName.Text;
                    student.DateOfBirth = DateTime.ParseExact(uiTextBoxDOB.Text, "dd/MM/yyyy", null);
                    student.CityofBirth = uiTextBoxPOB.Text;
                    student.CitizenShipID = Convert.ToInt32(uiDropDownListCountry.SelectedValue);
                    student.CellPhoneNumber = uiTextBoxMobile.Text;
                    student.Email = uiTextBoxEmail.Text;
                    student.UserPassword = uiTextBoxPassword.Text;
                    student.ActivationCode = Guid.NewGuid();
                    student.IsActive = false;
                    student.Save();

                    EmailTemplates template = new EmailTemplates();
                    template.GetTemplateByStatusID(1); // activation required
                    try
                    {
                        MailMessage msg = new MailMessage();
                        string mail = ConfigurationManager.AppSettings["ActivationEMail"];
                        string mailto = student.Email;
                        msg.To.Add(mailto);
                        msg.From = new MailAddress(mail);
                        msg.Subject = template.Subject;
                        msg.IsBodyHtml = true;
                        msg.BodyEncoding = System.Text.Encoding.Unicode;

                        msg.Body = string.Format(Server.HtmlDecode(template.Body), ConfigurationManager.AppSettings["ActivationURL"] + student.ActivationCode.ToString());

                        SmtpClient client = new SmtpClient(ConfigurationManager.AppSettings["mailserver"], 25);

                        client.UseDefaultCredentials = false;

                        client.Credentials = new System.Net.NetworkCredential(mail, ConfigurationManager.AppSettings["ActivationMailpass"]);
                        client.Send(msg);
                        Response.Redirect("activate");
                    }
                    catch (Exception)
                    {

                    }

                }
                else
                {
                    uiLabelCountryError.Visible = true;
                }

            }
            else
            {
                uiLabelCaptcha.Visible = true;
            }
        }