Exemplo n.º 1
0
        public static Boolean InsertUpdateExamResult(clsExamResult objExamResult)
        {
            bool   isAdded = false;
            string SpName  = "usp_InsertUpdateExamResult";

            try
            {
                using (IDbConnection db = new SqlConnection(System.Configuration.ConfigurationManager.AppSettings["databaseConnection"]))
                {
                    db.Execute(SpName, objExamResult, commandType: CommandType.StoredProcedure);
                }
                isAdded = true;
            }
            catch (Exception ex)
            {
                ErrorHandler.ErrorLogging(ex, false);
                ErrorHandler.ReadError();
            }
            return(isAdded);
        }
Exemplo n.º 2
0
        public static clsExamResult SelectExamResultById(int ExamResultId)
        {
            clsExamResult objExamResult = new clsExamResult();
            bool          isnull        = true;
            string        SpName        = "usp_SelectExamResult";
            var           objPar        = new DynamicParameters();

            if (String.IsNullOrEmpty(ExamResultId.ToString()))
            {
                throw new ArgumentException("Function parameters cannot be blank!");
            }
            else
            {
                try
                {
                    objPar.Add("@ExamResultId", ExamResultId, dbType: DbType.Int32);

                    using (IDbConnection db = new SqlConnection(System.Configuration.ConfigurationManager.AppSettings["databaseConnection"]))
                    {
                        objExamResult = db.Query <clsExamResult>(SpName, objPar, commandType: CommandType.StoredProcedure).SingleOrDefault();
                        isnull        = false;
                    }
                }
                catch (Exception ex)
                {
                    ErrorHandler.ErrorLogging(ex, false);
                    ErrorHandler.ReadError();
                }
            }

            if (isnull)
            {
                return(null);
            }
            else
            {
                return(objExamResult);
            }
        }