//获取已经添加的字段 private List <Flow_FormAttrModel> GetAttrList(Flow_FormModel model) { List <Flow_FormAttrModel> list = new List <Flow_FormAttrModel>(); Flow_FormAttrModel attrModel = new Flow_FormAttrModel(); #region 处理字段 //获得对象的类型,model Type formType = model.GetType(); //查找名称为"A-Z"的属性 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); }
public ActionResult Edit(string formId, string id) { //获得当前步骤ID string currentStepId = formContentBLL.GetCurrentStepCheckId(formId, id); Flow_FormModel formModel = formBLL.GetById(formId); //是否已经设置布局 if (!string.IsNullOrEmpty(formModel.HtmlForm)) { ViewBag.Html = formModel.HtmlForm; } else { ViewBag.Html = ExceHtmlJs(formId); } ViewBag.StepCheckMes = formContentBLL.GetCurrentStepCheckMes(ref setNoPagerAscById, formId, id, GetUserId()); //获取可审核步骤的人 List <Flow_FormContentStepCheckStateModel> stepCheckStateModel = stepCheckStateBLL.GetListByStepCheckId(ref setNoPagerAscById, currentStepId); //决定是否显示审核框 string currentUser = GetUserId(); if (stepCheckStateModel.Where(a => a.UserId == currentUser).Count() == 0) { ViewBag.StepCheckId = ""; } else { ViewBag.StepCheckId = currentStepId; } ViewBag.IsCustomMember = false; if (!string.IsNullOrEmpty(currentStepId)) { List <Flow_FormContentStepCheckModel> stepCheckModelList = stepCheckBLL.GetListByFormId(formId, id); int j = 0;//下一个步骤 for (int i = 0; i < stepCheckModelList.Count(); i++) { if (currentStepId == stepCheckModelList[i].Id) { j = i; } } //获得下个步骤 if (j + 1 < stepCheckModelList.Count()) { //查询第二步是否是自选 Flow_FormContentStepCheckModel stepModel = stepCheckModelList[j + 1]; if (stepModel.IsCustom) { ViewBag.IsCustomMember = true; } } } Flow_FormContentModel model = formContentBLL.GetById(id); return(View(model)); }
private string ExceHtmlJs(string id) { //定义一个sb为生成HTML表单 StringBuilder sbHtml = new StringBuilder(); StringBuilder sbJS = new StringBuilder(); sbJS.Append("<script type='text/javascript'>function CheckForm(){"); Flow_FormModel model = m_BLL.GetById(id); #region 判断流程是否有字段,有就生成HTML表单 Type formType = model.GetType(); //查找名称为"A-Z"的属性 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" }; sbHtml.AppendFormat("<div class='easyui-draggable' data-option='onDrag:onDrag'><table class='inputtable'><tr><td style='text-align:center'>{0}</td></tr></table></div>", model.Name); foreach (string str in arrStr) { object o = formType.GetProperty(str).GetValue(model, null); if (o != null) { //查找model类的Class对象的"str"属性的值 sbHtml.Append(GetHtml(o.ToString(), str, ref sbJS)); } } #endregion sbJS.Append("return true}</script>"); return(sbHtml.ToString() + sbJS.ToString()); }
public ActionResult Edit(string formId, string id) { Flow_FormModel formModel = formBLL.GetById(formId); //是否已经设置布局 if (!string.IsNullOrEmpty(formModel.HtmlForm)) { ViewBag.Html = formModel.HtmlForm; } else { ViewBag.Html = ExceHtmlJs(formId); } ViewBag.StepCheckMes = formContentBLL.GetCurrentStepCheckMes(ref setNoPagerAscById, formId, id, GetUserId()); Flow_FormContentModel model = formContentBLL.GetById(id); //Type formType = formModel.GetType(); //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(formModel, null); // if (o != null) // { // Flow_FormAttrModel attrModel = formAttrBLL.GetById(o.ToString()); // if (attrModel.AttrType == "人员弹出框") // { // } // } //} return(View(model)); }
public ActionResult CreateExternal(string id) { Flow_FormModel formModel = formBLL.GetById(id); //属于外部的页面,直接用于外部 ViewBag.Html = formModel.ExternalURL.Split(',')[0]; Flow_FormContentModel model = new Flow_FormContentModel(); model.FormId = id; //创建成功取出步骤 List <Flow_StepModel> stepModelList = stepBLL.GetList(ref setNoPagerAscById, model.FormId); Flow_StepModel stepModel = stepBLL.GetById(stepModelList[0].Id); if (stepModel.FlowRule == (int)FlowRuleEnum.Customer) { ViewBag.Checker = null; } else { List <string> users = GetStepCheckMemberList(stepModel.Id, id); ViewBag.Checker = users; } return(View(model)); }
public ActionResult Edit(string id) { ViewBag.Perm = GetPermission(); Flow_FormModel entity = m_BLL.GetById(id); return(View(entity)); }
public ActionResult Edit(string id) { ViewBag.Perm = GetPermission(); Flow_FormModel model = m_BLL.GetById(id); //得到已经选择的字段 StringBuilder sb = new StringBuilder(); //获得对象的类型,model Type formType = model.GetType(); //查找名称为"A-Z"的属性 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"属性的值 sb.Append(GetAttr(o.ToString(), str)); } } ViewBag.AttrList = sb.ToString(); List <Flow_TypeModel> list = typeBLL.GetList(ref setNoPagerAscBySort, ""); ViewBag.FlowType = new SelectList(list, "Id", "Name", model.TypeId); ViewBag.FlowTypeName = new SelectList(list, "Id", "Name"); return(View(model)); }
public ActionResult Create(string id) { Flow_FormModel formModel = formBLL.GetById(id); //是否已经设置布局 if (!string.IsNullOrEmpty(formModel.HtmlForm)) { ViewBag.Html = formModel.HtmlForm; } else { ViewBag.Html = ExceHtmlJs(id); } Flow_FormContentModel model = new Flow_FormContentModel(); model.FormId = id; //创建成功取出步骤 List <Flow_StepModel> stepModelList = stepBLL.GetList(ref setNoPagerAscById, model.FormId); Flow_StepModel stepModel = stepBLL.GetById(stepModelList[0].Id); if (stepModel.FlowRule == (int)FlowRuleEnum.Customer) { ViewBag.Checker = null; } else { List <string> users = GetStepCheckMemberList(stepModel.Id, id); ViewBag.Checker = users; } return(View(model)); }
//根据设定公文,生成表单及控制条件 private string ExceHtmlJs(string id) { //定义一个sb为生成HTML表单 StringBuilder sbHtml = new StringBuilder(); StringBuilder sbJS = new StringBuilder(); sbJS.Append("<script type='text/javascript'>function CheckForm(){"); Flow_FormModel model = formBLL.GetById(id); #region 判断流程是否有字段,有就生成HTML表单 Type formType = model.GetType(); //查找名称为"A-Z"的属性 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"属性的值 sbHtml.Append(GetHtml(o.ToString(), str, ref sbJS)); } } #endregion sbJS.Append("return true}</script>"); ViewBag.HtmlJS = sbJS.ToString(); return(sbHtml.ToString()); }
public ActionResult EditStep(string id) { ViewBag.Perm = GetPermission(); Flow_FormModel flowFormModel = m_BLL.GetById(id); GridPager setNoPagerDescBySort = new GridPager { sort = "Id", rows = 100, order = "desc", page = 1 }; List <Flow_StepModel> stepList = step_BLL.GetList(ref setNoPagerDescBySort, flowFormModel.Id); foreach (var r in stepList) { r.stepRuleList = GetStepRuleListByStepId(r.Id); } flowFormModel.stepList = stepList;//获取表单关联的步骤 ViewBag.Form = flowFormModel; Flow_StepModel model = new Flow_StepModel(); model.FormId = flowFormModel.Id; model.IsEditAttr = true; return(View(model)); }
public ActionResult EditExternal(string formId, string id) { //获得当前步骤ID string currentStepId = formContentBLL.GetCurrentStepCheckId(formId, id); Flow_FormModel formModel = formBLL.GetById(formId); ViewBag.Html = formModel.ExternalURL.Split(',')[2]; ViewBag.StepCheckMes = formContentBLL.GetCurrentStepCheckMes(ref setNoPagerAscById, formId, id, GetUserId()); //获取可审核步骤的人 List <Flow_FormContentStepCheckStateModel> stepCheckStateModel = stepCheckStateBLL.GetListByStepCheckId(ref setNoPagerAscById, currentStepId); //决定是否显示审核框 string currentUser = GetUserId(); if (stepCheckStateModel.Where(a => a.UserId == currentUser).Count() == 0) { ViewBag.StepCheckId = ""; } else { ViewBag.StepCheckId = currentStepId; } ViewBag.IsCustomMember = false; if (!string.IsNullOrEmpty(currentStepId)) { List <Flow_FormContentStepCheckModel> stepCheckModelList = stepCheckBLL.GetListByFormId(formId, id); int j = 0;//下一个步骤 for (int i = 0; i < stepCheckModelList.Count(); i++) { if (currentStepId == stepCheckModelList[i].Id) { j = i; } } //获得下个步骤 if (j + 1 < stepCheckModelList.Count()) { //查询第二步是否是自选 Flow_FormContentStepCheckModel stepModel = stepCheckModelList[j + 1]; if (stepModel.IsCustom) { ViewBag.IsCustomMember = true; } } } Flow_FormContentModel model = formContentBLL.GetById(id); model.ExternalURL = formModel.ExternalURL; //来自外部,所有情况都需要枚举,每加一个,这里加一句,必须的,与前端相互对应 if (formModel.ExternalURL.Contains("/External/")) { model.externalModel = externalBLL.GetById(id); } ////// return(View(model)); }
//获取对应的提交的值 public string GetFormAttrVal(string attrId, Flow_FormModel formModel, Flow_FormContentModel formContentModel) { //获得对象的类型,model Type formContentType = formContentModel.GetType(); Type formType = formModel.GetType(); //查找名称为"A-Z"的属性 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(formModel, null); object v = formContentType.GetProperty(str).GetValue(formContentModel, null); if (o != null) { //查找model类的Class对象的"str"属性的值 if (o.ToString() == attrId) { return(v.ToString()); } } } return(""); }
public virtual async Task <Flow_FormModel> GetByIdAsync(object id) { if (IsExists(id)) { Flow_Form entity = await m_Rep.GetByIdAsync(id); Flow_FormModel model = new Flow_FormModel(); model.Id = entity.Id; model.Name = entity.Name; model.Remark = entity.Remark; model.UsingDep = entity.UsingDep; model.TypeId = entity.TypeId; model.State = entity.State; model.CreateTime = entity.CreateTime; model.HtmlForm = entity.HtmlForm; model.IsExternal = entity.IsExternal; model.ExternalURL = entity.ExternalURL; model.AttrA = entity.AttrA; model.AttrB = entity.AttrB; model.AttrC = entity.AttrC; model.AttrD = entity.AttrD; model.AttrE = entity.AttrE; model.AttrF = entity.AttrF; model.AttrG = entity.AttrG; model.AttrH = entity.AttrH; model.AttrI = entity.AttrI; model.AttrJ = entity.AttrJ; model.AttrK = entity.AttrK; model.AttrL = entity.AttrL; model.AttrM = entity.AttrM; model.AttrN = entity.AttrN; model.AttrO = entity.AttrO; model.AttrP = entity.AttrP; model.AttrQ = entity.AttrQ; model.AttrR = entity.AttrR; model.AttrS = entity.AttrS; model.AttrT = entity.AttrT; model.AttrU = entity.AttrU; model.AttrV = entity.AttrV; model.AttrW = entity.AttrW; model.AttrX = entity.AttrX; model.AttrY = entity.AttrY; model.AttrZ = entity.AttrZ; return(model); } else { return(null); } }
public ActionResult Details(string id) { Flow_FormModel flowFormModel = formBLL.GetById(id); //获取现有的步骤 flowFormModel.stepList = new List <Flow_StepModel>(); flowFormModel.stepList = stepBLL.GetList(ref setNoPagerAscById, flowFormModel.Id); for (int i = 0; i < flowFormModel.stepList.Count; i++)//获取步骤下面的步骤规则 { flowFormModel.stepList[i].stepRuleList = new List <Flow_StepRuleModel>(); flowFormModel.stepList[i].stepRuleList = GetStepRuleListByStepId(flowFormModel.stepList[i].Id); } return(View(flowFormModel)); }
public Flow_FormModel GetById(string id) { if (IsExist(id)) { Flow_Form entity = m_Rep.GetById(id); Flow_FormModel model = new Flow_FormModel(); model.AttrA = entity.AttrA; model.AttrB = entity.AttrB; model.AttrC = entity.AttrC; model.AttrD = entity.AttrD; model.AttrE = entity.AttrE; model.AttrF = entity.AttrF; model.AttrG = entity.AttrG; model.AttrH = entity.AttrH; model.AttrI = entity.AttrI; model.AttrJ = entity.AttrJ; model.AttrK = entity.AttrK; model.AttrL = entity.AttrL; model.AttrM = entity.AttrM; model.AttrN = entity.AttrN; model.AttrO = entity.AttrO; model.AttrP = entity.AttrP; model.AttrQ = entity.AttrQ; model.AttrR = entity.AttrR; model.AttrS = entity.AttrS; model.AttrT = entity.AttrT; model.AttrU = entity.AttrU; model.AttrV = entity.AttrV; model.AttrW = entity.AttrW; model.AttrX = entity.AttrX; model.AttrY = entity.AttrY; model.AttrZ = entity.AttrZ; model.CreateTime = entity.CreateTime; model.HtmlForm = entity.HtmlForm; model.Id = entity.Id; model.Name = entity.Name; model.Remark = entity.Remark; model.State = entity.State; model.TypeId = entity.TypeId; model.UsingDep = entity.UsingDep; return(model); } else { return(null); } }
public ActionResult EditStep(string id) { Flow_FormModel flowFormModel = m_BLL.GetById(id); List <Flow_StepModel> stepList = stepBLL.GetList(ref setNoPagerAscById, flowFormModel.Id); //获得全部步骤 foreach (var r in stepList) //获取步骤下面的步骤规则 { r.stepRuleList = GetStepRuleListByStepId(r.Id); } flowFormModel.stepList = stepList;//获取表单关联的步骤 ViewBag.Form = flowFormModel; Flow_StepModel model = new Flow_StepModel(); model.FormId = flowFormModel.Id; model.IsEditAttr = true; return(View(model)); }
public JsonResult SaveLayout(string html, string formId) { Flow_FormModel model = m_BLL.GetById(formId); model.HtmlForm = html; if (m_BLL.Edit(ref errors, model)) { LogHandler.WriteServiceLog(GetUserId(), "Id:" + model.Id + ",Name:" + model.Name, "成功", "修改", "表单布局"); return(Json(JsonHandler.CreateMessage(1, Resource.EditSucceed))); } else { string ErrorCol = errors.Error; LogHandler.WriteServiceLog(GetUserId(), "Id:" + model.Id + ",Name:" + model.Name + "," + ErrorCol, "失败", "修改", "表单布局"); return(Json(JsonHandler.CreateMessage(0, Resource.EditFail + ":" + ErrorCol))); } }
public ActionResult Edit(string formId, string id) { Flow_FormModel formModel = formBLL.GetById(formId); //是否已经设置布局 if (!string.IsNullOrEmpty(formModel.HtmlForm)) { ViewBag.Html = formModel.HtmlForm; } else { ViewBag.Html = ExceHtmlJs(formId); } ViewBag.StepCheckMes = formContentBLL.GetCurrentStepCheckMes(ref setNoPagerAscById, formId, id, GetUserId()); Flow_FormContentModel model = formContentBLL.GetById(id); return(View(model)); }
public ActionResult EditExternal(string formId, string id) { Flow_FormModel formModel = formBLL.GetById(formId); //是否已经设置布局获得详细页面 ViewBag.Html = formModel.ExternalURL.Split(',')[2]; ViewBag.StepCheckMes = formContentBLL.GetCurrentStepCheckMes(ref setNoPagerAscById, formId, id, GetUserId()); Flow_FormContentModel model = formContentBLL.GetById(id); model.ExternalURL = formModel.ExternalURL; //来自外部,所有情况都需要枚举,每加一个,这里加一句,必须的,与前端相互对应 if (formModel.ExternalURL.Contains("/External/")) { model.externalModel = externalBLL.GetById(id); } ////// return(View(model)); }
public ActionResult Details(string id, string contentId) { Flow_FormModel flowFormModel = formBLL.GetById(id); Flow_FormContentModel centent = formContentBLL.GetById(contentId); string currentStepName = formContentBLL.GetCurrentFormStep(centent); flowFormModel.stepList = new List <Flow_StepModel>(); flowFormModel.stepList = stepBLL.GetList(ref setNoPagerAscById, flowFormModel.Id); for (int i = 0; i < flowFormModel.stepList.Count; i++)//获取步骤下面的步骤规则 { flowFormModel.stepList[i].stepRuleList = new List <Flow_StepRuleModel>(); flowFormModel.stepList[i].stepRuleList = GetStepRuleListByStepId(flowFormModel.stepList[i].Id); if (flowFormModel.stepList[i].Name == currentStepName) { flowFormModel.stepList[i].Name = "<span class='label label-green'>" + flowFormModel.stepList[i].Name + "</span>"; } } return(View(flowFormModel)); }
public ActionResult StepRuleList(string stepId, string formId) { //获取现有的步骤 GridPager pager = new GridPager() { rows = 100, order = "desc", sort = "Id", page = 1 }; Flow_FormModel flowFormModel = m_BLL.GetById(formId); List <Flow_FormAttrModel> attrList = new List <Flow_FormAttrModel>();//获取表单关联的字段 attrList = GetAttrList(flowFormModel); List <Flow_StepModel> stepList = step_BLL.GetList(ref pager, formId); ViewBag.StepId = stepId; ViewBag.AttrList = attrList; ViewBag.StepList = stepList; return(View()); }
public JsonResult Edit(Flow_FormModel model) { if (model != null && ModelState.IsValid) { if (m_BLL.Edit(ref errors, model)) { LogHandler.WriteServiceLog(GetUserId(), "Id" + model.Id + ",Name" + model.Name, "成功", "修改", "Flow_Form"); return(Json(JsonHandler.CreateMessage(1, Resource.EditSucceed))); } else { string ErrorCol = errors.Error; LogHandler.WriteServiceLog(GetUserId(), "Id" + model.Id + ",Name" + model.Name + "," + ErrorCol, "失败", "修改", "Flow_Form"); return(Json(JsonHandler.CreateMessage(0, Resource.EditFail + ":" + ErrorCol))); } } else { return(Json(JsonHandler.CreateMessage(0, Resource.EditFail))); } }
//根据设定公文,生成表单及控制条件 private string ExceHtmlJs(string id) { //定义一个sb为生成HTML表单 StringBuilder sbHtml = new StringBuilder(); StringBuilder sbJS = new StringBuilder(); sbJS.Append("<script type='text/javascript'>function CheckForm(){"); Flow_FormModel model = formBLL.GetById(id); #region 判断流程是否有字段,有就生成HTML表单 sbHtml.Append(JuageExc(model.AttrA, "A", ref sbJS)); sbHtml.Append(JuageExc(model.AttrB, "B", ref sbJS)); sbHtml.Append(JuageExc(model.AttrC, "C", ref sbJS)); sbHtml.Append(JuageExc(model.AttrD, "D", ref sbJS)); sbHtml.Append(JuageExc(model.AttrE, "E", ref sbJS)); sbHtml.Append(JuageExc(model.AttrF, "F", ref sbJS)); sbHtml.Append(JuageExc(model.AttrG, "G", ref sbJS)); sbHtml.Append(JuageExc(model.AttrH, "H", ref sbJS)); sbHtml.Append(JuageExc(model.AttrI, "I", ref sbJS)); sbHtml.Append(JuageExc(model.AttrJ, "J", ref sbJS)); sbHtml.Append(JuageExc(model.AttrK, "K", ref sbJS)); sbHtml.Append(JuageExc(model.AttrL, "L", ref sbJS)); sbHtml.Append(JuageExc(model.AttrM, "M", ref sbJS)); sbHtml.Append(JuageExc(model.AttrN, "N", ref sbJS)); sbHtml.Append(JuageExc(model.AttrO, "O", ref sbJS)); sbHtml.Append(JuageExc(model.AttrP, "P", ref sbJS)); sbHtml.Append(JuageExc(model.AttrQ, "Q", ref sbJS)); sbHtml.Append(JuageExc(model.AttrR, "R", ref sbJS)); sbHtml.Append(JuageExc(model.AttrS, "S", ref sbJS)); sbHtml.Append(JuageExc(model.AttrT, "T", ref sbJS)); sbHtml.Append(JuageExc(model.AttrU, "U", ref sbJS)); sbHtml.Append(JuageExc(model.AttrV, "V", ref sbJS)); sbHtml.Append(JuageExc(model.AttrW, "W", ref sbJS)); sbHtml.Append(JuageExc(model.AttrX, "X", ref sbJS)); sbHtml.Append(JuageExc(model.AttrY, "Y", ref sbJS)); sbHtml.Append(JuageExc(model.AttrZ, "Z", ref sbJS)); #endregion sbJS.Append("return true}</script>"); return(sbJS.ToString() + sbHtml.ToString()); }
public ActionResult Details(string id) { Flow_FormModel flowFormModel = formBLL.GetById(id); //获取现有的步骤 GridPager pager = new GridPager() { rows = 1000, page = 1, sort = "Id", order = "asc" }; flowFormModel.stepList = new List <Flow_StepModel>(); flowFormModel.stepList = stepBLL.GetList(ref pager, flowFormModel.Id); for (int i = 0; i < flowFormModel.stepList.Count; i++)//获取步骤下面的步骤规则 { flowFormModel.stepList[i].stepRuleList = new List <Flow_StepRuleModel>(); flowFormModel.stepList[i].stepRuleList = GetStepRuleListByStepId(flowFormModel.stepList[i].Id); } return(View(flowFormModel)); }
public JsonResult Create(Flow_FormModel model) { model.Id = ResultHelper.NewId; model.CreateTime = ResultHelper.NowTime; if (model != null && ModelState.IsValid) { if (m_BLL.Create(ref errors, model)) { LogHandler.WriteServiceLog(GetUserId(), "Id" + model.Id + ",Name" + model.Name, "成功", "创建", "Flow_Form"); return(Json(JsonHandler.CreateMessage(1, Resource.InsertSucceed))); } else { string ErrorCol = errors.Error; LogHandler.WriteServiceLog(GetUserId(), "Id" + model.Id + ",Name" + model.Name + "," + ErrorCol, "失败", "创建", "Flow_Form"); return(Json(JsonHandler.CreateMessage(0, Resource.InsertFail + ErrorCol))); } } else { return(Json(JsonHandler.CreateMessage(0, Resource.InsertFail))); } }
public ActionResult FormLayout(string id) { if (string.IsNullOrEmpty(id)) { return(View()); } Flow_FormModel formModel = m_BLL.GetById(id); //是否已经设置布局 if (!string.IsNullOrEmpty(formModel.HtmlForm)) { ViewBag.Html = formModel.HtmlForm; } else { ViewBag.Html = ExceHtmlJs(id); } ViewBag.FormId = id; ViewBag.Perm = GetPermission(); return(View()); }
public JsonResult Create(Flow_FormContentModel model) { //当前的Form模版 Flow_FormModel formModel = formBLL.GetById(model.FormId); //初始化部分数据 model.Id = ResultHelper.NewId; model.CreateTime = ResultHelper.NowTime; model.UserId = GetUserId(); model.Title = formModel.Name; model.TimeOut = DateTime.Now.AddDays(30); if (model != null && ModelState.IsValid) { //内容提交数据库 if (formContentBLL.Create(ref errors, model)) { try { List <Flow_StepModel> stepModelList = stepBLL.GetList(ref setNoPagerAscBySort, model.FormId); //查询步骤 int listCount = stepModelList.Count(); bool IsEnd = false; //循环表单的所有步骤 for (int i = 0; i < listCount; i++) { string nextStep = ""; Flow_StepModel stepModel = stepModelList[i]; //获得步骤对应的规则 List <Flow_StepRuleModel> stepRuleModelList = stepRuleBLL.GetList(stepModel.Id); //获取规则判断流转方向 foreach (Flow_StepRuleModel stepRuleModel in stepRuleModelList) { //获取需要判断的数值,比如请假天数 string val = new FlowHelper().GetFormAttrVal(stepRuleModel.AttrId, formModel, model); //有满足流程结束的条件,判断请假天数是否处于这个规则内 if (!JudgeVal(stepRuleModel.AttrId, val, stepRuleModel.Operator, stepRuleModel.Result)) { //如果符合规则,判断是否还有下一步 if (stepRuleModel.NextStep != "0") { //跳转后的下一步 for (int j = 0; j < listCount; j++) { //看看当前步骤是哪一步 if (stepModelList[j].Id == nextStep) { i = j;//跳到分支后的下一步,从这一步开始循环 continue; } } } else { IsEnd = true; continue; } } } #region 插入步骤 //插入步骤审核表 Flow_FormContentStepCheckModel stepCheckModel = new Flow_FormContentStepCheckModel(); stepCheckModel.Id = ResultHelper.NewId; stepCheckModel.ContentId = model.Id; stepCheckModel.StepId = stepModel.Id; stepCheckModel.State = (int)FlowStateEnum.Progress; stepCheckModel.StateFlag = false;//true此步骤审核完成 stepCheckModel.CreateTime = ResultHelper.NowTime; stepCheckModel.IsEnd = IsEnd; stepCheckModel.IsCustom = stepModel.FlowRule == (int)FlowRuleEnum.Customer ? true : false; if (stepCheckBLL.Create(ref errors, stepCheckModel))//新建步骤成功 { InsertChecker(model, i, stepModel, stepCheckModel); } if (IsEnd)//如果是最后一步就无需要下面继续了 { break; } #endregion } LogHandler.WriteServiceLog(GetUserId(), "Id" + model.Id + ",AttrA" + model.AttrA, "成功", "创建", "Flow_FormContent"); return(Json(JsonHandler.CreateMessage(1, Resource.InsertSucceed))); } catch (Exception ex) { //创建失败,删除表单 formContentBLL.Delete(ref errors, model.Id); return(Json(JsonHandler.CreateMessage(0, Resource.InsertFail + "流程发生异常,请联系管理员"))); } } else { string ErrorCol = errors.Error; LogHandler.WriteServiceLog(GetUserId(), "Id" + model.Id + ",AttrA" + model.AttrA + "," + ErrorCol, "失败", "创建", "Flow_FormContent"); return(Json(JsonHandler.CreateMessage(0, Resource.InsertFail + ErrorCol))); } } else { return(Json(JsonHandler.CreateMessage(0, Resource.InsertFail))); } }
public JsonResult Create(Flow_FormContentModel model) { model.Id = ResultHelper.NewId; model.CreateTime = ResultHelper.NowTime; model.UserId = GetUserId(); if (model != null && ModelState.IsValid) { if (formContentBLL.Create(ref errors, model)) { //当前的Form模版 Flow_FormModel formModel = formBLL.GetById(model.FormId); //创建成功后把步骤取出 List <Flow_StepModel> stepModelList = stepBLL.GetList(ref setNoPagerAscBySort, model.FormId); //查询步骤 bool IsEnd = false; foreach (Flow_StepModel stepModel in stepModelList) { List <Flow_StepRuleModel> stepRuleModelList = stepRuleBLL.GetList(stepModel.Id); //获取规则判断流转方向 foreach (Flow_StepRuleModel stepRuleModel in stepRuleModelList) { string val = new FlowHelper().GetFormAttrVal(stepRuleModel.AttrId, formModel, model); //有满足不流程结束的条件 if (!JudgeVal(stepRuleModel.AttrId, val, stepRuleModel.Operator, stepRuleModel.Result)) { if (stepRuleModel.NextStep != "0") { IsEnd = false; } } } //插入步骤审核表 Flow_FormContentStepCheckModel stepCheckModel = new Flow_FormContentStepCheckModel(); stepCheckModel.Id = ResultHelper.NewId; stepCheckModel.ContentId = model.Id; stepCheckModel.StepId = stepModel.Id; stepCheckModel.State = 2; //0不通过1通过2审核中 stepCheckModel.StateFlag = false; //true此步骤审核完成 stepCheckModel.CreateTime = ResultHelper.NowTime; stepCheckModel.IsEnd = IsEnd; //是否流程的最后一步 if (formContentStepCheckBLL.Create(ref errors, stepCheckModel)) //新建步骤成功 { //获得流转规则下的审核人员 List <string> userIdList = GetStepCheckMemberList(stepModel.Id, model.Id); if (userIdList.Count > 0) { foreach (string userId in userIdList) { //批量建立步骤审核人表 Flow_FormContentStepCheckStateModel stepCheckStateModel = new Flow_FormContentStepCheckStateModel(); stepCheckStateModel.Id = ResultHelper.NewId; stepCheckStateModel.StepCheckId = stepCheckModel.Id; stepCheckStateModel.UserId = userId; stepCheckStateModel.CheckFlag = 2; stepCheckStateModel.Reamrk = ""; stepCheckStateModel.TheSeal = ""; stepCheckStateModel.CreateTime = ResultHelper.NowTime; stepCheckStateBLL.Create(ref errors, stepCheckStateModel); } } } if (IsEnd)//如果是最后一步就无需要下面继续了 { break; } IsEnd = true; } LogHandler.WriteServiceLog(GetUserId(), "Id" + model.Id + ",AttrA" + model.AttrA, "成功", "创建", "Flow_FormContent"); return(Json(JsonHandler.CreateMessage(1, Suggestion.InsertSucceed))); } else { string ErrorCol = errors.Error; LogHandler.WriteServiceLog(GetUserId(), "Id" + model.Id + ",AttrA" + model.AttrA + "," + ErrorCol, "失败", "创建", "Flow_FormContent"); return(Json(JsonHandler.CreateMessage(0, Suggestion.InsertFail + ErrorCol))); } } else { return(Json(JsonHandler.CreateMessage(0, Suggestion.InsertFail))); } }
/// <summary> /// 校验Excel数据,这个方法一般用于重写校验逻辑 /// </summary> public virtual bool CheckImportData(string fileName, List <Flow_FormModel> list, ref ValidationErrors errors) { var targetFile = new FileInfo(fileName); if (!targetFile.Exists) { errors.Add("导入的数据文件不存在"); return(false); } var excelFile = new ExcelQueryFactory(fileName); //对应列头 excelFile.AddMapping <Flow_FormModel>(x => x.Name, "Name"); excelFile.AddMapping <Flow_FormModel>(x => x.Remark, "Remark"); excelFile.AddMapping <Flow_FormModel>(x => x.UsingDep, "UsingDep"); excelFile.AddMapping <Flow_FormModel>(x => x.TypeId, "TypeId"); excelFile.AddMapping <Flow_FormModel>(x => x.State, "State"); excelFile.AddMapping <Flow_FormModel>(x => x.CreateTime, "CreateTime"); excelFile.AddMapping <Flow_FormModel>(x => x.HtmlForm, "HtmlForm"); excelFile.AddMapping <Flow_FormModel>(x => x.IsExternal, "IsExternal"); excelFile.AddMapping <Flow_FormModel>(x => x.ExternalURL, "ExternalURL"); excelFile.AddMapping <Flow_FormModel>(x => x.AttrA, "AttrA"); excelFile.AddMapping <Flow_FormModel>(x => x.AttrB, "AttrB"); excelFile.AddMapping <Flow_FormModel>(x => x.AttrC, "AttrC"); excelFile.AddMapping <Flow_FormModel>(x => x.AttrD, "AttrD"); excelFile.AddMapping <Flow_FormModel>(x => x.AttrE, "AttrE"); excelFile.AddMapping <Flow_FormModel>(x => x.AttrF, "AttrF"); excelFile.AddMapping <Flow_FormModel>(x => x.AttrG, "AttrG"); excelFile.AddMapping <Flow_FormModel>(x => x.AttrH, "AttrH"); excelFile.AddMapping <Flow_FormModel>(x => x.AttrI, "AttrI"); excelFile.AddMapping <Flow_FormModel>(x => x.AttrJ, "AttrJ"); excelFile.AddMapping <Flow_FormModel>(x => x.AttrK, "AttrK"); excelFile.AddMapping <Flow_FormModel>(x => x.AttrL, "AttrL"); excelFile.AddMapping <Flow_FormModel>(x => x.AttrM, "AttrM"); excelFile.AddMapping <Flow_FormModel>(x => x.AttrN, "AttrN"); excelFile.AddMapping <Flow_FormModel>(x => x.AttrO, "AttrO"); excelFile.AddMapping <Flow_FormModel>(x => x.AttrP, "AttrP"); excelFile.AddMapping <Flow_FormModel>(x => x.AttrQ, "AttrQ"); excelFile.AddMapping <Flow_FormModel>(x => x.AttrR, "AttrR"); excelFile.AddMapping <Flow_FormModel>(x => x.AttrS, "AttrS"); excelFile.AddMapping <Flow_FormModel>(x => x.AttrT, "AttrT"); excelFile.AddMapping <Flow_FormModel>(x => x.AttrU, "AttrU"); excelFile.AddMapping <Flow_FormModel>(x => x.AttrV, "AttrV"); excelFile.AddMapping <Flow_FormModel>(x => x.AttrW, "AttrW"); excelFile.AddMapping <Flow_FormModel>(x => x.AttrX, "AttrX"); excelFile.AddMapping <Flow_FormModel>(x => x.AttrY, "AttrY"); excelFile.AddMapping <Flow_FormModel>(x => x.AttrZ, "AttrZ"); //SheetName var excelContent = excelFile.Worksheet <Flow_FormModel>(0); int rowIndex = 1; //检查数据正确性 foreach (var row in excelContent) { var errorMessage = new StringBuilder(); var entity = new Flow_FormModel(); entity.Id = row.Id; entity.Name = row.Name; entity.Remark = row.Remark; entity.UsingDep = row.UsingDep; entity.TypeId = row.TypeId; entity.State = row.State; entity.CreateTime = row.CreateTime; entity.HtmlForm = row.HtmlForm; entity.IsExternal = row.IsExternal; entity.ExternalURL = row.ExternalURL; entity.AttrA = row.AttrA; entity.AttrB = row.AttrB; entity.AttrC = row.AttrC; entity.AttrD = row.AttrD; entity.AttrE = row.AttrE; entity.AttrF = row.AttrF; entity.AttrG = row.AttrG; entity.AttrH = row.AttrH; entity.AttrI = row.AttrI; entity.AttrJ = row.AttrJ; entity.AttrK = row.AttrK; entity.AttrL = row.AttrL; entity.AttrM = row.AttrM; entity.AttrN = row.AttrN; entity.AttrO = row.AttrO; entity.AttrP = row.AttrP; entity.AttrQ = row.AttrQ; entity.AttrR = row.AttrR; entity.AttrS = row.AttrS; entity.AttrT = row.AttrT; entity.AttrU = row.AttrU; entity.AttrV = row.AttrV; entity.AttrW = row.AttrW; entity.AttrX = row.AttrX; entity.AttrY = row.AttrY; entity.AttrZ = row.AttrZ; //============================================================================= if (errorMessage.Length > 0) { errors.Add(string.Format( "第 {0} 列发现错误:{1}{2}", rowIndex, errorMessage, "<br/>")); } list.Add(entity); rowIndex += 1; } if (errors.Count > 0) { return(false); } return(true); }
public virtual async Task <Tuple <ValidationErrors, bool> > EditAsync(Flow_FormModel model) { ValidationErrors errors = new ValidationErrors(); try { Flow_Form entity = await m_Rep.GetByIdAsync(model.Id); if (entity == null) { errors.Add(Resource.Disable); return(new Tuple <ValidationErrors, bool>(errors, false)); } entity.Id = model.Id; entity.Name = model.Name; entity.Remark = model.Remark; entity.UsingDep = model.UsingDep; entity.TypeId = model.TypeId; entity.State = model.State; entity.CreateTime = model.CreateTime; entity.HtmlForm = model.HtmlForm; entity.IsExternal = model.IsExternal; entity.ExternalURL = model.ExternalURL; entity.AttrA = model.AttrA; entity.AttrB = model.AttrB; entity.AttrC = model.AttrC; entity.AttrD = model.AttrD; entity.AttrE = model.AttrE; entity.AttrF = model.AttrF; entity.AttrG = model.AttrG; entity.AttrH = model.AttrH; entity.AttrI = model.AttrI; entity.AttrJ = model.AttrJ; entity.AttrK = model.AttrK; entity.AttrL = model.AttrL; entity.AttrM = model.AttrM; entity.AttrN = model.AttrN; entity.AttrO = model.AttrO; entity.AttrP = model.AttrP; entity.AttrQ = model.AttrQ; entity.AttrR = model.AttrR; entity.AttrS = model.AttrS; entity.AttrT = model.AttrT; entity.AttrU = model.AttrU; entity.AttrV = model.AttrV; entity.AttrW = model.AttrW; entity.AttrX = model.AttrX; entity.AttrY = model.AttrY; entity.AttrZ = model.AttrZ; if (await m_Rep.EditAsync(entity)) { return(new Tuple <ValidationErrors, bool>(errors, true)); } else { errors.Add(Resource.NoDataChange); return(new Tuple <ValidationErrors, bool>(errors, false)); } } catch (Exception ex) { errors.Add(ex.Message); ExceptionHander.WriteException(ex); return(new Tuple <ValidationErrors, bool>(errors, false)); } }