Exemplo n.º 1
0
        protected void uiLinkButtonUploadVisaResult_Click(object sender, EventArgs e)
        {
            Student student = (Student)Session["CurrentUser"];
            ApplicationData app = new ApplicationData();
            app.GetApplicationByStudentID(student.StudentID);

            ApplicationStatusHistory Apphistroy = new ApplicationStatusHistory();
            Apphistroy.GetApplicationStatusHistorybyApplicationDataID(app.ApplicationDataID);

            if (uiFileUploadVisaResult.HasFile)
            {

                string path = "/files/" + Guid.NewGuid() + "_" + uiFileUploadVisaResult.FileName;
                uiFileUploadVisaResult.SaveAs(Server.MapPath("~" + path));
                Apphistroy.VisaResult = path;
                Apphistroy.Save();
                uiPanelVisaSucc.Visible = true;
                uiPanelVisaFail.Visible = false;
            }
            else
            {
                uiPanelVisaSucc.Visible = false;
                uiPanelVisaFail.Visible = true;
            }
        }
Exemplo n.º 2
0
        protected void uiLinkButtonUpload_Click(object sender, EventArgs e)
        {
            Student student = (Student)Session["CurrentUser"];

            ApplicationData application = new ApplicationData();
            application.GetApplicationByStudentID(student.StudentID);

            ApplicationStatusHistory history = new ApplicationStatusHistory();
            history.GetApplicationStatusHistorybyApplicationDataID(application.ApplicationDataID);

            if (uiFileUploadReceipt.HasFile)
            {
                string path = "/files/" + DateTime.Now.ToString("ddMMyyyyhhmmss_") + uiFileUploadReceipt.FileName;
                uiFileUploadReceipt.SaveAs(Server.MapPath("~" + path));
                history.WireTranseferReceipt = path;
                history.Save();

                /* add payment fields */

                history.PaymentAmount = (history.IsColumnNull("TuitionFees")) ? 1500 : history.TuitionFees;
                history.PaymentDate = DateTime.Now;
                history.CardType = "";
                history.CardNo = "";
                history.Save();

                uiPanelSuccess.Visible = true;
                uiPanelFail.Visible = false;
            }
            else
            {
                uiPanelSuccess.Visible = false;
                uiPanelFail.Visible = true;
            }
        }
Exemplo n.º 3
0
        protected void uiLinkButtonSaveDate_Click(object sender, EventArgs e)
        {
            Student student = (Student)Session["CurrentUser"];
            ApplicationData app = new ApplicationData();
            app.GetApplicationByStudentID(student.StudentID);

            ApplicationStatusHistory Apphistroy = new ApplicationStatusHistory();
            Apphistroy.GetApplicationStatusHistorybyApplicationDataID(app.ApplicationDataID);

            if (!string.IsNullOrEmpty( uiTextBoxVisaDate.Text))
            {
                try
                {
                    DateTime visadate = Convert.ToDateTime(uiTextBoxVisaDate.Text);

                    Apphistroy.VisaAppointMentDate = visadate;
                    Apphistroy.Save();
                    uiPanelVSSucess.Visible = true;
                    uiPanelVSFail.Visible = false;
                }
                catch (Exception ex)
                {
                    uiPanelVSSucess.Visible = false;
                    uiPanelVSFail.Visible = true;
                }
            }
            else
            {
                uiPanelVSSucess.Visible = false;
                uiPanelVSFail.Visible = true;
            }
        }
Exemplo n.º 4
0
        protected void uiLinkButtonByPass_Click(object sender, EventArgs e)
        {
            Student student = (Student)Session["CurrentUser"];

            ApplicationData application = new ApplicationData();
            application.GetApplicationByStudentID(student.StudentID);

            ApplicationStatus next = new ApplicationStatus();
            next.GetNextApplicationStatusApplicationDataID(application.ApplicationDataID);

            ApplicationStatusHistory history = new ApplicationStatusHistory();
            history.GetApplicationStatusHistorybyApplicationDataID(application.ApplicationDataID);

            history.AddNew();
            history.StudentID = student.StudentID;
            history.ApplicationDataID = application.ApplicationDataID;
            history.StatusDate = DateTime.Now;

            history.ApplicationStatusID = next.ApplicationStatusID;
            history.Save();

            Response.Redirect("checkapp");
        }
