protected void btnsubmit_Click(object sender,EventArgs e) { MembershipCreateStatus status; Membership.CreateUser(txtFacultyemailid.Text, txtFacultypassword.Text, txtFacultyemailid.Text, "Que", "Ans", true, out status); if (status == MembershipCreateStatus.Success) { Roles.AddUserToRole(txtFacultyemailid.Text, "faculty"); clsFaculty f = new clsFaculty(); f.Faculty_name = txtFacultyname.Text; f.Faculty_email = txtFacultyemailid.Text; f.Faculty_password = txtFacultypassword.Text; f.Faculty_contactno = txtFacultycontactno.Text; f.Faculty_address = txtFacultyaddress.Text; f.Faculty_AreaOfInterest = txtFacultyAreaOfInterest.Text; f.Faculty_Experience = txtFacultyExperience.Text; f.Faculty_courseid = Convert.ToInt32(txtFacultycourseid.Text); f.Faculty_batchno = Convert.ToInt32(txtFacultybatchno.Text); if (fileupload.HasFile) { string filename = Path.GetFileName(fileupload.PostedFile.FileName); string path = "../images/" + filename; fileupload.SaveAs(Server.MapPath("~/images/") + filename); f.Faculty_Image= path; // Page.ClientScript.RegisterClientScriptBlock(typeof(Page), "Alert", "alert('Image saved!')", true); } if (!string.IsNullOrEmpty(txtFacultyname.Text) && !string.IsNullOrEmpty(txtFacultyemailid.Text) && !string.IsNullOrEmpty(txtFacultypassword.Text) && !string.IsNullOrEmpty(txtFacultycontactno.Text) && !string.IsNullOrEmpty(txtFacultyaddress.Text) && !string.IsNullOrEmpty(txtFacultyAreaOfInterest.Text) && !string.IsNullOrEmpty(txtFacultyExperience.Text) && !string.IsNullOrEmpty(txtFacultycourseid.Text) && !string.IsNullOrEmpty(txtFacultybatchno.Text)) { try { f.addFaculty(f); string body = "Congratulations" + f.Faculty_name+ "You are successfully registered as Faculty. Welcome to Hare Krishna Diamond Institute"; mailing ms = new mailing(); ms.SendEmail(f.Faculty_email, "Faculty Confirmation", body); } catch (Exception ex) { Membership.DeleteUser(txtFacultyemailid.Text); } bindfacultygrid(); pnlData.Visible = true; pnlForm.Visible = false; txtFacultyname.Text = ""; txtFacultyemailid.Text = ""; txtFacultypassword.Text = ""; txtFacultycontactno.Text = ""; txtFacultyaddress.Text = ""; txtFacultyAreaOfInterest.Text = ""; txtFacultyExperience.Text = ""; txtFacultycourseid.Text = ""; txtFacultybatchno.Text = ""; } } }
protected void btnsubmitstudent_Click(object sender, EventArgs e) { MembershipCreateStatus status; Membership.CreateUser(txtstudentemailid.Text, txtstudentpassword.Text, txtstudentemailid.Text, "Que", "Ans", true, out status); if (status == MembershipCreateStatus.Success) { Roles.AddUserToRole(txtstudentemailid.Text, "student"); clsStudent s = new clsStudent(); s.Student_name = txtstudentname.Text; s.Admission_Year_ID = Convert.ToInt32(ddCourse.SelectedValue); s.Contact_No = txtstudentcontactno.Text; s.Email = txtstudentemailid.Text; s.Password = txtstudentpassword.Text; s.Class_ID = Convert.ToInt32(drp_ClassID.SelectedValue); s.Current_Subject_ID =1; s.Faculty_ID =Convert.ToInt32(drpFaculty.SelectedValue); if (!string.IsNullOrEmpty(s.Student_name) && !string.IsNullOrEmpty(s.Contact_No) && !string.IsNullOrEmpty(s.Email) && !string.IsNullOrEmpty(s.Password) && !string.IsNullOrEmpty(drp_ClassID.SelectedValue) && !string.IsNullOrEmpty(drpFaculty.SelectedValue)) { try { s.addStudent(s); string body = "Congratulations" + s.Student_name + "You are successfully registered.Welcome to Hare Krishna Diamond Institute"; mailing ms = new mailing(); ms.SendEmail(s.Email, "Admission Registered", body); } catch (Exception ex) { Membership.DeleteUser(txtstudentemailid.Text); } bindstudentgrid(); pnldata.Visible = true; pnlform.Visible = false; txtstudentname.Text = ""; txtstudentemailid.Text = ""; txtstudentpassword.Text = ""; txtstudentcontactno.Text = ""; //ddCourse.SelectedValue= ""; drpFaculty.SelectedIndex= 0; txtCurrentSubject.Text = ""; } } }