Beispiel #1
0
        public static Boolean InsertUpdateAccreditations(clsAccreditations objAccreditations)
        {
            bool   isAdded = false;
            string SpName  = "usp_InsertUpdateAccreditation";

            try
            {
                using (IDbConnection db = new SqlConnection(System.Configuration.ConfigurationManager.AppSettings["databaseConnection"]))
                {
                    db.Execute(SpName, objAccreditations, commandType: CommandType.StoredProcedure);
                }
                isAdded = true;
            }
            catch (Exception ex)
            {
                ErrorHandler.ErrorLogging(ex, false);
                ErrorHandler.ReadError();
            }
            return(isAdded);
        }
Beispiel #2
0
        public static clsAccreditations SelectAccreditationsById(int?AccreditationId)
        {
            clsAccreditations objAccreditations = new clsAccreditations();
            bool   isnull = true;
            string SpName = "usp_SelectAccreditation";
            var    objPar = new DynamicParameters();

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

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

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