コード例 #1
0
        /// <summary>
        /// Updates a record in the Files table.
        /// </summary>
        public bool Update(FileEntity file)
        {
            bool res = false;

            try
            {
                var p = Param(file, "edit");
                res = (bool)unitOfWork.ProcedureExecute("ptgroup_File_Update", p);
                return(res);
            }
            catch (Exception ex)
            {
                Logging.PutError(ex.Message, ex);
                return(res);
            }
        }
コード例 #2
0
        /// <summary>
        /// Saves a record to the Files table.
        /// </summary>
        private DynamicParameters Param(FileEntity file, string action = "add")
        {
            var p = new DynamicParameters();

            if (action == "edit")
            {
                p.Add("@Id", file.Id);
            }
            else
            {
                p.Add("@Id", dbType: DbType.Int64, direction: ParameterDirection.Output);
            }
            p.Add("@UserId", file.UserId);
            p.Add("@Name", file.Name);
            p.Add("@MimeType", file.MimeType);
            p.Add("@FileSize", file.FileSize);
            p.Add("@IsDel", file.IsDel);
            p.Add("@Private", file.Private);
            p.Add("@UploadDate", file.UploadDate);
            p.Add("@DispatchId", file.DispatchId);
            p.Add("@Type", file.Type);
            return(p);
        }
コード例 #3
0
        /// <summary>
        /// Saves a record to the Files table.
        /// </summary>
        public long Insert(FileEntity file)
        {
            long res  = 0;
            bool flag = false;

            try
            {
                var p = Param(file);
                flag = (bool)unitOfWork.ProcedureExecute("ptgroup_File_Insert", p);
                if (flag)
                {
                    res = p.Get <long>("@Id");
                }
                else
                {
                    res = 0;
                }
            }
            catch (Exception ex)
            {
                Logging.PutError(ex.Message, ex);
            }
            return(res);
        }