public static Boolean InsertUpdateInstructor_File(clsInstructor_File objInstructor_File) { bool isAdded = false; string SpName = "usp_InsertUpdateInstructor_File"; try { using (IDbConnection db = new SqlConnection(System.Configuration.ConfigurationManager.AppSettings["databaseConnection"])) { db.Execute(SpName, objInstructor_File, commandType: CommandType.StoredProcedure); } isAdded = true; } catch (Exception ex) { ErrorHandler.ErrorLogging(ex, false); ErrorHandler.ReadError(); } return(isAdded); }
public static clsInstructor_File SelectInstructor_FileById(int?InstructorFileId) { clsInstructor_File objInstructor_File = new clsInstructor_File(); bool isnull = true; string SpName = "usp_SelectInstructor_File"; var objPar = new DynamicParameters(); if (String.IsNullOrEmpty(InstructorFileId.ToString())) { throw new ArgumentException("Function parameters cannot be blank!"); } else { try { objPar.Add("@InstructorFileId", InstructorFileId, dbType: DbType.Int32); using (IDbConnection db = new SqlConnection(System.Configuration.ConfigurationManager.AppSettings["databaseConnection"])) { objInstructor_File = db.Query <clsInstructor_File>(SpName, objPar, commandType: CommandType.StoredProcedure).SingleOrDefault(); isnull = false; } } catch (Exception ex) { ErrorHandler.ErrorLogging(ex, false); ErrorHandler.ReadError(); } } if (isnull) { return(null); } else { return(objInstructor_File); } }