Exemple #1
0
        public static Boolean InsertUpdateTP_File(clsTP_File objTP_File)
        {
            bool   isAdded = false;
            string SpName  = "usp_InsertUpdateTP_File";

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

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

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

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