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