protected void Page_Load(object sender, EventArgs e) { string pageName = Path.GetFileNameWithoutExtension(Page.AppRelativeVirtualPath); if (System.Web.HttpContext.Current.User != null) { loggedStatus = System.Web.HttpContext.Current.User.Identity.IsAuthenticated; if (loggedStatus) { DatabaseFunctions d = new DatabaseFunctions(); string UserID = Membership.GetUser().ProviderUserKey.ToString(); StudentID = d.GetCandidateID(UserID); Page.Form.Attributes.Add("enctype", "multipart/form-data"); if (!IsPostBack) { DatabaseFunctions db = new DatabaseFunctions(); DataSet appStatus = db.getApplication_ID(Request.QueryString["ApplicationID"].ToString()); if (appStatus.Tables[0].Rows.Count > 0) { if (appStatus.Tables[0].Rows[0]["formfilled"].ToString() != "Yes") { int programID = 0; DataSet ds = db.getProgramIDbyApplicationID(Convert.ToInt32(Request.QueryString["ApplicationID"].ToString())); if (ds.Tables[0].Rows.Count > 0) { programID = Convert.ToInt16(ds.Tables[0].Rows[0]["programID"].ToString()); ViewState["programID"] = programID; ViewState["formnum"] = (ds.Tables[0].Rows[0]["FormNumber"].ToString()); loadbirthDay_Dropdowns(); int JambForm = Convert.ToInt16(ds.Tables[0].Rows[0]["HasJambData"].ToString()); //1 int BioForm = Convert.ToInt16(ds.Tables[0].Rows[0]["HasBioDataSection"].ToString());//2 int OlevelForm = Convert.ToInt16(ds.Tables[0].Rows[0]["HasOlevelResult"].ToString());//3 int PreviousRecordForm = Convert.ToInt16(ds.Tables[0].Rows[0]["HasPreviousRecord"].ToString());//4 int CbtScheduleForm = Convert.ToInt16(ds.Tables[0].Rows[0]["HasCBTSchedule"].ToString());//5 int progressBarAlgo = 0; if (JambForm == 1) { progressBarAlgo = progressBarAlgo + 1; } if (BioForm == 1) { progressBarAlgo = progressBarAlgo + 1; } if (OlevelForm == 1) { progressBarAlgo = progressBarAlgo + 1; } if (PreviousRecordForm == 1) { progressBarAlgo = progressBarAlgo + 1; } if (CbtScheduleForm == 1) { progressBarAlgo = progressBarAlgo + 1; } int startingPercentage = 0; if (progressBarAlgo > 0) { startingPercentage = 100 / progressBarAlgo; } else { startingPercentage = 100; } progressBar.InnerHtml = "<div aria-valuemax=\"100\" aria-valuemin=\"0\" role=\"progressbar\" class=\"progress-bar progress-bar-striped active\" style=\"width: " + startingPercentage + "%;height:30px;font-size:30px;padding-top:5px\">" + startingPercentage + "%</div>"; ViewState["stepsIncrement"] = startingPercentage; ViewState["progressValue"] = startingPercentage; var dt = ds.Tables[0]; ViewState["panelInfo"] = dt; ViewState["NextPanel"] = ""; ViewState["PreviousPanel"] = ""; ViewState["CurrentPanel"] = ""; ViewState["previousPanelName"] = ""; ViewState["FirstPanel"] = ""; ViewState["CurrentPanelName"] = ""; string validationGroup = string.Empty; for (int c = 2; c < ds.Tables[0].Columns.Count; c++) { if (ds.Tables[0].Rows[0][c].ToString() == "1") { string colName = ds.Tables[0].Columns[c].ColumnName.ToString(); Panel paneltx = this.Master.FindControl("ContentPlaceHolder1").FindControl(colName) as Panel; if (paneltx != null) { if (ViewState["CurrentPanel"] == "") { if (colName == "HasJambData") { validationGroup = "appForm"; } else if (colName == "HasBioDataSection") { validationGroup = "appForm_biodata"; } else if (colName == "HasOlevelResult") { validationGroup = "appForm_Olevel"; } else if (colName == "HasPreviousRecord") { validationGroup = "appPreviousRecord"; } else if (colName == "HasCBTSchedule") { validationGroup = "appCBT"; } ViewState["previousPanelName"] = colName; ViewState["FirstPanel"] = colName; ViewState["CurrentPanelName"] = colName; paneltx.Visible = true; ViewState["CurrentPanel"] = c; loadTabsInfo(colName); btnSave.ValidationGroup = validationGroup; btnSave.Visible = true; } else { ViewState["NextPanel"] = c; btnNext.ValidationGroup = validationGroup; btnNext.Visible = true; break; } } } } lblCbtUsername.Text = ViewState["formnum"].ToString(); if (ViewState["NextPanel"] != "") { btnNext.Visible = true; btnNext.ValidationGroup = validationGroup; btnPreview.Visible = false; } else { btnSave.Visible = false; btnNext.Visible = false; btnPreview.ValidationGroup = validationGroup; btnPreview.Visible = true; } } string imgD = hidden_dpImage.Value; if (imgD != "") { imgDisplay.Src = "profilepics/" + imgD.ToString(); imgDisplay.Style.Add("display", "inline"); } } else { Response.Redirect("Profilepage.aspx"); } } } } else { Response.Redirect("Login.aspx?ReturnUrl=" + pageName + ".aspx"); } } }
protected void btnSubmit_Click(object sender, EventArgs e) { try { string applicationID = Request.QueryString["ApplicationID"].ToString(); // ScriptManager.RegisterStartupScript(this.Page, GetType(), "ClosePopup", "alertNew('Application Submitted Successfully !','0');", true); DatabaseFunctions db = new DatabaseFunctions(); db.updateApplicationStatus_Submit(Convert.ToInt32(applicationID)); DataSet appData = db.getApplication_ID((applicationID)); if (appData != null) { int programID = Convert.ToInt32(appData.Tables[0].Rows[0]["ProgramID"].ToString()); DataSet pDate = db.getProgramByID(programID); if (pDate.Tables[0].Rows.Count > 0) { int instantadmission = Convert.ToInt16(pDate.Tables[0].Rows[0]["InstantAdmission"].ToString()); if (instantadmission == 1) { string programName = appData.Tables[0].Rows[0]["programName"].ToString(); string CourseName = appData.Tables[0].Rows[0]["Course1"].ToString(); string campus = appData.Tables[0].Rows[0]["Campus"].ToString(); string regno = appData.Tables[0].Rows[0]["formnumber"].ToString(); db.insertInstantAdmissiondata(regno, programName, CourseName, campus); //db.AssignAcceptanceFee() ScriptManager.RegisterStartupScript(this.Page, GetType(), "ClosePopup2", "alertNew('You have been successfully awarded admission !','0');", true); DatabaseFunctions d = new DatabaseFunctions(); d.AssignAcceptanceFee(StudentID, programID, 0); ///// Generate acceptance fee and send a message. d.InsertIntoStudentInfoTableNew(programID, "ND1", StudentID, 0, 1, "0", DateTime.Now.Year.ToString()); int BatchID = d.GetBatchID(DateTime.Now.Year.ToString()); string matricno=DateTime.Now.Year+"-"+programName+"-"+StudentID; d.InsertIntoAddmissionTableNew(programID, StudentID, 0, "Merit", matricno, BatchID); double AcceptanceFee = d.GetAcceptanceFeeForProgram(programID); ///// Update Admission Status to 1 . ///// Insert Values to StudentInfo_tbl and AddmissionList (New One) if(AcceptanceFee!=-1) { string Message = "Acceptence Fee Of " +AcceptanceFee+ " Has Been Assigned to You <br> Please Submit This Fees with in One Week"; d.SendMessage(StudentID, Message, "Acceptance Fee", 0); } } else { ScriptManager.RegisterStartupScript(this.Page, GetType(), "ClosePopup", "alertNew('Application Submitted Successfully !','0');", true); } } } } catch (Exception ex) { ScriptManager.RegisterStartupScript(this.Page, GetType(), "ClosePopup", "alertNew('Error Submiting Application!','1');", true); } }