Example #1
0
        public int AddFile(TB_FILES files)
        {
            int         result = 0;
            TB_FILESSql sql    = new TB_FILESSql();
            string      data   = sql.InsertReturnId(files);

            if (!string.IsNullOrEmpty(data))
            {
                result = Int32.Parse(data);
            }
            else
            {
                result = -1;
            }
            return(result);
        }
Example #2
0
        public bool DeleteFile(int fileId, string filePath)
        {
            TB_FILES file = new TB_FILES();

            file = new TB_FILESSql().SelectByPrimaryKey(fileId);
            TB_FILESSql sql = new TB_FILESSql();
            string      url = filePath + file.FileUrl;

            if (sql.Delete(fileId))
            {
                File.Delete(url);
                return(true);
            }
            else
            {
                return(false);
            }
        }