protected void btnSubmit_Click(object sender, EventArgs e) { // Ensure that there is no validation errors if (Page.IsValid) { // Create a new object from the TuitionClass Class TuitionClass objClass = new TuitionClass(); // Pass details to Tutor objects with necessary conversion if needed // objClass.classid = Convert.ToInt32(lblClassID.Text); objClass.subject = lblSubject.Text; objClass.term = lblTerm.Text; objClass.startdate = Convert.ToDateTime(lblStartDate.Text); objClass.dayofweek = lblDayOfWeek.Text; objClass.timeslot = lblTimeSlot.Text; // objClass.numberofsessions = Convert.ToInt32(lblNumberOfSessions.Text); objClass.classroom = lblClassroom.Text; // Call method to add int error = objClass.add(); // Added successfully if Tutor.cs returned 1 if (error == 2) lblText.Text = "Adding of new class is successful"; else lblText.Text = "Adding of new class is unsucessful"; } }
protected void btnConfirm_Click(object sender, EventArgs e) { // Ensure that there is no validation errors if (Page.IsValid) { TuitionClass objClass = new TuitionClass(); // Combine details together string strValues; // strValues = "classid=" + lblClassID.Text; strValues = "&subject=" + txtSubject.Text; strValues += "&startdate=" + Server.UrlEncode(txtStartDate.Text); // strValues += "&numberofsession=" + lblNumberOfSessions.Text; strValues += "&term=" + ddlTerm.SelectedValue; strValues += "&dayofweek=" + ddlDayOfWeek.SelectedValue; strValues += "×lot=" + ddlTimeSlot.SelectedValue; strValues += "&classroom=" + ddlClassroom.SelectedValue; // Redirect the querystring to another page Response.Redirect("AdminConfirmAddClass.aspx?" + strValues); } }
protected void Page_Load(object sender, EventArgs e) { // populate the dropdownlist ddlTutor and ddlClass if (!Page.IsPostBack) { // populate the dropdownlist ddlTutor from the method TutorClass objTutor = new TutorClass(); DataSet ds = new DataSet(); int errorcode = objTutor.getTutorDetails(); if (errorcode == 0) { ddlTName.DataSource = ds.Tables["tutordetails"]; ddlTName.DataTextField = "TName"; ddlTName.DataBind(); txtStudentID.Text = Request.QueryString["StudentID"]; txtTitle.Text = Request.QueryString["Title"]; txtText.Text = Request.QueryString["Text"]; ddlTName.SelectedValue = Request.QueryString["TName"]; ddlTClass.SelectedValue = Request.QueryString["tuitionClassID"]; } TuitionClass objTuitionClass = new TuitionClass(); DataSet result = new DataSet(); int code = objTuitionClass.getTuitionDetails(); if (code == 0) { ddlTClass.DataSource = ds.Tables["tuitionclassdetails"]; ddlTClass.DataTextField = "tuitionClassID"; ddlTClass.DataBind(); ddlTName.SelectedValue = Convert.ToString(objTutor.name); ddlTClass.SelectedValue = Convert.ToString(objTuitionClass.tuitionClassID); } DiscussionTopic objDiscussionTopic = new DiscussionTopic(); DataSet ds1 = new DataSet(); int errorcode2 = objDiscussionTopic.getDiscussionTopicDetails(ref ds1); if (errorcode2 == 0) { txtTitle.Text = Request.QueryString["Title"]; txtText.Text = Request.QueryString["Text"]; } } }
protected void ddlTC_SelectedIndexChanged(object sender, EventArgs e) { int tuitionClassID = Convert.ToInt32(ddlTC.SelectedValue); TuitionClass objTuitionClass = new TuitionClass(); objTuitionClass.tuitionClassID = tuitionClassID; DataSet ds = new DataSet(); objTuitionClass.getTuitionDetails(ref ds); gvCT.DataSource = ds.Tables["tuitionclassdetails"]; gvCT.DataBind(); }
protected void btnYes_Click(object sender, EventArgs e) { TuitionClass objClass = new TuitionClass(); objClass.tuitionClassID = Convert.ToInt32(Request.QueryString["cid"]); int errorcode = objClass.delete(); if (errorcode == 1) lblMessage.Text = "Class successfully deleted"; if (errorcode == 0) lblMessage.Text = "Class was not deleted"; }
protected void btnConfirm_Click(object sender, EventArgs e) { TuitionClass objTC = new TuitionClass(); objTC.tutorid = 1; objTC.subject = lblSubject.Text; objTC.term = lblTerm.Text; objTC.startdate = Convert.ToDateTime(lblStartDate.Text); objTC.dayofweek = lblDayOfWeek.Text; objTC.timeslot = lblTimeSlot.Text; objTC.numsession = Convert.ToInt32(lblNumSession.Text); objTC.classroom = lblClassroom.Text; objTC.tuitionClassID = Convert.ToInt32(lblClassID.Text); int errorcheck = objTC.update(); if (errorcheck == 100) lblMessage.Text = "Thank You! You have successfully register the class."; }
protected void btnYes_Click(object sender, EventArgs e) { TuitionClass objTuitionClass = new TuitionClass(); objTuitionClass.tuitionClassID = Convert.ToInt32(Request.QueryString["tuitionClassID"]); string strConn = Convert.ToString(ConfigurationManager.ConnectionStrings["NPTCConnectionString"]); SqlConnection conn = new SqlConnection(strConn); SqlCommand cmd = new SqlCommand("Update TuitionClass Set TutorID=Null WHERE TuitionClassID=@TuitionClassID", conn); cmd.Parameters.AddWithValue("@TuitionClassID", Request.QueryString["tuitionClassID"]); SqlDataAdapter daClass = new SqlDataAdapter(cmd); DataSet ds = new DataSet(); conn.Open(); daClass.Fill(ds, "TuitionClass"); conn.Close(); lblMessage.Text = "Tuition Class is succesfully deregistered."; }