Exemplo n.º 1
0
        /// <summary>
        /// 保存字段同时,更新模板
        /// </summary>
        /// <param name="view"></param>
        public EntityAttributeEntity SaveAttributeWithTemplate(EntityAttributeView view)
        {
            EntityAttributeEntity attrEntity = null;
            var session = SessionFactory.CreateSession();

            try
            {
                session.BeginTrans();

                //保存字段
                var eam = new EntityAttributeManager();
                attrEntity = eam.SaveAttribute(session.Connection, view.EntityAttribute, session.Transaction);

                //保存模板内容
                var edm = new EntityDefManager();
                edm.SaveTemplateWithHTMLContent(session.Connection, view.EntityDef, session.Transaction);

                session.Commit();
            }
            catch (System.Exception ex)
            {
                session.Rollback();
                throw;
            }
            finally
            {
                session.Dispose();
            }
            return(attrEntity);
        }
Exemplo n.º 2
0
        public ResponseResult <EntityAttributeEntity> SaveAttributeWithTemplate(EntityAttributeView view)
        {
            var result = ResponseResult <EntityAttributeEntity> .Default();

            try
            {
                var attrEntity = FBMasterService.SaveAttributeWithTemplate(view);
                result = ResponseResult <EntityAttributeEntity> .Success(attrEntity);
            }
            catch (System.Exception ex)
            {
                result = ResponseResult <EntityAttributeEntity> .Error(
                    string.Format("保存字段和表单模板内容失败, 错误:{0}", ex.Message)
                    );
            }
            return(result);
        }