protected void btnAdd_Click(object sender, EventArgs e) { try { //delete all the rows for the //STD_ClassSubjectStudentManager.DeleteSTD_ClassSubjectStudentByClassSubjectID(int.Parse(ddlClassSubjectIDMain.SelectedValue)); string ids=getSubjectID(); if (ids != "") { string[] words = ids.Split(','); foreach (string word in words) { if (word != "") { STD_ClassSubjectStudent sTD_ClassSubjectStudent = new STD_ClassSubjectStudent(); // sTD_ClassSubjectStudent.ClassSubjectStudentID= int.Parse(ddlClassSubjectStudentID.SelectedValue); sTD_ClassSubjectStudent.ClassSubjectStudentName = "Need to fix later"; sTD_ClassSubjectStudent.StudentID = word; sTD_ClassSubjectStudent.ClassSubjectID = int.Parse(ddlClassSubjectIDMain.SelectedValue); sTD_ClassSubjectStudent.AddedBy = Profile.card_id; sTD_ClassSubjectStudent.AddedDate = DateTime.Now; sTD_ClassSubjectStudent.UpdatedBy = Profile.card_id; sTD_ClassSubjectStudent.UpdateDate = DateTime.Now; sTD_ClassSubjectStudent.RowStatusID = 1; int resutl = STD_ClassSubjectStudentManager.InsertSTD_ClassSubjectStudent(sTD_ClassSubjectStudent); } } } } catch (Exception ex) { } loadGrid(); }
protected void btnUpdate_Click(object sender, EventArgs e) { try { //delete all the rows for the STD_ClassSubjectStudentManager.DeleteSTD_ClassSubjectStudentByClassID(int.Parse(ddlClassID.SelectedValue)); string ids = getSubjectID(); if (ids != "") { string[] words = ids.Split(','); foreach (string word in words) { if (word != "") { string[] id = word.Split(' '); STD_ClassSubjectStudent sTD_ClassSubjectStudent = new STD_ClassSubjectStudent(); // sTD_ClassSubjectStudent.ClassSubjectStudentID= int.Parse(ddlClassSubjectStudentID.SelectedValue); sTD_ClassSubjectStudent.ClassSubjectStudentName = "Need to fix later"; sTD_ClassSubjectStudent.StudentID = id[0]; sTD_ClassSubjectStudent.ClassSubjectID = int.Parse(id[1]); sTD_ClassSubjectStudent.AddedBy = Profile.card_id; sTD_ClassSubjectStudent.AddedDate = DateTime.Now; sTD_ClassSubjectStudent.UpdatedBy = Profile.card_id; sTD_ClassSubjectStudent.UpdateDate = DateTime.Now; int resutl = STD_ClassSubjectStudentManager.InsertSTD_ClassSubjectStudent(sTD_ClassSubjectStudent); } } } } catch (Exception ex) { } ddlClassID_SelectedIndexChanged(this, e); btnUpdate.Visible = false; }
public static STD_ClassSubjectStudent GetSTD_ClassSubjectByClassSubjectID(int ClassSubjectID) { STD_ClassSubjectStudent sTD_ClassSubjectStudent = new STD_ClassSubjectStudent(); SqlSTD_ClassSubjectStudentProvider sqlSTD_ClassSubjectStudentProvider = new SqlSTD_ClassSubjectStudentProvider(); sTD_ClassSubjectStudent = sqlSTD_ClassSubjectStudentProvider.GetSTD_ClassSubjectStudentByClassSubjectID(ClassSubjectID); return sTD_ClassSubjectStudent; }
protected void btnAddClass_Click(object sender, EventArgs e) { //btnVarify_OnClick(this, new EventArgs()); if (Session["ClassSubjectStudents"] == null) { List<STD_ClassSubjectStudent> ClassSubjectStudents = new List<STD_ClassSubjectStudent>(); string[] words = ddlClassID.SelectedValue.Split('-'); STD_ClassSubjectStudent sTD_ClassSubjectStudent = new STD_ClassSubjectStudent(); sTD_ClassSubjectStudent.ClassSubjectStudentName = "Need to fix later"; sTD_ClassSubjectStudent.StudentID = hfStudentID.Value; sTD_ClassSubjectStudent.ClassSubjectID = int.Parse(ddlClassID.SelectedValue.Split('-')[0]); sTD_ClassSubjectStudent.SubjectID = int.Parse(ddlSubjectID.SelectedValue); sTD_ClassSubjectStudent.ClassID = int.Parse(ddlClassID.SelectedValue.Split('-')[1]); sTD_ClassSubjectStudent.SubjectName = ddlSubjectID.SelectedItem.Text; sTD_ClassSubjectStudent.ClassName = ddlClassID.SelectedItem.Text; sTD_ClassSubjectStudent.AddedBy = Profile.card_id; sTD_ClassSubjectStudent.AddedDate = DateTime.Now; sTD_ClassSubjectStudent.UpdatedBy = Profile.card_id; sTD_ClassSubjectStudent.UpdateDate = DateTime.Now; sTD_ClassSubjectStudent.RowStatusID = 1; sTD_ClassSubjectStudent.ClassSubjectStudentID = ClassSubjectStudents.Count; //int resutl = STD_ClassSubjectStudentManager.InsertSTD_ClassSubjectStudent(sTD_ClassSubjectStudent); ClassSubjectStudents.Add(sTD_ClassSubjectStudent); Session["ClassSubjectStudents"] = ClassSubjectStudents; loadClassSubjectStudent(); } else { string[] words = ddlClassID.SelectedValue.Split('-'); STD_ClassSubjectStudent sTD_ClassSubjectStudent = new STD_ClassSubjectStudent(); sTD_ClassSubjectStudent.ClassSubjectStudentName = "Need to fix later"; sTD_ClassSubjectStudent.StudentID = hfStudentID.Value; sTD_ClassSubjectStudent.ClassSubjectID = int.Parse(ddlClassID.SelectedValue.Split('-')[0]); sTD_ClassSubjectStudent.SubjectID = int.Parse(ddlSubjectID.SelectedValue); sTD_ClassSubjectStudent.ClassID = int.Parse(ddlClassID.SelectedValue.Split('-')[1]); sTD_ClassSubjectStudent.SubjectName = ddlSubjectID.SelectedItem.Text; sTD_ClassSubjectStudent.ClassName = ddlClassID.SelectedItem.Text; sTD_ClassSubjectStudent.AddedBy = Profile.card_id; sTD_ClassSubjectStudent.AddedDate = DateTime.Now; sTD_ClassSubjectStudent.UpdatedBy = Profile.card_id; sTD_ClassSubjectStudent.UpdateDate = DateTime.Now; sTD_ClassSubjectStudent.RowStatusID = 1; sTD_ClassSubjectStudent.ClassSubjectStudentID = ((List<STD_ClassSubjectStudent>)Session["ClassSubjectStudents"]).Count; //int resutl = STD_ClassSubjectStudentManager.InsertSTD_ClassSubjectStudent(sTD_ClassSubjectStudent); ((List<STD_ClassSubjectStudent>) Session["ClassSubjectStudents"]).Add(sTD_ClassSubjectStudent); Session["ClassSubjectStudents"] = Session["ClassSubjectStudents"]; loadClassSubjectStudent(); } }
protected void btnUpdate_Click(object sender, EventArgs e) { STD_ClassSubjectStudent sTD_ClassSubjectStudent = new STD_ClassSubjectStudent (); sTD_ClassSubjectStudent.ClassSubjectStudentID= int.Parse(Request.QueryString["ID"].ToString()); sTD_ClassSubjectStudent.ClassSubjectStudentName= txtClassSubjectStudentName.Text; sTD_ClassSubjectStudent.StudentID= ddlStudentID.SelectedValue; sTD_ClassSubjectStudent.ClassSubjectID= int.Parse(ddlClassSubjectID.SelectedValue); sTD_ClassSubjectStudent.AddedBy= Profile.card_id; sTD_ClassSubjectStudent.AddedDate= DateTime.Now; sTD_ClassSubjectStudent.UpdatedBy= Profile.card_id; sTD_ClassSubjectStudent.UpdateDate= DateTime.Now; bool resutl =STD_ClassSubjectStudentManager.UpdateSTD_ClassSubjectStudent(sTD_ClassSubjectStudent); Response.Redirect("AdminDisplaySTD_ClassSubjectStudent.aspx"); }
protected void btnAdd_Click(object sender, EventArgs e) { try { STD_ClassSubjectStudent sTD_ClassSubjectStudent = new STD_ClassSubjectStudent(); // sTD_ClassSubjectStudent.ClassSubjectStudentID= int.Parse(ddlClassSubjectStudentID.SelectedValue); sTD_ClassSubjectStudent.ClassSubjectStudentName = txtClassSubjectStudentName.Text; sTD_ClassSubjectStudent.StudentID = ddlStudentID.SelectedValue; sTD_ClassSubjectStudent.ClassSubjectID = int.Parse(ddlClassSubjectID.SelectedValue); sTD_ClassSubjectStudent.AddedBy = Profile.card_id; sTD_ClassSubjectStudent.AddedDate = DateTime.Now; sTD_ClassSubjectStudent.UpdatedBy = Profile.card_id; sTD_ClassSubjectStudent.UpdateDate = DateTime.Now; sTD_ClassSubjectStudent.RowStatusID = 1; int resutl = STD_ClassSubjectStudentManager.InsertSTD_ClassSubjectStudent(sTD_ClassSubjectStudent); Response.Redirect("AdminDisplaySTD_ClassSubjectStudent.aspx"); } catch (Exception ex) { } }
protected void process() { //delete all the info 1st then we will process STD_ClassSubjectStudentManager.DeleteSTD_ClassSubjectStudentByClassID(int.Parse(ddlClassID.SelectedValue)); //Session["ClassSubjectStudentByClass"] = dsClassSubjectStudentByClass; //foreach (DataRow dr in dsClassSubjectStudentByClass.Tables[0].Rows) //{ // try // { // //if (hfClassSubjectStudentID.Value.Contains("-" + dr["ClassSubjectStudentID"].ToString() + "-")) // //{ // STD_ClassSubjectStudent subject = STD_ClassSubjectStudentManager.GetSTD_ClassSubjectStudentByClassSubjectStudentID(int.Parse(dr["ClassSubjectStudentID"].ToString())); // subject.RowStatusID = 3; // STD_ClassSubjectStudentManager.UpdateSTD_ClassSubjectStudent(subject); // //} // } // catch (Exception ex) // { } //} string mesg = ""; foreach (GridViewRow gr in gvStudentSubject.Rows) { HiddenField hfStudentID = (HiddenField)gr.FindControl("hfStudentID"); GridView gvSubjects = (GridView)gr.FindControl("gvSubjects"); GridView gvSubjectsPassed = (GridView)gr.FindControl("gvSubjectsPassed"); foreach (GridViewRow grSubjects in gvSubjects.Rows) { HiddenField hfClassSubjectID = (HiddenField)grSubjects.FindControl("hfClassSubjectID"); CheckBox chkSubject = (CheckBox)grSubjects.FindControl("chkSelect"); if (chkSubject.Checked) { string subject = chkSubject.ToolTip; string studentID = chkSubject.ValidationGroup.ToString(); try { DataSet subjects = STD_ClassSubjectStudentManager.GetSTD_StudentSubjectByStudentID(studentID.ToString()); foreach (DataRow dr in subjects.Tables[0].Rows) { if ((subject == dr["SubjectName"].ToString()) && (dr["ClassName"].ToString() != ddlClassID.SelectedItem.Text)) { chkSubject.Checked = false; pnCheck.Visible = true; mesg = dr["StudentName"].ToString() + " " + " has" + " " + subject + " " + "with" + " " + dr["ClassName"].ToString() + " " + "<a herf='ClassSubjectAddStudent.aspx?batchID=" + dr["ClassID"].ToString() + "' target='_blank'>Click here</a> to Change that batch" + "<br />" + "\n"; if (Session["msg"] != null) { string[] spMsg = Session["msg"].ToString().Split('\n'); for (int i = 0; i < spMsg.Length; i++) { if (mesg == (spMsg[i] + "\n")) { mesg = ""; } } Session["msg"] = Session["msg"] + mesg; } else { Session["msg"] = Session["msg"] + mesg; } lblCheck.Text = Session["msg"].ToString(); //ScriptManager.RegisterStartupScript(this.Page, typeof(Page), "Message", "alert('" + dr["StudentName"].ToString() + " has " + subject + " in Class " + dr["ClassName"].ToString() + "')", true); return; } else { } } } catch (Exception ex) { } try { //we can save this STD_ClassSubjectStudent sTD_ClassSubjectStudent = new STD_ClassSubjectStudent(); // sTD_ClassSubjectStudent.ClassSubjectStudentID= int.Parse(ddlClassSubjectStudentID.SelectedValue); sTD_ClassSubjectStudent.ClassSubjectStudentName = "Need to fix later"; sTD_ClassSubjectStudent.StudentID = studentID; sTD_ClassSubjectStudent.ClassSubjectID = int.Parse(hfClassSubjectID.Value); sTD_ClassSubjectStudent.AddedBy = Profile.card_id; sTD_ClassSubjectStudent.AddedDate = DateTime.Now; sTD_ClassSubjectStudent.UpdatedBy = Profile.card_id; sTD_ClassSubjectStudent.UpdateDate = DateTime.Now; sTD_ClassSubjectStudent.RowStatusID = 1; int resutl = STD_ClassSubjectStudentManager.InsertSTD_ClassSubjectStudent(sTD_ClassSubjectStudent); } catch (Exception ex) { } } } foreach (GridViewRow grSubjects in gvSubjectsPassed.Rows) { HiddenField hfClassSubjectID = (HiddenField)grSubjects.FindControl("hfClassSubjectID"); CheckBox chkSubject = (CheckBox)grSubjects.FindControl("chkSelect"); if (chkSubject.Checked) { string subject = chkSubject.ToolTip; string studentID = chkSubject.ValidationGroup.ToString(); //DataSet subjects = STD_ClassSubjectStudentManager.GetSTD_StudentSubjectByStudentID(studentID.ToString()); //foreach (DataRow dr in subjects.Tables[0].Rows) //{ // if ((subject == dr["SubjectName"].ToString()) && (dr["ClassName"].ToString() != ddlClassID.SelectedItem.Text)) // { // chkSubject.Checked = false; // pnCheck.Visible = true; // mesg = dr["StudentName"].ToString() + " " + " has" + " " + subject + " " + "with" + " " + dr["ClassName"].ToString() + " " + // "<a herf='ClassSubjectAddStudent.aspx?batchID=" + dr["ClassID"].ToString() + "' target='_blank'>Click here</a> to Change that batch" + "<br />" + "\n"; // if (Session["msg"] != null) // { // string[] spMsg = Session["msg"].ToString().Split('\n'); // for (int i = 0; i < spMsg.Length; i++) // { // if (mesg == (spMsg[i] + "\n")) // { // mesg = ""; // } // } // Session["msg"] = Session["msg"] + mesg; // } // else // { // Session["msg"] = Session["msg"] + mesg; // } // lblCheck.Text = Session["msg"].ToString(); // //ScriptManager.RegisterStartupScript(this.Page, typeof(Page), "Message", "alert('" + dr["StudentName"].ToString() + " has " + subject + " in Class " + dr["ClassName"].ToString() + "')", true); // return; // } // else // { // } //} try { bool result = STD_ClassSubjectStudentManager.HistorySTD_ClassSubjectStudentByClassSubjectIDnStudentID(int.Parse(hfClassSubjectID.Value),studentID); //we can save this //STD_ClassSubjectStudent sTD_ClassSubjectStudent = new STD_ClassSubjectStudent(); //// sTD_ClassSubjectStudent.ClassSubjectStudentID= int.Parse(ddlClassSubjectStudentID.SelectedValue); //sTD_ClassSubjectStudent.ClassSubjectStudentName = "Need to fix later"; //sTD_ClassSubjectStudent.StudentID = studentID; //sTD_ClassSubjectStudent.ClassSubjectID = int.Parse(hfClassSubjectID.Value); //sTD_ClassSubjectStudent.AddedBy = Profile.card_id; //sTD_ClassSubjectStudent.AddedDate = DateTime.Now; //sTD_ClassSubjectStudent.UpdatedBy = Profile.card_id; //sTD_ClassSubjectStudent.UpdateDate = DateTime.Now; //sTD_ClassSubjectStudent.RowStatusID = 14; //int resutl = STD_ClassSubjectStudentManager.InsertSTD_ClassSubjectStudent(sTD_ClassSubjectStudent); } catch (Exception ex) { } } } } }
protected void btnSave_Click(object sender, EventArgs e) { //add Subject STD_Class sTD_Class = new STD_Class(); try { // sTD_Class.ClassID= int.Parse(ddlClassID.SelectedValue); sTD_Class.ClassName = txtClassName.Text; sTD_Class.CourseID = int.Parse(ddlCourseID.SelectedValue); sTD_Class.ClassTypeID = 2; sTD_Class.ClassStatusID = 1; sTD_Class.AddedBy = Profile.card_id; sTD_Class.AddedDate = DateTime.Now; sTD_Class.UpdatedBy = Profile.card_id; sTD_Class.UpdateDate = DateTime.Now; sTD_Class.ClassID = STD_ClassManager.InsertSTD_Class(sTD_Class); } catch (Exception ex) { } //Add Student try { string ids = getStudentIDs(gvStudents); if (ids != "") { STD_ClassStudent sTD_ClassStudent = new STD_ClassStudent(); sTD_ClassStudent.ClassStudentName = ""; sTD_ClassStudent.StudentID = ids; sTD_ClassStudent.ClassID = sTD_Class.ClassID; sTD_ClassStudent.AddedBy = Profile.card_id; sTD_ClassStudent.AddedDate = DateTime.Now; sTD_ClassStudent.UpdatedBy = Profile.card_id; sTD_ClassStudent.UpdateDate = DateTime.Now; int resutl = STD_ClassStudentManager.InsertSTD_ClassStudent_List_KeepStudentInMultipleClassActive(sTD_ClassStudent); //string message = resutl + " New Entry Created"; //ScriptManager.RegisterClientScriptBlock(this, typeof(Page), "Message", "alert('" + message + "');", true); } } catch (Exception ex) { } //Class Subject try { //delete all the rows for the STD_ClassSubjectManager.DeleteSTD_ClassSubjectByClassID(sTD_Class.ClassID); foreach (GridViewRow gr in gvSubject.Rows) { CheckBox chkSelect = (CheckBox)gr.FindControl("chkSelect"); HiddenField hfSubjectID = (HiddenField)gr.FindControl("hfSubjectID"); DropDownList ddlTeacherID = (DropDownList)gr.FindControl("ddlTeacherID"); TextBox txtStartDate = (TextBox)gr.FindControl("txtStartDate"); TextBox txtEndDate = (TextBox)gr.FindControl("txtEndDate"); if (chkSelect.Checked) { STD_ClassSubject sTD_ClassSubject = new STD_ClassSubject(); sTD_ClassSubject.ClassSubjectName = "1"; sTD_ClassSubject.SubjectID = int.Parse(hfSubjectID.Value); sTD_ClassSubject.ClassID = sTD_Class.ClassID; sTD_ClassSubject.ExtraField1 = txtStartDate.Text; sTD_ClassSubject.ExtraField2 = txtEndDate.Text; sTD_ClassSubject.ExtraField3 = ""; sTD_ClassSubject.ExtraField4 = ""; sTD_ClassSubject.ExtraField5 = ""; sTD_ClassSubject.AddedBy = Profile.card_id; sTD_ClassSubject.AddedDate = DateTime.Now; sTD_ClassSubject.UpdatedBy = Profile.card_id; sTD_ClassSubject.UpdateDate = DateTime.Now; sTD_ClassSubject.ClassSubjectID = STD_ClassSubjectManager.InsertSTD_ClassSubject(sTD_ClassSubject); if (ddlTeacherID.SelectedIndex != 0) { STD_ClassSubjectEmployee sTD_ClassSubjectEmployee = new STD_ClassSubjectEmployee(); // sTD_ClassSubjectEmployee.ClassSubjectEmployeeID= int.Parse(ddlClassSubjectEmployeeID.SelectedValue); sTD_ClassSubjectEmployee.ClassSubjectEmployeeName = "Need to fix later"; sTD_ClassSubjectEmployee.EmployeeID = ddlTeacherID.SelectedValue; sTD_ClassSubjectEmployee.ClassSubjectID = sTD_ClassSubject.ClassSubjectID; sTD_ClassSubjectEmployee.AddedBy = Profile.card_id; sTD_ClassSubjectEmployee.AddedDate = DateTime.Now; sTD_ClassSubjectEmployee.UpdatedBy = Profile.card_id; sTD_ClassSubjectEmployee.UpdateDate = DateTime.Now; sTD_ClassSubjectEmployee.ClassSubjectEmployeeID = STD_ClassSubjectEmployeeManager.InsertSTD_ClassSubjectEmployee(sTD_ClassSubjectEmployee); } //Add Student try { string ids = getStudentIDs(gvStudents); if (ids != "") { STD_ClassSubjectStudent sTD_ClassSubjectStudent = new STD_ClassSubjectStudent(); sTD_ClassSubjectStudent.ClassSubjectStudentName = "Need to fix later"; sTD_ClassSubjectStudent.StudentID = ids; sTD_ClassSubjectStudent.ClassSubjectID = sTD_ClassSubject.ClassSubjectID; sTD_ClassSubjectStudent.AddedBy = Profile.card_id; sTD_ClassSubjectStudent.AddedDate = DateTime.Now; sTD_ClassSubjectStudent.UpdatedBy = Profile.card_id; sTD_ClassSubjectStudent.UpdateDate = DateTime.Now; int resutl = STD_ClassSubjectStudentManager.InsertSTD_ClassSubjectStudent_List_KeepStudentInMultipleClassActive(sTD_ClassSubjectStudent); } } catch (Exception ex) { } } } } catch (Exception ex) { } Response.Redirect("Enrollment.aspx?Message=Saved succfully.."); }
protected void btnSave_Click(object sender, EventArgs e) { try { //insert the classes which are not assigned for that student string classIDsNeedtoAddinDataBase = ""; hfclassIDs.Value = ""; DataSet ds = STD_ClassStudentManager.GetSTD_ClassStudentByStudentID(hfStudentID.Value, true); foreach (DataRow dr in ds.Tables[0].Rows) { hfclassIDs.Value += dr["ClassID"].ToString() + "-"; } List<STD_ClassSubjectStudent> ClassSubjectStudents = new List<STD_ClassSubjectStudent>(); ClassSubjectStudents = (List<STD_ClassSubjectStudent>)Session["ClassSubjectStudents"]; foreach (STD_ClassSubjectStudent classSubjectStudent in ClassSubjectStudents) { if (!hfclassIDs.Value.Contains(classSubjectStudent.ClassID.ToString())) { classIDsNeedtoAddinDataBase += classSubjectStudent.ClassID.ToString() + "-"; } } if (classIDsNeedtoAddinDataBase != "") { string[] ids = classIDsNeedtoAddinDataBase.Split('-'); foreach (string id in ids) { if (id != "" && id != "-") { STD_ClassStudent sTD_ClassStudent = new STD_ClassStudent(); // sTD_ClassStudent.ClassStudentID= int.Parse(ddlClassStudentID.SelectedValue); sTD_ClassStudent.ClassStudentName = ""; sTD_ClassStudent.StudentID = hfStudentID.Value; sTD_ClassStudent.ClassID = int.Parse(id); sTD_ClassStudent.AddedBy = Profile.card_id; sTD_ClassStudent.AddedDate = DateTime.Now; sTD_ClassStudent.UpdatedBy = Profile.card_id; sTD_ClassStudent.UpdateDate = DateTime.Now; sTD_ClassStudent.RowStatusID = 1; int resutl = STD_ClassStudentManager.InsertSTD_ClassStudent(sTD_ClassStudent); } } } //Need to add the ClassSubject Student //insert the classes which are not assigned for that student string classSubjectIDsNeedtoAddinDataBase = ""; hfclassIDs.Value = ""; DataSet dsclassSubject = STD_ClassSubjectStudentManager.GetSTD_ClassSubjectStudentByStudentID(hfStudentID.Value); foreach (DataRow dr in dsclassSubject.Tables[0].Rows) { hfclassSubjectIDs.Value += dr["ClassSubjectID"].ToString() + "-"; } foreach (STD_ClassSubjectStudent classSubjectStudent in ClassSubjectStudents) { if (!hfclassSubjectIDs.Value.Contains(classSubjectStudent.ClassSubjectID.ToString())) { classSubjectIDsNeedtoAddinDataBase += classSubjectStudent.ClassSubjectID.ToString() + "-"; } } if (classSubjectIDsNeedtoAddinDataBase != "") { string[] ids = classSubjectIDsNeedtoAddinDataBase.Split('-'); foreach (string id in ids) { if (id != "" && id != "-") { STD_ClassSubjectStudent sTD_ClassSubjectStudent = new STD_ClassSubjectStudent(); // sTD_ClassSubjectStudent.ClassSubjectStudentID= int.Parse(ddlClassSubjectStudentID.SelectedValue); sTD_ClassSubjectStudent.ClassSubjectStudentName = ""; sTD_ClassSubjectStudent.StudentID = hfStudentID.Value; sTD_ClassSubjectStudent.ClassSubjectID = int.Parse(id); sTD_ClassSubjectStudent.AddedBy = Profile.card_id; sTD_ClassSubjectStudent.AddedDate = DateTime.Now; sTD_ClassSubjectStudent.UpdatedBy = Profile.card_id; sTD_ClassSubjectStudent.UpdateDate = DateTime.Now; sTD_ClassSubjectStudent.RowStatusID = 1; int resutl = STD_ClassSubjectStudentManager.InsertSTD_ClassSubjectStudent(sTD_ClassSubjectStudent); } } } } catch (Exception ex) { } }
public bool UpdateSTD_ClassSubjectStudent(STD_ClassSubjectStudent sTD_ClassSubjectStudent) { using (SqlConnection connection = new SqlConnection(this.ConnectionString)) { SqlCommand cmd = new SqlCommand("UpdateSTD_ClassSubjectStudent", connection); cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.Add("@ClassSubjectStudentID", SqlDbType.Int).Value = sTD_ClassSubjectStudent.ClassSubjectStudentID; cmd.Parameters.Add("@ClassSubjectStudentName", SqlDbType.NVarChar).Value = sTD_ClassSubjectStudent.ClassSubjectStudentName; cmd.Parameters.Add("@StudentID", SqlDbType.NVarChar).Value = sTD_ClassSubjectStudent.StudentID; cmd.Parameters.Add("@ClassSubjectID", SqlDbType.Int).Value = sTD_ClassSubjectStudent.ClassSubjectID; cmd.Parameters.Add("@AddedBy", SqlDbType.NVarChar).Value = sTD_ClassSubjectStudent.AddedBy; cmd.Parameters.Add("@AddedDate", SqlDbType.DateTime).Value = sTD_ClassSubjectStudent.AddedDate; cmd.Parameters.Add("@UpdatedBy", SqlDbType.NVarChar).Value = sTD_ClassSubjectStudent.UpdatedBy; cmd.Parameters.Add("@UpdateDate", SqlDbType.DateTime).Value = sTD_ClassSubjectStudent.UpdateDate; cmd.Parameters.Add("@RowStatusID", SqlDbType.Int).Value = sTD_ClassSubjectStudent.RowStatusID; connection.Open(); int result = cmd.ExecuteNonQuery(); return result == 1; } }
private void showUpdateInfoData(int studentID) { try { if (Session["ClassSubjectStudents"] != null) { List<STD_ClassSubjectStudent> ClassSubjectStudents = new List<STD_ClassSubjectStudent>(); ClassSubjectStudents = (List<STD_ClassSubjectStudent>)Session["ClassSubjectStudents"]; STD_ClassSubjectStudent sTD_ClassSubjectStudent = new STD_ClassSubjectStudent(); sTD_ClassSubjectStudent = ClassSubjectStudents[studentID]; hfStudentID.Value= sTD_ClassSubjectStudent.StudentID; ddlClassID.SelectedValue = sTD_ClassSubjectStudent.ClassSubjectID.ToString()+"-"+sTD_ClassSubjectStudent.ClassID.ToString(); ddlSubjectID.SelectedValue= sTD_ClassSubjectStudent.SubjectID.ToString(); hfClassStudentSubjectID.Value = sTD_ClassSubjectStudent.ClassSubjectStudentID.ToString(); //ddlClassID.SelectedValue= sTD_ClassSubjectStudent.ClassID.ToString(); //ddlSubjectID.SelectedItem.Text=sTD_ClassSubjectStudent.SubjectName; //ddlClassID.SelectedItem.Text= sTD_ClassSubjectStudent.ClassName; } } catch (Exception ex) { } }
protected void btnUpdateClass_Click(object sender, EventArgs e) { try { if (Session["ClassSubjectStudents"] != null) { List<STD_ClassSubjectStudent> ClassSubjectStudents = new List<STD_ClassSubjectStudent>(); ClassSubjectStudents = (List<STD_ClassSubjectStudent>)Session["ClassSubjectStudents"]; STD_ClassSubjectStudent sTD_ClassSubjectStudent = new STD_ClassSubjectStudent(); sTD_ClassSubjectStudent.ClassSubjectStudentName = "Need to fix later"; sTD_ClassSubjectStudent.StudentID = hfStudentID.Value; sTD_ClassSubjectStudent.ClassSubjectStudentID = int.Parse(hfClassStudentSubjectID.Value); sTD_ClassSubjectStudent.ClassSubjectID = int.Parse(ddlClassID.SelectedValue.Split('-')[0]); sTD_ClassSubjectStudent.SubjectID = int.Parse(ddlSubjectID.SelectedValue); sTD_ClassSubjectStudent.ClassID = int.Parse(ddlClassID.SelectedValue.Split('-')[1]); sTD_ClassSubjectStudent.SubjectName = ddlSubjectID.SelectedItem.Text; sTD_ClassSubjectStudent.ClassName = ddlClassID.SelectedItem.Text; sTD_ClassSubjectStudent.AddedBy = Profile.card_id; sTD_ClassSubjectStudent.AddedDate = DateTime.Now; sTD_ClassSubjectStudent.UpdatedBy = Profile.card_id; sTD_ClassSubjectStudent.UpdateDate = DateTime.Now; ClassSubjectStudents[int.Parse(hfClassStudentSubjectID.Value)] = sTD_ClassSubjectStudent; Session["ClassSubjectStudents"] = ClassSubjectStudents; loadClassSubjectStudent(); } } catch (Exception ex) { } }
public static int InsertSTD_ClassSubjectStudent(STD_ClassSubjectStudent sTD_ClassSubjectStudent) { SqlSTD_ClassSubjectStudentProvider sqlSTD_ClassSubjectStudentProvider = new SqlSTD_ClassSubjectStudentProvider(); return sqlSTD_ClassSubjectStudentProvider.InsertSTD_ClassSubjectStudent(sTD_ClassSubjectStudent); }
public static STD_ClassSubjectStudent GetSTD_StudentByStudentID(string StudentID) { STD_ClassSubjectStudent sTD_ClassSubjectStudent = new STD_ClassSubjectStudent(); SqlSTD_ClassSubjectStudentProvider sqlSTD_ClassSubjectStudentProvider = new SqlSTD_ClassSubjectStudentProvider(); sTD_ClassSubjectStudent = sqlSTD_ClassSubjectStudentProvider.GetSTD_ClassSubjectStudentByStudentID(StudentID); return sTD_ClassSubjectStudent; }
public int InsertSTD_ClassSubjectStudent_List_KeepStudentInMultipleClassActive(STD_ClassSubjectStudent sTD_ClassStudent) { using (SqlConnection connection = new SqlConnection(this.ConnectionString)) { SqlCommand cmd = new SqlCommand("InsertSTD_ClassSubjectStudent_List_KeepStudentInMultipleClassActive", connection); cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.Add("@Count", SqlDbType.Int).Direction = ParameterDirection.Output; cmd.Parameters.Add("@StudentIDs", SqlDbType.NVarChar).Value = sTD_ClassStudent.StudentID; cmd.Parameters.Add("@ClassSubjectID", SqlDbType.Int).Value = sTD_ClassStudent.ClassSubjectID; cmd.Parameters.Add("@AddedBy", SqlDbType.NVarChar).Value = sTD_ClassStudent.AddedBy; cmd.Parameters.Add("@AddedDate", SqlDbType.DateTime).Value = sTD_ClassStudent.AddedDate; cmd.Parameters.Add("@UpdatedBy", SqlDbType.NVarChar).Value = sTD_ClassStudent.UpdatedBy; cmd.Parameters.Add("@UpdateDate", SqlDbType.DateTime).Value = sTD_ClassStudent.UpdateDate; connection.Open(); int result = cmd.ExecuteNonQuery(); return (int)cmd.Parameters["@Count"].Value; } }
private void showSTD_ClassSubjectStudentData() { STD_ClassSubjectStudent sTD_ClassSubjectStudent = new STD_ClassSubjectStudent (); sTD_ClassSubjectStudent = STD_ClassSubjectStudentManager.GetSTD_ClassSubjectStudentByClassSubjectStudentID(Int32.Parse(Request.QueryString["ID"])); txtClassSubjectStudentName.Text =sTD_ClassSubjectStudent.ClassSubjectStudentName.ToString(); ddlStudentID.SelectedValue =sTD_ClassSubjectStudent.StudentID.ToString(); ddlClassSubjectID.SelectedValue =sTD_ClassSubjectStudent.ClassSubjectID.ToString(); }
protected void btnSave_Click(object sender, EventArgs e) { try { if (Session["id"] != null) { string[] id = Session["id"].ToString().Split(','); for (int i = 0; i < id.Length-1; i++) { STD_ClassSubjectStudent sTD_ClassSubjectStudent = STD_ClassSubjectStudentManager.GetSTD_ClassSubjectStudentByClassSubjectStudentID(Convert.ToInt32(id[i])); sTD_ClassSubjectStudent.RowStatusID = 3; STD_ClassSubjectStudentManager.UpdateSTD_ClassSubjectStudent(sTD_ClassSubjectStudent); } } //insert the classes which are not assigned for that student string classIDsNeedtoAddinDataBase = ""; hfclassIDs.Value = ""; DataSet ds = STD_ClassStudentManager.GetSTD_ClassStudentByStudentID(hfStudentID.Value, true); foreach (DataRow dr in ds.Tables[0].Rows) { hfclassIDs.Value += dr["ClassID"].ToString() + "-"; } if (Session["ClassSubjectStudents"] != null) { List<STD_ClassSubjectStudent> ClassSubjectStudents = new List<STD_ClassSubjectStudent>(); ClassSubjectStudents = (List<STD_ClassSubjectStudent>)Session["ClassSubjectStudents"]; foreach (STD_ClassSubjectStudent classSubjectStudent in ClassSubjectStudents) { if (!hfclassIDs.Value.Contains(classSubjectStudent.ClassID.ToString())) { classIDsNeedtoAddinDataBase += classSubjectStudent.ClassID.ToString() + "-"; } } if (classIDsNeedtoAddinDataBase != "") { string[] ids = classIDsNeedtoAddinDataBase.Split('-'); foreach (string id in ids) { if (id != "" && id != "-") { STD_ClassStudent sTD_ClassStudent = new STD_ClassStudent(); // sTD_ClassStudent.ClassStudentID= int.Parse(ddlClassStudentID.SelectedValue); sTD_ClassStudent.ClassStudentName = ""; sTD_ClassStudent.StudentID = hfStudentID.Value; sTD_ClassStudent.ClassID = int.Parse(id); sTD_ClassStudent.AddedBy = Profile.card_id; sTD_ClassStudent.AddedDate = DateTime.Now; sTD_ClassStudent.UpdatedBy = Profile.card_id; sTD_ClassStudent.UpdateDate = DateTime.Now; sTD_ClassStudent.RowStatusID = 1; int resutl = STD_ClassStudentManager.InsertSTD_ClassStudent(sTD_ClassStudent); } } } //Need to add the ClassSubject Student //insert the classes which are not assigned for that student string classSubjectIDsNeedtoAddinDataBase = ""; hfclassIDs.Value = ""; DataSet dsclassSubject = STD_ClassSubjectStudentManager.GetSTD_ClassSubjectStudentByStudentID(hfStudentID.Value); foreach (DataRow dr in dsclassSubject.Tables[0].Rows) { hfclassSubjectIDs.Value += dr["ClassSubjectID"].ToString() + "-"; } foreach (STD_ClassSubjectStudent classSubjectStudent in ClassSubjectStudents) { if (!hfclassSubjectIDs.Value.Contains(classSubjectStudent.ClassSubjectID.ToString())) { classSubjectIDsNeedtoAddinDataBase += classSubjectStudent.ClassSubjectID.ToString() + "-"; } } if (classSubjectIDsNeedtoAddinDataBase != "") { string[] ids = classSubjectIDsNeedtoAddinDataBase.Split('-'); foreach (string id in ids) { if (id != "" && id != "-") { STD_ClassSubjectStudent sTD_ClassSubjectStudent = new STD_ClassSubjectStudent(); // sTD_ClassSubjectStudent.ClassSubjectStudentID= int.Parse(ddlClassSubjectStudentID.SelectedValue); sTD_ClassSubjectStudent.ClassSubjectStudentName = ""; sTD_ClassSubjectStudent.StudentID = hfStudentID.Value; sTD_ClassSubjectStudent.ClassSubjectID = int.Parse(id); sTD_ClassSubjectStudent.AddedBy = Profile.card_id; sTD_ClassSubjectStudent.AddedDate = DateTime.Now; sTD_ClassSubjectStudent.UpdatedBy = Profile.card_id; sTD_ClassSubjectStudent.UpdateDate = DateTime.Now; sTD_ClassSubjectStudent.RowStatusID = 1; int resutl = STD_ClassSubjectStudentManager.InsertSTD_ClassSubjectStudent(sTD_ClassSubjectStudent); } } ScriptManager.RegisterStartupScript(this.Page, typeof(Page), "Message", "alert('Save successfully.')", true); } else { foreach (STD_ClassSubjectStudent classSubjectStudent in ClassSubjectStudents) { classSubjectStudent.RowStatusID = 1; STD_ClassSubjectStudentManager.UpdateSTD_ClassSubjectStudent(classSubjectStudent); } ScriptManager.RegisterStartupScript(this.Page, typeof(Page), "Message", "alert('Save successfully.')", true); } } } catch (Exception ex) { } }
public static int InsertSTD_ClassSubjectStudent_List_KeepStudentInMultipleClassActive(STD_ClassSubjectStudent sTD_ClassStudent) { SqlSTD_ClassStudentProvider sqlSTD_ClassStudentProvider = new SqlSTD_ClassStudentProvider(); return sqlSTD_ClassStudentProvider.InsertSTD_ClassSubjectStudent_List_KeepStudentInMultipleClassActive(sTD_ClassStudent); }
private void loadClassSubjectStudentDataBase() { List<STD_ClassSubjectStudent> ClassSubjectStudents = new List<STD_ClassSubjectStudent>(); DataSet ds = STD_ClassSubjectStudentManager.GetSTD_ClassSubjectStudentByStudentID(hfStudentID.Value); foreach (DataRow dr in ds.Tables[0].Rows) { STD_ClassSubjectStudent sTD_ClassSubjectStudent = new STD_ClassSubjectStudent(); sTD_ClassSubjectStudent.ClassSubjectStudentID = int.Parse(dr["ClassSubjectStudentID"].ToString()); sTD_ClassSubjectStudent.ClassSubjectStudentName = dr["ClassSubjectStudentName"].ToString(); sTD_ClassSubjectStudent.StudentID = hfStudentID.Value; sTD_ClassSubjectStudent.ClassSubjectID = int.Parse(dr["ClassSubjectID"].ToString()); sTD_ClassSubjectStudent.SubjectID = int.Parse(dr["SubjectID"].ToString()); sTD_ClassSubjectStudent.ClassID = int.Parse(dr["ClassID"].ToString()); sTD_ClassSubjectStudent.SubjectName = dr["SubjectName"].ToString(); sTD_ClassSubjectStudent.ClassName = dr["ClassName"].ToString(); sTD_ClassSubjectStudent.AddedBy = Profile.card_id; sTD_ClassSubjectStudent.AddedDate = DateTime.Now; sTD_ClassSubjectStudent.UpdatedBy = Profile.card_id; sTD_ClassSubjectStudent.UpdateDate = DateTime.Now; sTD_ClassSubjectStudent.ClassSubjectStudentID = ClassSubjectStudents.Count; sTD_ClassSubjectStudent.ID = int.Parse(dr["ClassSubjectStudentID"].ToString()); //Session["eID"] =Session["eID"]+ dr["ClassSubjectStudentID"].ToString() +","; //int resutl = STD_ClassSubjectStudentManager.InsertSTD_ClassSubjectStudent(sTD_ClassSubjectStudent); ClassSubjectStudents.Add(sTD_ClassSubjectStudent); } Session["ClassSubjectStudents"] = ClassSubjectStudents; gvSTD_ClassSubjectStudent.DataSource = ClassSubjectStudents; gvSTD_ClassSubjectStudent.DataBind(); }
public static bool UpdateSTD_ClassSubjectStudent(STD_ClassSubjectStudent sTD_ClassSubjectStudent) { SqlSTD_ClassSubjectStudentProvider sqlSTD_ClassSubjectStudentProvider = new SqlSTD_ClassSubjectStudentProvider(); return sqlSTD_ClassSubjectStudentProvider.UpdateSTD_ClassSubjectStudent(sTD_ClassSubjectStudent); }
protected void btnEnrollment_Click(object sender, EventArgs e) { bool isAlreadyAdded= false; int classSubjectID = 0; foreach (GridViewRow gvr in gvSTD_Class.Rows) { HiddenField hfClassID = (HiddenField)gvr.FindControl("hfClassID"); HiddenField hfIsHistory = (HiddenField)gvr.FindControl("hfIsHistory"); if (!bool.Parse(hfIsHistory.Value) && ddlClassID.SelectedValue == hfClassID.Value) { isAlreadyAdded = true; break; } } if (!isAlreadyAdded) { STD_ClassStudent sTD_ClassStudent = new STD_ClassStudent(); sTD_ClassStudent.ClassStudentName = ""; sTD_ClassStudent.StudentID = hfStudentID.Value; sTD_ClassStudent.ClassID = int.Parse(ddlClassID.SelectedValue); sTD_ClassStudent.AddedBy = Profile.card_id; sTD_ClassStudent.AddedDate = DateTime.Now; sTD_ClassStudent.UpdatedBy = Profile.card_id; sTD_ClassStudent.UpdateDate = DateTime.Now; sTD_ClassStudent.RowStatusID = 1; classSubjectID = STD_ClassStudentManager.InsertSTD_ClassStudent(sTD_ClassStudent); } foreach (GridViewRow item in gvSubjects.Rows) { CheckBox chkSubject = (CheckBox)item.FindControl("chkSubject"); //HiddenField hfClassSubjectID = (HiddenField)item.FindControl("hfClassSubjectID"); if (chkSubject.Checked) { STD_ClassSubjectStudent sTD_ClassSubjectStudent = new STD_ClassSubjectStudent(); // sTD_ClassSubjectStudent.ClassSubjectStudentID= int.Parse(ddlClassSubjectStudentID.SelectedValue); sTD_ClassSubjectStudent.ClassSubjectStudentName = ""; sTD_ClassSubjectStudent.StudentID = hfStudentID.Value; sTD_ClassSubjectStudent.ClassSubjectID = int.Parse(((HiddenField)item.FindControl("hfClassSubjectID")).Value); sTD_ClassSubjectStudent.AddedBy = Profile.card_id; sTD_ClassSubjectStudent.AddedDate = DateTime.Now; sTD_ClassSubjectStudent.UpdatedBy = Profile.card_id; sTD_ClassSubjectStudent.UpdateDate = DateTime.Now; sTD_ClassSubjectStudent.RowStatusID = 1; int resutl = STD_ClassSubjectStudentManager.InsertSTD_ClassSubjectStudent(sTD_ClassSubjectStudent); } } btnVarify_OnClick(this, new EventArgs()); ddlClassID.SelectedIndex=0; ddlClassID_SelectedIndexChanged(this,new EventArgs()); }
public STD_ClassSubjectStudent GetSTD_ClassSubjectStudentFromReader(IDataReader reader) { try { STD_ClassSubjectStudent sTD_ClassSubjectStudent = new STD_ClassSubjectStudent ( DataAccessObject.IsNULL<int>(reader["ClassSubjectStudentID"]), DataAccessObject.IsNULL<string>(reader["ClassSubjectStudentName"]), DataAccessObject.IsNULL<string>(reader["StudentID"].ToString()), DataAccessObject.IsNULL<int>(reader["ClassSubjectID"]), DataAccessObject.IsNULL<string>(reader["AddedBy"].ToString()), DataAccessObject.IsNULL<DateTime>(reader["AddedDate"]), DataAccessObject.IsNULL<string>(reader["UpdatedBy"].ToString()), DataAccessObject.IsNULL<DateTime>(reader["UpdateDate"]), DataAccessObject.IsNULL<int>(reader["RowStatusID"]) ); return sTD_ClassSubjectStudent; } catch(Exception ex) { return null; } }