Exemplo n.º 5
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                if (Session["CurrentAdminUser"] == null)
                {
                    Response.Redirect("adminlogin");
                }

                if (StatusHistoryID != 0)
                {
                    ApplicationStatusHistory history = new ApplicationStatusHistory();
                    history.LoadByPrimaryKey(StatusHistoryID);

                    uiReportViewer.LocalReport.ReportPath = "admin/EDUReceipt.rdlc";
                    uiReportViewer.LocalReport.EnableExternalImages = true;

                    uiReportViewer.LocalReport.DataSources.Clear();

                    uiReportViewer.LocalReport.DataSources.Add(new Microsoft.Reporting.WebForms.ReportDataSource("AppReceiptDataSet", history.DefaultView));
                    uiReportViewer.LocalReport.Refresh();
                }
            }
        }
Exemplo n.º 6
0
        private void BindHistory()
        {
            ApplicationData app = new ApplicationData();
            app.LoadByPrimaryKey(CurrentApp);

            ApplicationStatusHistory history = new ApplicationStatusHistory();
            history.GetApplicationStatusHistorybyApplicationDataID(app.ApplicationDataID);

            uiGridViewStatusHistory.DataSource = history.DefaultView;
            uiGridViewStatusHistory.DataBind();
        }
Exemplo n.º 7
0
        private void BindApplicationData()
        {
            ApplicationData app = new ApplicationData();
            app.LoadByPrimaryKey(CurrentApp);

            Course course = new Course();
            CourseLangauge lang = new CourseLangauge();
            if (!app.IsColumnNull("SelectedCourseID"))
                course.LoadByPrimaryKey(app.SelectedCourseID);
            if (course.RowCount > 0 && !course.IsColumnNull("CourseLangaugeID"))
                lang.LoadByPrimaryKey(course.CourseLangaugeID);

            uiImageMain.ImageUrl = ".." + app.RecentPhotoPath;
            uiLabelName.Text = app.FirstName + " " + app.FamilyName;
            uiLabelMail.Text = app.Email;
            if (course.RowCount > 0)
                uiLabelCourse.Text = course.CourseName;
            else
                uiLabelCourse.Text = "not selected";
            if(lang.RowCount > 0)
                uiLabelLang.Text = lang.Langauge;
            else
                uiLabelLang.Text = "not selected";

            ApplicationStatusHistory history = new ApplicationStatusHistory();
            history.GetApplicationStatusHistorybyApplicationDataID(CurrentApp);

            if (history.RowCount > 0 && (history.ApplicationStatusID == 4 || history.ApplicationStatusID == 5)) // Tuition  Fees - missing docs - refusal reasons
            {
                uiPanelFees.Visible = true;
                uiPanelMissingDocs.Visible = true;
                uiPanelRefusalReasons.Visible = true;
            }
            else
            {
                uiPanelFees.Visible = false;
                uiPanelMissingDocs.Visible = false;
                uiPanelRefusalReasons.Visible = false;
            }

            BindHistory();

            ApplicationStatus status = new ApplicationStatus();
            status.GetNextApplicationStatusApplicationDataID(CurrentApp);
            if(status.RowCount > 0)
                uiDropDownListStatus.DataSource = status.DefaultView;
            else if(history.RowCount > 0)
            {
                ApplicationStatus next = new ApplicationStatus();

                status.LoadByPrimaryKey(history.ApplicationStatusID);

                next.Where.ParentStatusID.Value = status.ParentStatusID;
                next.Where.ParentStatusID.Operator = MyGeneration.dOOdads.WhereParameter.Operand.Equal;
                next.Query.Load();
                uiDropDownListStatus.DataSource = next.DefaultView;
            }
            uiDropDownListStatus.DataTextField = ApplicationStatus.ColumnNames.Status;
            uiDropDownListStatus.DataValueField = ApplicationStatus.ColumnNames.ApplicationStatusID;
            uiDropDownListStatus.DataBind();
            uiDropDownListStatus.Items.Insert(0, new ListItem("select new status ... ", "0"));
        }
Exemplo n.º 8
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();
            }
        }
