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");
        }
        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"));
        }
        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");
        }
Beispiel #4
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();
                }
            }
        }