示例#1
0
        /// <summary>
        /// 按主键ID进行删除
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        public static bool DeleteById(int id)
        {
            Attachment entity = AttachmentDAO.Get(id);
            bool       res    = AttachmentDAO.DeleteById(id, () =>
            {
                // 数据库删掉后,再从磁盘里删掉
                if (File.Exists(entity.PhysicalPath))
                {
                    File.Delete(entity.PhysicalPath);
                }
            });

            return(res);
        }
示例#2
0
        /// <summary>
        /// 获取拜访任务列表
        /// </summary>
        /// <param name="entity"></param>
        /// <param name="pageIndex"></param>
        /// <param name="pageSize"></param>
        /// <param name="rowCount"></param>
        /// <returns></returns>
        public AttachmentEntity[] GetList(AttachmentEntity entity, int pageIndex, int pageSize, out int rowCount)
        {
            List <IWhereCondition> wheres = new List <IWhereCondition>();

            List <OrderBy> orderbys = new List <OrderBy>();

            orderbys.Add(new OrderBy()
            {
                FieldName = "CreateTime", Direction = OrderByDirections.Desc
            });

            PagedQueryResult <AttachmentEntity> pEntity = new AttachmentDAO(this.CurrentUserInfo).PagedQueryByEntity(entity, orderbys.ToArray(), pageSize, pageIndex);

            rowCount = pEntity.RowCount;
            return(pEntity.Entities);
        }
示例#3
0
 public AttachmentDI()
 {
     mObjAttachmentDAO = new AttachmentDAO();
 }
示例#4
0
        }//AddAttachment end

        public static List <Attachment> GetListByRelatedId(int relatedID)
        {
            var res = AttachmentDAO.GetListByRelatedId(relatedID);

            return(res);
        }
示例#5
0
 public static bool Add(Attachment entity)
 {
     return(AttachmentDAO.Add(entity));
 }
示例#6
0
 /// <summary>
 /// 构造函数
 /// </summary>
 public AttachmentBLL(LoggingSessionInfo pUserInfo)
 {
     this.CurrentUserInfo = pUserInfo;
     this._currentDAO     = new AttachmentDAO(pUserInfo);
 }
示例#7
0
        /// <summary> Retrieves Entity rows in a datatable which match the specified filter. It will always create a new connection to the database.</summary>
        /// <param name="selectFilter">A predicate or predicate expression which should be used as filter for the entities to retrieve.</param>
        /// <param name="maxNumberOfItemsToReturn"> The maximum number of items to return with this retrieval query.</param>
        /// <param name="sortClauses">The order by specifications for the sorting of the resultset. When not specified, no sorting is applied.</param>
        /// <param name="relations">The set of relations to walk to construct to total query.</param>
        /// <param name="pageNumber">The page number to retrieve.</param>
        /// <param name="pageSize">The page size of the page to retrieve.</param>
        /// <returns>DataTable with the rows requested.</returns>
        public static DataTable GetMultiAsDataTable(IPredicate selectFilter, long maxNumberOfItemsToReturn, ISortExpression sortClauses, IRelationCollection relations, int pageNumber, int pageSize)
        {
            AttachmentDAO dao = DAOFactory.CreateAttachmentDAO();

            return(dao.GetMultiAsDataTable(maxNumberOfItemsToReturn, sortClauses, selectFilter, relations, pageNumber, pageSize));
        }