Exemplo n.º 9
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 = (Student)Session["CurrentUser"];

            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.HairColor = uiDropDownListHairColor.SelectedValue;
            application.EyeColor = uiDropDownListEyeColor.SelectedValue;
            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/" + Guid.NewGuid() + "_" + 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();

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

                if (Files.Count > 0)
                {
                    ApplicationAttachment attachments = new ApplicationAttachment();
                    foreach (DictionaryEntry item in Files)
                    {
                        attachments.AddNew();
                        attachments.ApplicationDataID = application.ApplicationDataID;
                        attachments.ApplicationStatusID = 3;  // Payment of International Student Filing Fees
                        attachments.FilePath = item.Value.ToString();
                    }
                    attachments.Save();
                    attachments.GetAttachmentsForNotSubmittedApplication(application.ApplicationDataID);
                    if (attachments.RowCount > 0)
                    {
                        for (int i = 0; i < attachments.RowCount; i++)
                        {
                            attachments.ApplicationStatusID = 3;
                            attachments.MoveNext();
                        }
                        attachments.Save();
                    }

                    Session["CurrentUploadedFiles"] = null;
                }

            }

            ApplicationStatusHistory history = new ApplicationStatusHistory();
            history.AddNew();
            history.StudentID = student.StudentID;
            history.ApplicationDataID = application.ApplicationDataID;
            history.StatusDate = DateTime.Now;

            // Payment of International Student Filing Fees
            history.ApplicationStatusID = 3;
            history.Save();
            Session["CurrentPaymentAmount"] = "1500";
            Response.Redirect("paymentmethod?start=1");
        }
Exemplo n.º 10
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if(!IsPostBack)
            {
                if (Request.QueryString["trx"] != null)
                {
                    uiLabeltrx.Text = Request.QueryString["trx"].ToString();

                    Student student = (Student)Session["CurrentUser"];

                    ApplicationData app = new ApplicationData();
                    app.GetApplicationByStudentID(student.StudentID);

                    ApplicationStatusHistory history = new ApplicationStatusHistory();
                    history.GetApplicationStatusHistorybyApplicationDataID(app.ApplicationDataID);

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

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

                    CourseLangauge lang = new CourseLangauge();
                    lang.LoadByPrimaryKey(course.CourseLangaugeID);

                    ReportParameter[] parameters = new ReportParameter[5];
                    parameters[0] = new ReportParameter("TrxID", Request.QueryString["trx"].ToString());
                    parameters[1] = new ReportParameter("Amount", Request.QueryString["a"].ToString());
                    parameters[2] = new ReportParameter("Date", Request.QueryString["d"].ToString());
                    parameters[3] = new ReportParameter("CardType", Request.QueryString["ct"].ToString());
                    parameters[4] = new ReportParameter("CardNo", Request.QueryString["cn"].ToString());
                    ReportViewer1.LocalReport.ReportPath = "Receipt.rdlc";

                    /* add payment fields */
                    history.TrxID = Request.QueryString["trx"].ToString();
                    history.PaymentAmount = Convert.ToDecimal(Request.QueryString["a"].ToString());
                    history.PaymentDate = DateTime.Parse(Request.QueryString["d"].ToString());
                    history.CardType = Request.QueryString["ct"].ToString();
                    history.CardNo = Request.QueryString["cn"].ToString();
                    history.Save();

                    /*ReportViewer1.LocalReport.DataSources.Clear();
                    ReportViewer1.LocalReport.DataSources.Add(new ReportDataSource());*/

                    ReportViewer1.LocalReport.SetParameters(parameters);

                    ReportViewer1.LocalReport.Refresh();

                    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;

                            msg.Attachments.Add(new Attachment(Server.MapPath("~/files/Refund_Policy_Agreement.pdf")));

                            msg.Body = string.Format(Server.HtmlDecode(template.Body.Replace('\r', ' ').Replace('\n', ' ')), student.FirstName + " " + student.FamilyName, student.Email, course.CourseName + " - " + lang.Langauge);

                            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;
                        }
                    }
                }
            }
        }
