Exemplo n.º 1
0
        public static Boolean InsertUpdateaudit(clsaudit objaudit)
        {
            bool   isAdded = false;
            string SpName  = "usp_InsertUpdateaudit";

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

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

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

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