Esempio n. 1
0
        /// <summary>
        /// 修改资源信息
        /// </summary>
        /// <param name="resource">资源实体</param>
        /// <returns>是否成功</returns>
        public bool ModifyResource(Resource resource)
        {
            ResourceM r = new ResourceM();

            r.Bind(resource);

            r.RSID.IsInc        = false;
            r.Create_Time.IsInc = false;

            r.Last_Update.Value = DateTime.Now;

            return(r.NoLock().Where(r.RSID == resource.RSID).Update());
        }
Esempio n. 2
0
        /// <summary>
        /// 添加资源
        /// </summary>
        /// <param name="resource">资源实体</param>
        /// <param name="tran">事务</param>
        /// <returns>是否成功</returns>
        public int AppendResource(Resource resource, QDbTran tran)
        {
            if (resource == null)
            {
                return(0);
            }

            if (string.IsNullOrEmpty(resource.Uri_Target))
            {
                resource.Uri_Target = "_self";
            }

            resource.Create_Time = DateTime.Now;
            resource.Last_Update = resource.Create_Time;

            ResourceM r = new ResourceM();

            r.Bind(resource);

            r.Insert(true, tran);

            return(r.INSERTED_ID);
        }