public int InsertQuals(StudentPreviousQual thePreQualifications) { int ReturnValueQuals = 0; using (SqlCommand InsertCommand = new SqlCommand()) { InsertCommand.CommandType = CommandType.StoredProcedure; InsertCommand.Parameters.Add(GetParameter("@ReturnValue", SqlDbType.Int, ReturnValueQuals)).Direction = ParameterDirection.Output; InsertCommand.Parameters.Add(GetParameter("@StudentID", SqlDbType.VarChar, thePreQualifications.StudentID)); InsertCommand.Parameters.Add(GetParameter("@QualID", SqlDbType.VarChar, thePreQualifications.QualID)); InsertCommand.Parameters.Add(GetParameter("@PassingYear", SqlDbType.VarChar, thePreQualifications.PassingYear)); InsertCommand.Parameters.Add(GetParameter("@Board", SqlDbType.VarChar, thePreQualifications.Board)); InsertCommand.Parameters.Add(GetParameter("@Division", SqlDbType.VarChar, thePreQualifications.Division)); InsertCommand.Parameters.Add(GetParameter("@Percentage", SqlDbType.VarChar, thePreQualifications.Percentage)); InsertCommand.Parameters.Add(GetParameter("@AddedBy", SqlDbType.VarChar, thePreQualifications.AddedBy)); InsertCommand.Parameters.Add(GetParameter("@OfficeID", SqlDbType.Int, thePreQualifications.OfficeID)); InsertCommand.Parameters.Add(GetParameter("@CompanyID", SqlDbType.VarChar, thePreQualifications.CompanyID)); InsertCommand.CommandText = "piCAS_Student_PreQuals_Insert"; ExecuteStoredProcedure(InsertCommand); ReturnValueQuals = int.Parse(InsertCommand.Parameters[0].Value.ToString()); } return(ReturnValueQuals); }
public static List <StudentPreviousQual> ConvertDatarowToObject(DataTable QualListTable) { List <StudentPreviousQual> PreQualList = new List <StudentPreviousQual>(); foreach (DataRow dr in QualListTable.Rows) { StudentPreviousQual ThePreQual = new StudentPreviousQual(); ThePreQual.QualName = dr["QualName"].ToString(); ThePreQual.QualCode = dr["QualCode"].ToString(); ThePreQual.PreQualID = int.Parse(dr["PreQualID"].ToString()); ThePreQual.QualID = int.Parse(dr["QualID"].ToString()); ThePreQual.StudentID = int.Parse(dr["StudentID"].ToString()); ThePreQual.Board = dr["Board"].ToString(); ThePreQual.Division = dr["Division"].ToString(); ThePreQual.Percentage = dr["Percentage"].ToString(); ThePreQual.PassingYear = dr["PassingYear"].ToString(); ThePreQual.OfficeID = int.Parse(dr["OfficeID"].ToString()); PreQualList.Add(ThePreQual); } return(PreQualList); }