构建ASP.NET MVC4+EF5+EasyUI+Unity2.x注入的后台管理系统(46)-工作流设计-设计分支
2015-05-08 11:56
417 查看
系列目录
步骤设置完毕之后,就要设置好流转了,比如财务申请大于50000元(请假天数>5天)要总经理审批,否则财务审批之后就结束了。
StepRuleList Action
写了这么多都是为了填充这种主从表关系的数据,目前为止都很容易消化。
步骤设置完毕之后,就要设置好流转了,比如财务申请大于50000元(请假天数>5天)要总经理审批,否则财务审批之后就结束了。
[SupportFilter(ActionName = "Edit")] public ActionResult StepRuleList(string stepId,string formId) { //获取现有的步骤 GridPager pager = new GridPager() { rows = 1000, page = 1, sort = "Id", order = "desc" }; Flow_FormModel flowFormModel = m_BLL.GetById(formId); List<Flow_FormAttrModel> attrList = new List<Flow_FormAttrModel>();//获取表单关联的字段 attrList = GetAttrList(flowFormModel); List<Flow_StepModel> stepList = stepBLL.GetList(ref pager, formId); ViewBag.StepId = stepId; ViewBag.AttrList = attrList; ViewBag.StepList = stepList; return View(); } [HttpPost] [SupportFilter(ActionName = "Edit")] public JsonResult GetStepRuleList(string stepId) { List<Flow_StepRuleModel> stepList = stepRuleBLL.GetList(stepId); int i =1; var json = new { rows = (from r in stepList select new Flow_StepRuleModel() { Mes="分支"+(i++), Id = r.Id, StepId = r.StepId, AttrId = r.AttrId, AttrName = r.AttrName, Operator = r.Operator, Result = r.Result, NextStep = r.NextStep, NextStepName = r.NextStepName, Action = "<a href='#' title='删除' class='icon-remove' onclick='DeleteEvent(\""+r.Id+"\")'></a>" }).ToArray() }; return Json(json); } [HttpPost] [SupportFilter(ActionName = "Edit")] public JsonResult CreateStepEvent(Flow_StepRuleModel model) { model.Id = ResultHelper.NewId; if (model != null && ModelState.IsValid) { if (stepRuleBLL.Create(ref errors, model)) { LogHandler.WriteServiceLog(GetUserId(), "Id" + model.Id + ",StepId" + model.Id, "成功", "创建", "Flow_StepRule"); return Json(JsonHandler.CreateMessage(1, Suggestion.InsertSucceed, model.Id)); } else { string ErrorCol = errors.Error; LogHandler.WriteServiceLog(GetUserId(), "Id" + model.Id + ",StepId" + model.Id + "," + ErrorCol, "失败", "创建", "Flow_StepRule"); return Json(JsonHandler.CreateMessage(0, Suggestion.InsertFail + ErrorCol)); } } else { return Json(JsonHandler.CreateMessage(0, Suggestion.InsertFail)); } } [HttpPost] [SupportFilter(ActionName = "Edit")] public JsonResult DeleteStepRule(string id) { if (!string.IsNullOrWhiteSpace(id)) { if (stepRuleBLL.Delete(ref errors, id)) { LogHandler.WriteServiceLog(GetUserId(), "Id:" + id, "成功", "删除", "Flow_StepRule"); return Json(JsonHandler.CreateMessage(1, Suggestion.DeleteSucceed)); } else { string ErrorCol = errors.Error; LogHandler.WriteServiceLog(GetUserId(), "Id" + id + "," + ErrorCol, "失败", "删除", "Flow_StepRule"); return Json(JsonHandler.CreateMessage(0, Suggestion.DeleteFail + ErrorCol)); } } else { return Json(JsonHandler.CreateMessage(0, Suggestion.DeleteFail)); } } //获取已经添加的字段 private List<Flow_FormAttrModel> GetAttrList(Flow_FormModel model) { List<Flow_FormAttrModel> list = new List<Flow_FormAttrModel>(); Flow_FormAttrModel attrModel = new Flow_FormAttrModel(); #region 处理字段 //获得对象的类型,myClass1 Type formType = model.GetType(); //查找名称为"MyProperty1"的属性 string[] arrStr = { "AttrA", "AttrB", "AttrC", "AttrD", "AttrE", "AttrF", "AttrG", "AttrH", "AttrI", "AttrJ", "AttrK" , "AttrL", "AttrM", "AttrN", "AttrO", "AttrP", "AttrQ", "AttrR", "AttrS", "AttrT", "AttrU" , "AttrV", "AttrW", "AttrX", "AttrY", "AttrZ"}; foreach (string str in arrStr) { object o = formType.GetProperty(str).GetValue(model, null); if (o != null) { //查找model类的Class对象的"str"属性的值 attrModel = attrBLL.GetById(o.ToString()); list.Add(attrModel); } } #endregion return list; }
StepRuleList Action
写了这么多都是为了填充这种主从表关系的数据,目前为止都很容易消化。
相关文章推荐
- 构建ASP.NET MVC4+EF5+EasyUI+Unity2.x注入的后台管理系统(46)-工作流设计-设计分支
- 构建ASP.NET MVC4+EF5+EasyUI+Unity2.x注入的后台管理系统(45)-工作流设计-设计步骤
- 构建ASP.NET MVC4+EF5+EasyUI+Unity2.x注入的后台管理系统(47)-工作流设计-补充
- 构建ASP.NET MVC4+EF5+EasyUI+Unity2.x注入的后台管理系统(43)-工作流设计-字段分类设计
- 构建ASP.NET MVC4+EF5+EasyUI+Unity2.x注入的后台管理系统(44)-工作流设计-设计表单
- 构建ASP.NET MVC4+EF5+EasyUI+Unity2.x注入的后台管理系统(43)-工作流设计-字段分类设计
- 构建ASP.NET MVC4+EF5+EasyUI+Unity2.x注入的后台管理系统(49)-工作流设计-我的申请
- 构建ASP.NET MVC4+EF5+EasyUI+Unity2.x注入的后台管理系统(44)-工作流设计-设计表单
- 构建ASP.NET MVC4+EF5+EasyUI+Unity2.x注入的后台管理系统(42)-工作流设计01
- 构建ASP.NET MVC4+EF5+EasyUI+Unity2.x注入的后台管理系统(47)-工作流设计-补充
- 构建ASP.NET MVC4+EF5+EasyUI+Unity2.x注入的后台管理系统(42)-工作流设计-表建立
- 构建ASP.NET MVC4+EF5+EasyUI+Unity2.x注入的后台管理系统(45)-工作流设计-设计步骤
- 构建ASP.NET MVC4+EF5+EasyUI+Unity2.x注入的后台管理系统(35)-文章发布系统②-构建项目
- 构建ASP.NET MVC4+EF5+EasyUI+Unity2.x注入的后台管理系统(4)-构建项目解决方案 创建EF DataBase Frist模式
- 构建ASP.NET MVC4+EF5+EasyUI+Unity2.x注入的后台管理系统(21)-权限管理系统-跑通整个系统
- 构建ASP.NET MVC4+EF5+EasyUI+Unity2.x注入的后台管理系统(30)-本地化(多语言)
- (转)构建ASP.NET MVC4+EF5+EasyUI+Unity2.x注入的后台管理系统(5)-EF增删改查by糟糕的代码
- 构建ASP.NET MVC4+EF5+EasyUI+Unity2.x注入的后台管理系统(33)-数据验证共享
- 构建ASP.NET MVC4+EF5+EasyUI+Unity2.x注入的后台管理系统(25)-权限管理系统-系统管理员(附生成器)
- 构建ASP.NET MVC4+EF5+EasyUI+Unity2.x注入的后台管理系统(5)-EF增删改查by糟糕的代码