예제 #1
0
 /// <summary>
 /// 获取表单字段数据
 /// </summary>
 /// <param name="url">功能模块地址</param>
 /// <returns></returns>
 public List <ModuleFormEntity> GetFormListByUrl(string url)
 {
     try
     {
         ModuleEntity moduleEntity = GetModuleByUrl(url);
         if (moduleEntity == null)
         {
             return(new List <ModuleFormEntity>());
         }
         return(GetFormList(moduleEntity.F_ModuleId));
     }
     catch (Exception ex)
     {
         if (ex is ExceptionEx)
         {
             throw;
         }
         else
         {
             throw ExceptionEx.ThrowBusinessException(ex);
         }
     }
 }
예제 #2
0
 /// <summary>
 /// 虚拟删除模块功能
 /// </summary>
 /// <param name="keyValue">主键</param>
 public void VirtualDelete(string keyValue)
 {
     try
     {
         ModuleEntity entity = new ModuleEntity()
         {
             F_ModuleId   = keyValue,
             F_DeleteMark = 1
         };
         this.BaseRepository().Update(entity);
     }
     catch (Exception ex)
     {
         if (ex is ExceptionEx)
         {
             throw;
         }
         else
         {
             throw ExceptionEx.ThrowServiceException(ex);
         }
     }
 }
예제 #3
0
        /// <summary>
        /// 保存模块功能实体(新增、修改)
        /// </summary>
        /// <param name="keyValue">主键值</param>
        /// <param name="moduleEntity">实体</param>
        /// <param name="moduleButtonEntitys">按钮列表</param>
        /// <param name="moduleColumnEntitys">视图列集合</param>
        public void SaveEntity(string keyValue, ModuleEntity moduleEntity, List <ModuleButtonEntity> moduleButtonEntitys, List <ModuleColumnEntity> moduleColumnEntitys, List <ModuleFormEntity> moduleFormEntitys)
        {
            var db = this.BaseRepository().BeginTrans();

            try
            {
                if (string.IsNullOrEmpty(moduleEntity.F_ParentId) || moduleEntity.F_ParentId == "-1")
                {
                    moduleEntity.F_ParentId = "0";
                }

                if (string.IsNullOrEmpty(keyValue))
                {
                    // 新增
                    moduleEntity.Create();
                    db.Insert(moduleEntity);
                }
                else
                {
                    // 编辑
                    moduleEntity.Modify(keyValue);
                    db.Update(moduleEntity);
                    db.Delete <ModuleButtonEntity>(t => t.F_ModuleId.Equals(keyValue));
                    db.Delete <ModuleColumnEntity>(t => t.F_ModuleId.Equals(keyValue));
                    db.Delete <ModuleFormEntity>(t => t.F_ModuleId.Equals(keyValue));
                }
                int num = 0;
                if (moduleButtonEntitys != null)
                {
                    foreach (var item in moduleButtonEntitys)
                    {
                        item.F_SortCode = num;
                        item.F_ModuleId = moduleEntity.F_ModuleId;
                        if (moduleButtonEntitys.Find(t => t.F_ModuleButtonId == item.F_ParentId) == null)
                        {
                            item.F_ParentId = "0";
                        }
                        db.Insert(item);
                        num++;
                    }
                }

                if (moduleColumnEntitys != null)
                {
                    num = 0;
                    foreach (var item in moduleColumnEntitys)
                    {
                        item.F_SortCode = num;
                        item.F_ModuleId = moduleEntity.F_ModuleId;
                        db.Insert(item);
                        num++;
                    }
                }
                if (moduleFormEntitys != null)
                {
                    num = 0;
                    foreach (var item in moduleFormEntitys)
                    {
                        item.F_SortCode = num;
                        item.F_ModuleId = moduleEntity.F_ModuleId;
                        db.Insert(item);
                        num++;
                    }
                }


                db.Commit();
            }
            catch (Exception ex)
            {
                db.Rollback();
                if (ex is ExceptionEx)
                {
                    throw;
                }
                else
                {
                    throw ExceptionEx.ThrowServiceException(ex);
                }
            }
        }