示例#1
0
 public void SubmitForm(ModuleButtonEntity moduleButtonEntity, string keyValue)
 {
     if (!string.IsNullOrEmpty(keyValue))
     {
         moduleButtonEntity.Modify(keyValue);
         service.Update(moduleButtonEntity);
         try
         {
             //添加日志
             LogMess.addLog(DbLogType.Update.ToString(), "修改成功", "修改菜单按钮信息【" + moduleButtonEntity.F_FullName + "】成功!");
         }
         catch { }
     }
     else
     {
         moduleButtonEntity.Create();
         service.Insert(moduleButtonEntity);
         try
         {
             //添加日志
             LogMess.addLog(DbLogType.Update.ToString(), "修改成功", "新建菜单按钮信息【" + moduleButtonEntity.F_FullName + "】成功!");
         }
         catch { }
     }
 }
        /// <summary>
        /// 添加按钮
        /// </summary>
        /// <param name="moduleButtonEntity">按钮实体</param>
        public void AddEntity(ModuleButtonEntity moduleButtonEntity)
        {
            moduleButtonEntity.Create();
            Base_ModuleButton modelButton = new Base_ModuleButton();

            modelButton = EntityConvertTools.CopyToModel <ModuleButtonEntity, Base_ModuleButton>(moduleButtonEntity, null);
            modelButton.Insert();
        }
示例#3
0
 public void SubmitForm(ModuleButtonEntity moduleButtonEntity, string keyValue)
 {
     if (!string.IsNullOrEmpty(keyValue))
     {
         moduleButtonEntity.Modify(keyValue);
         service.Update(moduleButtonEntity);
     }
     else
     {
         moduleButtonEntity.Create();
         service.Insert(moduleButtonEntity);
     }
 }
示例#4
0
 public async Task <int> SubmitFormAsync(ModuleButtonEntity entity, string keyValue)
 {
     if (string.IsNullOrEmpty(keyValue))
     {
         entity.Create();
         return(await buttonRepository.InsertAsync(entity));
     }
     else
     {
         entity.Modify(keyValue);
         return(await buttonRepository.UpdateAsync(entity));
     }
 }
        public ActionResult SaveForm(string keyValue, string relationJson, string moduleJson, string moduleColumnJson, string moduleFormJson)
        {
            FormRelationEntity formRelationEntity = relationJson.ToObject <FormRelationEntity>();
            ModuleEntity       moduleEntity       = moduleJson.ToObject <ModuleEntity>();

            moduleEntity.F_IsMenu      = 1;
            moduleEntity.F_EnabledMark = 1;
            if (string.IsNullOrEmpty(keyValue))// 新增
            {
                formRelationEntity.Create();
                moduleEntity.F_Target     = "iframe";
                moduleEntity.F_UrlAddress = "/LR_FormModule/FormRelation/PreviewIndex?id=" + formRelationEntity.F_Id;
            }

            List <ModuleButtonEntity> moduleButtonList = new List <ModuleButtonEntity>();
            ModuleButtonEntity        addButtonEntity  = new ModuleButtonEntity();

            addButtonEntity.Create();
            addButtonEntity.F_EnCode   = "lr_add";
            addButtonEntity.F_FullName = "新增";
            moduleButtonList.Add(addButtonEntity);
            ModuleButtonEntity editButtonEntity = new ModuleButtonEntity();

            editButtonEntity.Create();
            editButtonEntity.F_EnCode   = "lr_edit";
            editButtonEntity.F_FullName = "编辑";
            moduleButtonList.Add(editButtonEntity);
            ModuleButtonEntity deleteButtonEntity = new ModuleButtonEntity();

            deleteButtonEntity.Create();
            deleteButtonEntity.F_EnCode   = "lr_delete";
            deleteButtonEntity.F_FullName = "删除";
            moduleButtonList.Add(deleteButtonEntity);
            ModuleButtonEntity printButtonEntity = new ModuleButtonEntity();

            printButtonEntity.Create();
            printButtonEntity.F_EnCode   = "lr_print";
            printButtonEntity.F_FullName = "打印";
            moduleButtonList.Add(printButtonEntity);

            List <ModuleColumnEntity> moduleColumnList  = moduleColumnJson.ToObject <List <ModuleColumnEntity> >();
            List <ModuleFormEntity>   moduleFormEntitys = moduleFormJson.ToObject <List <ModuleFormEntity> >();

            moduleIBLL.SaveEntity(formRelationEntity.F_ModuleId, moduleEntity, moduleButtonList, moduleColumnList, moduleFormEntitys);
            formRelationEntity.F_ModuleId = moduleEntity.F_ModuleId;
            formRelationIBLL.SaveEntity(keyValue, formRelationEntity);

            return(Success("保存成功!"));
        }
