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