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