示例#6
0
 public void SubmitForm(ModuleButtonEntity moduleButtonEntity, string keyValue)
 {
     if (!string.IsNullOrEmpty(keyValue))
     {
         moduleButtonEntity.Modify(keyValue);
         service.Update(moduleButtonEntity);
         //添加日志
         LogHelp.logHelp.WriteDbLog(true, "修改按钮信息=>" + moduleButtonEntity.FullName, Enums.DbLogType.Update, "按钮管理");
     }
     else
     {
         moduleButtonEntity.Create();
         service.Insert(moduleButtonEntity);
         //添加日志
         LogHelp.logHelp.WriteDbLog(true, "添加按钮信息=>" + moduleButtonEntity.FullName, Enums.DbLogType.Create, "按钮管理");
     }
 }
示例#7
0
 /// <summary>
 /// 修改菜单按钮信息
 /// </summary>
 /// <param name="moduleButtonEntity"></param>
 /// <param name="keyValue"></param>
 public void SubmitForm(ModuleButtonEntity moduleButtonEntity, string keyValue)
 {
     if (!string.IsNullOrEmpty(keyValue))
     {
         moduleButtonEntity.Modify(keyValue);
         ResultClass <int> _ret = service.Update(moduleButtonEntity);
         if (!_ret.Result)
         {
             throw new Exception(_ret.ErrorMessage);
         }
     }
     else
     {
         moduleButtonEntity.Create();
         ResultClass <int> _ret = service.Insert(moduleButtonEntity);
         if (!_ret.Result)
         {
             throw new Exception(_ret.ErrorMessage);
         }
     }
 }
