protected void btnAdd3_Click(object sender, EventArgs e) { try { //string ids = getStudentID(); string ids = getStudentIDs(gvAllEmployeeList); if (ids != "") { STD_SubjectEmployee sTD_ClassStudent = new STD_SubjectEmployee(); sTD_ClassStudent.SubjectEmployeeName = ""; sTD_ClassStudent.EmployeeID = ids; sTD_ClassStudent.SubjectID = int.Parse(ddlSubjectID.SelectedValue); sTD_ClassStudent.CampusID = 1; 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_SubjectManager.InsertSTD_SubjectEmployee_List(sTD_ClassStudent); string message = resutl + " New Teacher has added"; ScriptManager.RegisterClientScriptBlock(this, typeof(Page), "Message", "alert('" + message + "');", true); txtStudentIDs.Text = ""; loadGrid(); } } catch (Exception ex) { ScriptManager.RegisterClientScriptBlock(this, typeof(Page), "Message", "alert('" + ex.Message.ToString() + "');", true); } }
public int InsertSTD_SubjectEmployee_List(STD_SubjectEmployee sTD_SubjectEmployee) { using (SqlConnection connection = new SqlConnection(this.ConnectionString)) { SqlCommand cmd = new SqlCommand("InsertSTD_SubjectEmployee_List", connection); cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.Add("@Count", SqlDbType.Int).Direction = ParameterDirection.Output; cmd.Parameters.Add("@EmployeeIDs", SqlDbType.NVarChar).Value = sTD_SubjectEmployee.EmployeeID; cmd.Parameters.Add("@SubjectID", SqlDbType.Int).Value = sTD_SubjectEmployee.SubjectID; cmd.Parameters.Add("@CampusID", SqlDbType.Int).Value = sTD_SubjectEmployee.CampusID; cmd.Parameters.Add("@AddedBy", SqlDbType.NVarChar).Value = sTD_SubjectEmployee.AddedBy; cmd.Parameters.Add("@AddedDate", SqlDbType.DateTime).Value = sTD_SubjectEmployee.AddedDate; cmd.Parameters.Add("@UpdatedBy", SqlDbType.NVarChar).Value = sTD_SubjectEmployee.UpdatedBy; cmd.Parameters.Add("@UpdateDate", SqlDbType.DateTime).Value = sTD_SubjectEmployee.UpdateDate; connection.Open(); int result = cmd.ExecuteNonQuery(); return (int)cmd.Parameters["@Count"].Value; } }
public static int InsertSTD_SubjectEmployee_List(STD_SubjectEmployee sTD_SubjectEmployee) { SqlSTD_SubjectProvider sqlSTD_SubjectProvider = new SqlSTD_SubjectProvider(); return sqlSTD_SubjectProvider.InsertSTD_SubjectEmployee_List(sTD_SubjectEmployee); }