Exemplo n.º 11
0
        private void BindHistory()
        {
            Student student = (Student)Session["CurrentUser"];
            ApplicationData app = new ApplicationData();
            app.GetApplicationByStudentID(student.StudentID);
            if (app.RowCount > 0 && app.IsSubmit == true)
            {
                ApplicationStatusHistory Apphistroy = new ApplicationStatusHistory();
                Apphistroy.GetApplicationStatusHistorybyApplicationDataID(app.ApplicationDataID);

                ApplicationStatus status = new ApplicationStatus();
                status.LoadByPrimaryKey(Apphistroy.ApplicationStatusID);

                uiLabelStatusName.Text = status.Status;
                uiImageCurrentStatus.ImageUrl = status.StatusImg;
                uiImageCurrentStatus.AlternateText = status.Status;

                uiGridViewStatusHistory.DataSource = Apphistroy.DefaultView;
                uiGridViewStatusHistory.DataBind();

                if (status.ApplicationStatusID == 3) // application fees
                {
                    TuitionFeesTitle.Visible = false;
                    uiPanelTuitionFeesBody.Visible = false;
                    AppPaymentTitle.Visible = true;
                    uiPanelAppPayment.Visible = true;
                    uiLabelAppAmount.Text = "1500";
                    Session["CurrentPaymentAmount"] = "1500";
                    ClientScript.RegisterStartupScript(this.GetType(), "openPayment", "$(document).ready(function(){ $('#paymentPopup').modal('show'); });", true);
                }

                if (status.ApplicationStatusID == 7 ) // Tuition  Fees
                {
                    TuitionFeesTitle.Visible = true;
                    uiPanelTuitionFeesBody.Visible = true;
                    AppPaymentTitle.Visible = false;
                    uiPanelAppPayment.Visible = false;
                    uiLabelAmount.Text = Apphistroy.TuitionFees.ToString();
                    Session["CurrentPaymentAmount"] = Apphistroy.TuitionFees.ToString();
                    ClientScript.RegisterStartupScript(this.GetType(), "openPayment", "$(document).ready(function(){ $('#paymentPopup').modal('show'); });", true);
                }

                // visa result
                uiPanelVisaResult.Visible = (status.ApplicationStatusID == 14);

                // visa date
                uiPanelVisaSchedule.Visible = (status.ApplicationStatusID == 12);

            }
            else
                Response.Redirect("apply");
        }
Exemplo n.º 12
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                string amount = "0";
                Student student = (Student)Session["CurrentUser"];

                ApplicationData application = new ApplicationData();
                application.GetApplicationByStudentID(student.StudentID);

                ApplicationStatusHistory history = new ApplicationStatusHistory();
                history.GetApplicationStatusHistorybyApplicationDataID(application.ApplicationDataID);

                if (history.ApplicationStatusID == 3)
                {
                    amount = "1500";
                    //amount = "0.01";
                }
                else
                {
                    amount = history.TuitionFees.ToString();
                }

                using (var wb = new WebClient())
                {
                    var data = new NameValueCollection();
                    // [email protected]
                    //data["merchant_id"] = "d5365b0304";
                    //data["key"] = "71e19c6b83a20732d89be47ed4b96fa4ccbc05d9";

                    // [email protected]
                    data["merchant_id"] = "dd19a290a5";
                    data["key"] = "d12336b277dc7dd42119a8745adeab14a08ea113";
                    data["amount"] = amount;
                    data["token"] = Request["token"];
                    data["first_name"] = Request["first_name"];
                    data["last_name"] = Request["last_name"];
                    data["currency"] = "CA$";
                   // data["test_mode"] = "true";
                    string url = "https://ecom.payfirma.com/sale";

                    byte[] ServerResponse = wb.UploadValues(url, "POST", data);
                    string responsetext = Encoding.ASCII.GetString(ServerResponse);

                    JavaScriptSerializer parser = new JavaScriptSerializer();
                    var info = parser.Deserialize<PayfirmaResponse>(responsetext);

                    if (info.result == "approved")
                    {

                        ApplicationStatus next = new ApplicationStatus();
                        next.GetNextApplicationStatusApplicationDataID(application.ApplicationDataID);

                        history.AddNew();
                        history.StudentID = student.StudentID;
                        history.ApplicationDataID = application.ApplicationDataID;
                        history.StatusDate = DateTime.Now;

                        history.ApplicationStatusID = next.ApplicationStatusID;
                        history.Save();
                    }
                    Response.Clear();
                    Response.Write(responsetext);
                    Response.End();
                }
            }
        }