//[SupportFilter] public ActionResult Edit(string id) { Flow_Form model = m_BLL.m_Rep.Find(Convert.ToInt32(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_Type> list = typeBLL.m_Rep.FindPageList(ref setNoPagerAscBySort, "").ToList(); ViewBag.FlowType = new SelectList(list, "Id", "Name", model.TypeId); ViewBag.FlowTypeName = new SelectList(list, "Id", "Name"); return(View(model)); }
//[SupportFilter] public ActionResult Create(string id) { Flow_Form formModel = formBLL.m_Rep.Find(Convert.ToInt32(id)); //是否已经设置布局 if (!string.IsNullOrEmpty(formModel.HtmlForm)) { ViewBag.Html = formModel.HtmlForm; } else { ViewBag.Html = ExceHtmlJs(id); } Flow_FormContent model = new Flow_FormContent(); model.FormId = id; //创建成功取出步骤 List <Flow_Step> stepModelList = stepBLL.m_Rep.FindPageList(ref setNoPagerAscById, a => a.FormId == model.FormId).ToList(); Flow_Step stepModel = stepBLL.m_Rep.Find(Convert.ToInt32(stepModelList[0].Id)); if (stepModel.FlowRule == FlowRuleEnum.Customer.ToString()) { ViewBag.Checker = null; } else { List <string> users = GetStepCheckMemberList(stepModel.Id, Convert.ToInt32(id)); ViewBag.Checker = users; } return(View(model)); }
//获取已经添加的字段 private List <Flow_FormAttr> GetAttrList(Flow_Form model) { List <Flow_FormAttr> list = new List <Flow_FormAttr>(); Flow_FormAttr attrModel = new Flow_FormAttr(); #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.m_Rep.Find(Convert.ToInt32(o)); list.Add(attrModel); } } #endregion return(list); }
private string ExceHtmlJs(string id) { //定义一个sb为生成HTML表单 StringBuilder sbHtml = new StringBuilder(); StringBuilder sbJS = new StringBuilder(); sbJS.Append("<script type='text/javascript'>function CheckForm(){"); Flow_Form model = m_BLL.m_Rep.Find(Convert.ToInt32(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 string GetFormAttrVal(string attrId, Flow_Form formModel, Flow_FormContent 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(""); }
//根据设定公文,生成表单及控制条件 private string ExceHtmlJs(string id) { //定义一个sb为生成HTML表单 StringBuilder sbHtml = new StringBuilder(); StringBuilder sbJS = new StringBuilder(); sbJS.Append("<script type='text/javascript'>function CheckForm(){"); Flow_Form model = formBLL.m_Rep.Find(Convert.ToInt32(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 int Create(Flow_Form entity) { using (AppsDBEntities db = new AppsDBEntities()) { db.Flow_Form.Add(entity); return(db.SaveChanges()); } }
public int Edit(Flow_Form entity) { using (DBContainer db = new DBContainer()) { db.Entry(entity).State = System.Data.Entity.EntityState.Modified; return(db.SaveChanges()); } }
public int Create(Flow_Form entity) { using (DBContainer db = new DBContainer()) { db.Flow_Form.Add(entity); return(db.SaveChanges()); } }
/// <summary> /// 保存数据 /// </summary> public virtual void SaveImportData(IEnumerable <Flow_FormModel> list) { try { using (DBContainer db = new DBContainer()) { foreach (var model in list) { Flow_Form entity = new Flow_Form(); entity.Id = ResultHelper.NewId; entity.Name = model.Name; entity.Remark = model.Remark; entity.UsingDep = model.UsingDep; entity.TypeId = model.TypeId; entity.State = model.State; entity.CreateTime = ResultHelper.NowTime; 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; db.Flow_Form.Add(entity); } db.SaveChanges(); } } catch (Exception ex) { throw; } }
public int Edit(Flow_Form entity) { using (AppsDBEntities db = new AppsDBEntities()) { db.Flow_Form.Attach(entity); db.Entry <Flow_Form>(entity).State = EntityState.Modified; //db.ObjectStateManager.ChangeObjectState(entity, EntityState.Modified); return(db.SaveChanges()); } }
public bool IsExist(string id) { using (AppsDBEntities db = new AppsDBEntities()) { Flow_Form entity = GetById(id); if (entity != null) { return(true); } return(false); } }
public int Delete(string id) { using (DBContainer db = new DBContainer()) { Flow_Form entity = db.Flow_Form.SingleOrDefault(o => o.Id == id); if (entity != null) { db.Flow_Form.Remove(entity); } return(db.SaveChanges()); } }
public int Delete(string id) { using (AppsDBEntities db = new AppsDBEntities()) { Flow_Form entity = db.Flow_Form.SingleOrDefault(a => a.Id == id); if (entity != null) { db.Flow_Form.Remove(entity); } return(db.SaveChanges()); } }
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); } }
//[SupportFilter(ActionName = "Edit")] public ActionResult Details(string id) { Flow_Form flowFormModel = formBLL.m_Rep.Find(Convert.ToInt32(id)); //获取现有的步骤 flowFormModel.stepList = new List <Flow_Step>(); flowFormModel.stepList = stepBLL.m_Rep.FindPageList(ref setNoPagerAscById, a => a.FormId == flowFormModel.Id.ToString()).ToList(); for (int i = 0; i < flowFormModel.stepList.Count; i++)//获取步骤下面的步骤规则 { flowFormModel.stepList[i].stepRuleList = new List <Flow_StepRule>(); flowFormModel.stepList[i].stepRuleList = stepRuleBLL.m_Rep.FindList(a => a.StepId == flowFormModel.stepList[i].Id.ToString()).ToList(); } 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); } }
//[SupportFilter] public ActionResult Edit(string formId, string id) { //获得当前步骤ID string currentStepId = formContentBLL.GetCurrentStepCheckId(formId, id); Flow_Form formModel = formBLL.m_Rep.Find(Convert.ToInt32(formId)); //是否已经设置布局 if (!string.IsNullOrEmpty(formModel.HtmlForm)) { ViewBag.Html = formModel.HtmlForm; } else { ViewBag.Html = ExceHtmlJs(formId); } ViewBag.StepCheckMes = formContentBLL.GetCurrentStepCheckMes(ref setNoPagerAscById, formId, id, GetUserId()); ViewBag.StepCheckId = currentStepId; ViewBag.IsCustomMember = false; if (!string.IsNullOrEmpty(currentStepId)) { List <Flow_FormContentStepCheck> stepCheckModelList = stepCheckBLL.GetListByFormId(formId, id).ToList(); int j = 0;//下一个步骤 for (int i = 0; i < stepCheckModelList.Count(); i++) { if (currentStepId == stepCheckModelList[i].Id.ToString()) { j = i; } } //获得下个步骤 if (j + 1 < stepCheckModelList.Count()) { //查询第二步是否是自选 Flow_FormContentStepCheck stepModel = stepCheckModelList[j + 1]; if (stepModel.IsCustom == "true") { ViewBag.IsCustomMember = true; } } } Flow_FormContent model = formContentBLL.m_Rep.Find(Convert.ToInt32(id)); return(View(model)); }
//[SupportFilter(ActionName = "Edit")] public ActionResult EditStep(string id) { Flow_Form flowFormModel = m_BLL.m_Rep.Find(Convert.ToInt32(id)); List <Flow_Step> stepList = stepBLL.m_Rep.FindPageList(ref setNoPagerAscById, a => a.FormId == flowFormModel.Id.ToString()).ToList(); //获得全部步骤 foreach (var r in stepList) //获取步骤下面的步骤规则 { r.stepRuleList = GetStepRuleListByStepId(r.Id.ToString()); } flowFormModel.stepList = stepList;//获取表单关联的步骤 ViewBag.Form = flowFormModel; Flow_Step model = new Flow_Step(); model.FormId = flowFormModel.Id.ToString(); model.IsEditAttr = "true"; return(View(model)); }
public JsonResult SaveLayout(string html, string formId) { Flow_Form model = m_BLL.m_Rep.Find(Convert.ToInt32(formId)); model.HtmlForm = html; if (m_BLL.m_Rep.Update(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))); } }
//[SupportFilter(ActionName = "Index")] public ActionResult Edit(string formId, string id) { Flow_Form formModel = formBLL.m_Rep.Find(Convert.ToInt32(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_FormContent model = formContentBLL.m_Rep.Find(Convert.ToInt32(id)); return(View(model)); }
//[SupportFilter] public JsonResult Edit(Flow_Form model) { if (model != null) { if (m_BLL.m_Rep.Update(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_Form model = formBLL.m_Rep.Find(Convert.ToInt32(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()); }
//[SupportFilter] public JsonResult Create(Flow_Form model) { model.CreateTime = ResultHelper.NowTime.ToString("yyyy-MM-dd"); if (model != null) { if (m_BLL.m_Rep.Create(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))); } }
//[SupportFilter(ActionName = "Edit")] public ActionResult StepRuleList(string stepId, string formId) { //获取现有的步骤 GridPager pager = new GridPager() { rows = 1000, page = 1, sort = "Id", order = "desc" }; Flow_Form flowFormModel = m_BLL.m_Rep.Find(Convert.ToInt32(formId)); List <Flow_FormAttr> attrList = new List <Flow_FormAttr>();//获取表单关联的字段 attrList = GetAttrList(flowFormModel); List <Flow_Step> stepList = stepBLL.m_Rep.FindPageList(ref pager, a => a.FormId == formId).ToList(); ViewBag.StepId = stepId; ViewBag.AttrList = attrList; ViewBag.StepList = stepList; return(View()); }
//[SupportFilter(ActionName = "Edit")] public ActionResult Details(string id) { Flow_Form flowFormModel = m_BLL.m_Rep.Find(Convert.ToInt32(id)); //获取现有的步骤 GridPager pager = new GridPager() { rows = 1000, page = 1, sort = "Id", order = "asc" }; flowFormModel.stepList = new List <Flow_Step>(); flowFormModel.stepList = stepBLL.m_Rep.FindPageList(ref pager, a => a.FormId == flowFormModel.Id.ToString()).ToList(); for (int i = 0; i < flowFormModel.stepList.Count; i++)//获取步骤下面的步骤规则 { flowFormModel.stepList[i].stepRuleList = new List <Flow_StepRule>(); flowFormModel.stepList[i].stepRuleList = GetStepRuleListByStepId(flowFormModel.stepList[i].Id.ToString()); } return(View(flowFormModel)); }
//[SupportFilter(ActionName = "Edit")] public ActionResult FormLayout(string id) { if (string.IsNullOrEmpty(id)) { return(View()); } Flow_Form formModel = m_BLL.m_Rep.Find(Convert.ToInt32(id)); //是否已经设置布局 if (!string.IsNullOrEmpty(formModel.HtmlForm)) { ViewBag.Html = formModel.HtmlForm; } else { ViewBag.Html = ExceHtmlJs(id); } ViewBag.FormId = id; return(View()); }
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)); } }
public virtual bool Create(ref ValidationErrors errors, Flow_FormModel model) { try { Flow_Form entity = m_Rep.GetById(model.Id); if (entity != null) { errors.Add(Resource.PrimaryRepeat); return(false); } entity = new Flow_Form(); 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 (m_Rep.Create(entity)) { return(true); } else { errors.Add(Resource.InsertFail); return(false); } } catch (Exception ex) { errors.Add(ex.Message); ExceptionHander.WriteException(ex); return(false); } }
public bool Edit(ref ValidationErrors errors, Flow_FormModel model) { try { Flow_Form entity = m_Rep.GetById(model.Id); if (entity == null) { errors.Add(Suggestion.Disable); return(false); } 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; entity.CreateTime = model.CreateTime; entity.HtmlForm = model.HtmlForm; entity.Id = model.Id; entity.Name = model.Name; entity.Remark = model.Remark; entity.State = model.State; entity.TypeId = model.TypeId; entity.UsingDep = model.UsingDep; if (m_Rep.Edit(entity) == 1) { return(true); } else { errors.Add(Suggestion.EditFail); return(false); } } catch (Exception ex) { errors.Add(ex.Message); ExceptionHander.WriteException(ex); return(false); } }