示例#8
0
        public Task <int> SubmitForm <TDto>(ModuleButtonEntity moduleButtonEntity, TDto dto) where TDto : class
        {
            var claimsIdentity = _httpContext.HttpContext.User.Identity as ClaimsIdentity;
            var claim          = claimsIdentity?.FindFirst(t => t.Type.Equals(ClaimTypes.NameIdentifier));

            if (!string.IsNullOrEmpty(moduleButtonEntity.F_Id))
            {
                moduleButtonEntity.Modify(moduleButtonEntity.F_Id);
                if (claim != null)
                {
                    moduleButtonEntity.F_LastModifyUserId = claim.Value;
                }
                return(_service.UpdateAsync(moduleButtonEntity, dto));
            }
            else
            {
                moduleButtonEntity.Create();
                if (claim != null)
                {
                    moduleButtonEntity.F_CreatorUserId = claim.Value;
                }
                return(_service.InsertAsync(moduleButtonEntity));
            }
        }
        public ActionResult CreateWorkflowCode(string databaseLinkId, string dbTable, string formData, string queryData, string colData, string baseInfo, string moduleEntityJson)
        {
            // 数据
            List <DbTableModel> dbTableObj   = dbTable.ToObject <List <DbTableModel> >();
            FormModel           formDataObj  = formData.ToObject <FormModel>();
            QueryModel          queryDataObj = queryData.ToObject <QueryModel>();
            ColModel            colDataObj   = colData.ToObject <ColModel>();
            BaseModel           baseInfoObj  = baseInfo.ToObject <BaseModel>();


            var moduleEntity = moduleEntityJson.ToObject <ModuleEntity>();

            moduleEntity.F_Target     = "iframe";
            moduleEntity.F_UrlAddress = "/" + baseInfoObj.outputArea + "/" + baseInfoObj.name + "/Index";

            List <ModuleButtonEntity> moduleButtonList = new List <ModuleButtonEntity>();
            ModuleButtonEntity        addButtonEntity  = new ModuleButtonEntity();

            addButtonEntity.Create();
            addButtonEntity.F_EnCode   = "lr_add";
            addButtonEntity.F_FullName = "新增";
            moduleButtonList.Add(addButtonEntity);
            ModuleButtonEntity editButtonEntity = new ModuleButtonEntity();

            editButtonEntity.Create();
            editButtonEntity.F_EnCode   = "lr_edit";
            editButtonEntity.F_FullName = "编辑";
            moduleButtonList.Add(editButtonEntity);
            ModuleButtonEntity deleteButtonEntity = new ModuleButtonEntity();

            deleteButtonEntity.Create();
            deleteButtonEntity.F_EnCode   = "lr_delete";
            deleteButtonEntity.F_FullName = "删除";
            moduleButtonList.Add(deleteButtonEntity);

            List <ModuleColumnEntity> moduleColumnList = new List <ModuleColumnEntity>();
            int num = 0;

            foreach (var col in colDataObj.fields)
            {
                ModuleColumnEntity moduleColumnEntity = new ModuleColumnEntity();
                moduleColumnEntity.Create();
                moduleColumnEntity.F_EnCode   = col.fieldId;
                moduleColumnEntity.F_FullName = col.fieldName;
                moduleColumnEntity.F_SortCode = num;
                moduleColumnEntity.F_ParentId = "0";
                num++;
                moduleColumnList.Add(moduleColumnEntity);
            }
            var moduleEntityTemp = moduleIBLL.GetModuleByUrl(moduleEntity.F_UrlAddress);

            if (moduleEntityTemp == null)
            {
                moduleIBLL.SaveEntity("", moduleEntity, moduleButtonList, moduleColumnList);
            }

            string codeContent = "";
            // 将表单数据进行一次转化
            Dictionary <string, CompontModel> compontMap = new Dictionary <string, CompontModel>();
            bool haveEditGird = false;

            foreach (var tab in formDataObj.tablist)
            {
                foreach (var compont in tab.componts)
                {
                    if (compont.type == "gridtable")
                    {
                        haveEditGird = true;
                    }
                    compontMap.Add(compont.id, compont);
                }
            }


            // 实体类 映射类

            string mainTable = "";

            foreach (var tableOne in dbTableObj)
            {
                bool isMain = false;
                if (string.IsNullOrEmpty(tableOne.relationName))
                {
                    mainTable = tableOne.name;
                    isMain    = true;
                }
                // 实体类
                codeContent = codeGenerator.WfEntityCreate(databaseLinkId, tableOne.name, tableOne.pk, baseInfoObj, colDataObj, isMain, formDataObj.workField);
                codeGenerator.CreateEntityCodeFile(baseInfoObj, tableOne.name, codeContent);
                // 映射类
                codeContent = codeGenerator.MappingCreate(tableOne.name, tableOne.pk, baseInfoObj);
                codeGenerator.CreateMapCodeFile(baseInfoObj, tableOne.name, codeContent);
            }

            // 服务类
            codeContent = codeGenerator.WfServiceCreate(databaseLinkId, dbTableObj, compontMap, queryDataObj, colDataObj, baseInfoObj, formDataObj.workField);
            codeGenerator.CreateSerivceCodeFile(baseInfoObj, codeContent);
            // 业务类
            codeContent = codeGenerator.WfBllCreate(baseInfoObj, dbTableObj, compontMap, colDataObj);
            codeGenerator.CreateBLLCodeFile(baseInfoObj, codeContent);
            // 业务接口类
            codeContent = codeGenerator.WfIBllCreate(baseInfoObj, dbTableObj, compontMap, colDataObj);
            codeGenerator.CreateIBLLCodeFile(baseInfoObj, codeContent);
            // 控制器类
            codeContent = codeGenerator.WfControllerCreate(baseInfoObj, dbTableObj, compontMap, colDataObj);
            codeGenerator.CreateControllerCodeFile(baseInfoObj, codeContent);
            // 页面类
            codeContent = codeGenerator.IndexCreate(baseInfoObj, compontMap, queryDataObj);
            codeGenerator.CreateIndexCodeFile(baseInfoObj, codeContent);
            // 页面js类
            codeContent = codeGenerator.WfIndexJSCreate(baseInfoObj, dbTableObj, formDataObj, compontMap, colDataObj, queryDataObj);
            codeGenerator.CreateIndexJSCodeFile(baseInfoObj, codeContent);
            // 表单类
            codeContent = codeGenerator.FormCreate(baseInfoObj, formDataObj, compontMap, haveEditGird);
            codeGenerator.CreateFormCodeFile(baseInfoObj, codeContent);
            // 表单js类
            codeContent = codeGenerator.WfFormJsCreate(baseInfoObj, dbTableObj, formDataObj);
            codeGenerator.CreateFormJSCodeFile(baseInfoObj, codeContent);

            return(Success("创建成功"));
        }
        public ActionResult CreateFastCode(CodeBaseConfigModel codeBaseConfigModel)
        {
            string codeContent = "";

            codeBaseConfigModel.backProject = ConfigurationManager.AppSettings["BackProject"].ToString();
            // 实体类
            codeContent = codeGenerator.EntityCreate(codeBaseConfigModel, codeBaseConfigModel.tableName);
            codeGenerator.CreateEntityCodeFile(codeBaseConfigModel, codeBaseConfigModel.tableName, codeContent);
            // 映射类
            codeContent = codeGenerator.MappingCreate(codeBaseConfigModel, codeBaseConfigModel.tableName);
            codeGenerator.CreateMapCodeFile(codeBaseConfigModel, codeBaseConfigModel.tableName, codeContent);
            // 服务类
            codeContent = codeGenerator.ServiceCreate(codeBaseConfigModel);
            codeGenerator.CreateSerivceCodeFile(codeBaseConfigModel, codeContent);
            // 业务接口类
            codeContent = codeGenerator.IBllCreate(codeBaseConfigModel);
            codeGenerator.CreateIBLLCodeFile(codeBaseConfigModel, codeContent);
            // 业务类
            codeContent = codeGenerator.BllCreate(codeBaseConfigModel);
            codeGenerator.CreateBLLCodeFile(codeBaseConfigModel, codeContent);
            // 控制器类
            codeContent = codeGenerator.ControllerCreate(codeBaseConfigModel);
            codeGenerator.CreateControllerCodeFile(codeBaseConfigModel, codeContent);
            // 页面类
            codeContent = codeGenerator.IndexCreate(codeBaseConfigModel);
            codeGenerator.CreateIndexCodeFile(codeBaseConfigModel, codeContent);
            // 页面js类
            codeContent = codeGenerator.IndexJSCreate(codeBaseConfigModel);
            codeGenerator.CreateIndexJSCodeFile(codeBaseConfigModel, codeContent);
            // 表单类
            codeContent = codeGenerator.FormCreate(codeBaseConfigModel);
            codeGenerator.CreateFormCodeFile(codeBaseConfigModel, codeContent);
            // 表单js类
            codeContent = codeGenerator.FormJsCreate(codeBaseConfigModel);
            codeGenerator.CreateFormJSCodeFile(codeBaseConfigModel, codeContent);

            var moduleEntity = codeBaseConfigModel.moduleEntityJson.ToObject <ModuleEntity>();

            moduleEntity.F_Target     = "iframe";
            moduleEntity.F_UrlAddress = "/" + codeBaseConfigModel.area + "/" + codeBaseConfigModel.name + "/Index";

            List <ModuleButtonEntity> moduleButtonList = new List <ModuleButtonEntity>();
            ModuleButtonEntity        addButtonEntity  = new ModuleButtonEntity();

            addButtonEntity.Create();
            addButtonEntity.F_ActionAddress = "/" + codeBaseConfigModel.area + "/" + codeBaseConfigModel.name + "/Form";
            addButtonEntity.F_EnCode        = "lr_add";
            addButtonEntity.F_FullName      = "新增";
            moduleButtonList.Add(addButtonEntity);
            ModuleButtonEntity editButtonEntity = new ModuleButtonEntity();

            editButtonEntity.Create();
            editButtonEntity.F_ActionAddress = "/" + codeBaseConfigModel.area + "/" + codeBaseConfigModel.name + "/Form";
            editButtonEntity.F_EnCode        = "lr_edit";
            editButtonEntity.F_FullName      = "编辑";
            moduleButtonList.Add(editButtonEntity);
            ModuleButtonEntity deleteButtonEntity = new ModuleButtonEntity();

            deleteButtonEntity.Create();
            deleteButtonEntity.F_ActionAddress = "/" + codeBaseConfigModel.area + "/" + codeBaseConfigModel.name + "/DeleteForm";
            deleteButtonEntity.F_EnCode        = "lr_delete";
            deleteButtonEntity.F_FullName      = "删除";
            moduleButtonList.Add(deleteButtonEntity);

            List <ModuleColumnEntity> moduleColumnList = new List <ModuleColumnEntity>();
            int num = 0;
            IEnumerable <DatabaseTableFieldModel> fieldList = databaseTableIBLL.GetTableFiledList(codeBaseConfigModel.databaseLinkId, codeBaseConfigModel.tableName);

            foreach (var fileditem in fieldList)
            {
                ModuleColumnEntity moduleColumnEntity = new ModuleColumnEntity();
                moduleColumnEntity.Create();
                moduleColumnEntity.F_EnCode   = fileditem.f_column;
                moduleColumnEntity.F_FullName = fileditem.f_remark;
                moduleColumnEntity.F_SortCode = num;
                moduleColumnEntity.F_ParentId = "0";
                num++;
                moduleColumnList.Add(moduleColumnEntity);
            }
            moduleIBLL.SaveEntity("", moduleEntity, moduleButtonList, moduleColumnList);

            return(Success("创建成功"));
        }
