protected void btn_submit_Click(object sender, EventArgs e) { ClassSchoolRegistration classSchool = new ClassSchoolRegistration(); string result = string.Empty; try { string selectedpackage = this.hiddenFieild.Value.ToString(); if (selectedpackage == "Gold" || selectedpackage == "Silver" || selectedpackage == "Platinum") { if (JFunctions.UploadSingleFile(fileupload, "images/registeredSchools/") == "true") { result = classSchool.RegisterSchool(1, Convert.ToInt32(ddl_city.SelectedValue), Convert.ToInt32(txt_postalcode.Text), txt_username.Text, txt_password.Text, Convert.ToInt32(txt_accountPin.Text), txt_primaryEmailAddress.Text, txt_secondaryEmailAddress.Text, txt_contact_primary.Text, txt_contact_secondary.Text, txt_schoolName.Text, txt_ownername.Text, txt_foundedIn.Text, fileupload.FileName, Convert.ToInt32(ddl_schooltype.SelectedValue), txt_campusname.Text); if (result == "true") { Package objPackage = new Package(); objPackage.InitializePackageAttributes(selectedpackage, classSchool.myDatabase.GetLastValueByColumnName("school_id", "tbl_school")); if (objPackage.AssignPackage() == "true") { JFunctions.SendEmail(txt_primaryEmailAddress.Text, "CES - Registration", EmailBody()); Response.Write("<script>alert('An email has been sent to your primary email address which contain basic information about your account. You will be redirected to home page.');</script>"); } else { Response.Write("Regisration completed successfully, but package assingment is not completed due to an error."); } } else { Response.Write("not register"); } } else { Response.Redirect("image was not uploaded to server. Hence the registration process is cancelled. Please try again"); } } else { Response.Write("<script>alert('You have to select atleast one package.');</script>"); } } catch (Exception exception) { result = exception.ToString(); Response.Write(result); } }
protected void Page_Load(object sender, EventArgs e) { ClassSchoolRegistration schoolRegistration = new ClassSchoolRegistration(); school_id = schoolRegistration.GetSchoolIDByAuthorizedID(CurrentUser.AuthorizedID); }