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