示例#11
0
        /// <summary>
        /// 保存实体数据(关联功能模块菜单)
        /// </summary>
        /// <param name="keyValue">主键Id</param>
        /// <param name="entity">表单关联实体</param>
        /// <param name="moduleEntity">系统功能模板实体</param>
        /// <param name="formModuleContentEntity">表单内容数据</param>
        /// <returns></returns>
        public void SaveEntity(string keyValue, FormModuleRelationEntity entity, ModuleEntity moduleEntity, Form_ModuleContentEntity formModuleContentEntity)
        {
            IRepository db = this.BaseRepository().BeginTrans();

            try
            {
                var expression = LinqExtensions.True <Form_ModuleContentEntity>();
                expression = expression.And(t => t.F_FrmId == entity.F_FrmId && t.F_FrmVersion == entity.F_FrmVersion);
                Form_ModuleContentEntity form_ModuleContentEntity = db.FindEntity <Form_ModuleContentEntity>(expression);
                if (form_ModuleContentEntity == null)
                {
                    formModuleContentEntity.Create();
                    db.Insert(formModuleContentEntity);
                    entity.F_ModuleContentId = formModuleContentEntity.F_Id;
                }
                else
                {
                    entity.F_ModuleContentId = form_ModuleContentEntity.F_Id;
                }

                if (string.IsNullOrEmpty(keyValue))
                {
                    entity.Create();
                    moduleEntity.Create();
                    db.Insert(moduleEntity);
                    entity.F_ObjectId         = moduleEntity.F_ModuleId;
                    entity.F_ObjectName       = moduleEntity.F_FullName;
                    moduleEntity.F_UrlAddress = moduleEntity.F_UrlAddress + "?Id=" + entity.F_Id;
                    db.Insert(entity);
                }
                else
                {
                    entity.Modify(keyValue);
                    moduleEntity.Modify(entity.F_ObjectId);
                    db.Update(moduleEntity);
                    entity.F_ObjectName       = moduleEntity.F_FullName;
                    moduleEntity.F_UrlAddress = moduleEntity.F_UrlAddress + "?Id=" + entity.F_Id;
                    db.Update(entity);
                }

                db.Delete <ModuleButtonEntity>(t => t.F_ModuleId.Equals(moduleEntity.F_ModuleId));
                ModuleButtonEntity moduleButtonrReplace = new ModuleButtonEntity();
                moduleButtonrReplace.F_ModuleId = moduleEntity.F_ModuleId;
                moduleButtonrReplace.F_EnCode   = "lr-replace";
                moduleButtonrReplace.F_FullName = "刷新";
                moduleButtonrReplace.F_SortCode = 0;
                moduleButtonrReplace.F_ParentId = "0";
                moduleButtonrReplace.Create();
                db.Insert(moduleButtonrReplace);

                ModuleButtonEntity moduleButtonrAdd = new ModuleButtonEntity();
                moduleButtonrAdd.F_ModuleId      = moduleEntity.F_ModuleId;
                moduleButtonrAdd.F_EnCode        = "lr-add";
                moduleButtonrAdd.F_FullName      = "新增";
                moduleButtonrAdd.F_SortCode      = 1;
                moduleButtonrAdd.F_ActionAddress = "/FormManage/FormModule/CustmerFormForm";
                moduleButtonrAdd.F_ParentId      = "0";
                moduleButtonrAdd.Create();
                db.Insert(moduleButtonrAdd);

                ModuleButtonEntity moduleButtonrEdit = new ModuleButtonEntity();
                moduleButtonrEdit.F_ModuleId      = moduleEntity.F_ModuleId;
                moduleButtonrEdit.F_EnCode        = "lr-edit";
                moduleButtonrEdit.F_FullName      = "编辑";
                moduleButtonrEdit.F_SortCode      = 2;
                moduleButtonrEdit.F_ActionAddress = "/FormManage/FormModule/CustmerFormForm";
                moduleButtonrEdit.F_ParentId      = "0";
                moduleButtonrEdit.Create();
                db.Insert(moduleButtonrEdit);

                ModuleButtonEntity moduleButtonrDelete = new ModuleButtonEntity();
                moduleButtonrDelete.F_ModuleId      = moduleEntity.F_ModuleId;
                moduleButtonrDelete.F_EnCode        = "lr-delete";
                moduleButtonrDelete.F_FullName      = "删除";
                moduleButtonrDelete.F_SortCode      = 3;
                moduleButtonrDelete.F_ActionAddress = "/FormManage/FormModule/CustmerFormRemove";
                moduleButtonrDelete.F_ParentId      = "0";
                moduleButtonrDelete.Create();
                db.Insert(moduleButtonrDelete);

                db.Commit();
            }
            catch
            {
                db.Rollback();
                throw;
            }
        }
示例#12
0
 /// <summary>
 /// 添加按钮
 /// </summary>
 /// <param name="moduleButtonEntity">按钮实体</param>
 public void AddEntity(ModuleButtonEntity moduleButtonEntity)
 {
     moduleButtonEntity.Create();
     this.BaseRepository().Insert <ModuleButtonEntity>(moduleButtonEntity);
 }