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