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