private ActionResult query(string title1, string address) { string pager; string appid = Request.QueryString["appid"]; string tabid = Request.QueryString["tabid"]; string typeid = Request.QueryString["typeid"]; Next.WorkFlow.BLL.DictBLL bdict = new Next.WorkFlow.BLL.DictBLL(); Next.WorkFlow.BLL.AppLibraryBLL bapp = new Next.WorkFlow.BLL.AppLibraryBLL(); string typeidstring = typeid.IsGuid() ? bapp.GetAllChildsIDString(typeid.ToGuid()) : ""; string query = string.Format("&appid={0}&tabid={1}&title1={2}&typeid={3}&address={4}", Request.QueryString["appid"], Request.QueryString["tabid"], title1.UrlEncode(), typeid, address.UrlEncode() ); string query1 = string.Format("{0}&pagesize={1}&pagenumber={2}", query, Request.QueryString["pagesize"], Request.QueryString["pagenumber"]); List <AppLibrary> appList = bapp.GetPagerData(out pager, query, title1, typeidstring, address); ViewBag.Pager = pager; ViewBag.AppID = appid; ViewBag.TabID = tabid; ViewBag.TypeID = typeid; ViewBag.Title1 = title1; ViewBag.Address = address; ViewBag.Query1 = query1; return(View(appList)); }
public ActionResult Body(FormCollection collection) { Next.WorkFlow.BLL.DictBLL bdict = new Next.WorkFlow.BLL.DictBLL(); Dict dict = null; string id = Request.QueryString["id"]; if (id.IsGuid()) { dict = bdict.FindByID(id.ToGuid()); } if (dict == null) { dict = bdict.GetRoot(); } if (collection != null) { string refreshID = dict.ParentID == Guid.Empty.ToString() ? dict.ID.ToString() : dict.ParentID.ToString(); //删除 if (!Request.Form["Delete"].IsNullOrEmpty()) { int i = bdict.DeleteAndAllChilds(dict.ID); //bdict.RefreshCache(); //RoadFlow.Platform.Log.Add("删除了数据字典及其下级共" + i.ToString() + "项", dict.Serialize(), RoadFlow.Platform.Log.Types.数据字典); ViewBag.Script = "alert('删除成功!');parent.frames[0].reLoad('" + refreshID + "');window.location='Body?id=" + dict.ParentID.ToString() + "&appid=" + Request.QueryString["appid"] + "';"; return(View(dict)); } string title = Request.Form["Title"]; string code = Request.Form["Code"]; string values = Request.Form["Values"]; string note = Request.Form["Note"]; string other = Request.Form["Other"]; string oldXML = dict.Serialize(); dict.Code = code.IsNullOrEmpty() ? null : code.Trim(); dict.Note = note.IsNullOrEmpty() ? null : note.Trim(); dict.Other = other.IsNullOrEmpty() ? null : other.Trim(); dict.Title = title.Trim(); dict.Value = values.IsNullOrEmpty() ? null : values.Trim(); bdict.Update(dict); //bdict.RefreshCache(); //RoadFlow.Platform.Log.Add("修改了数据字典项", "", RoadFlow.Platform.Log.Types.数据字典, oldXML, dict.Serialize()); ViewBag.Script = "alert('保存成功!');parent.frames[0].reLoad('" + refreshID + "');"; } return(View(dict)); }
public ActionResult Sort(FormCollection collection) { Next.WorkFlow.BLL.DictBLL BDict = new Next.WorkFlow.BLL.DictBLL(); string id = Request.QueryString["id"]; string refreshID = ""; string dictid; List <Dict> dicts = new List <Dict>(); if (id.IsGuid(out dictid)) { var dict = BDict.FindByID(dictid); if (dict != null) { dicts = BDict.GetChildsByID(dict.ParentID); refreshID = dict.ParentID.ToString(); } } if (collection != null) { string sortdict = Request.Form["sort"]; if (sortdict.IsNullOrEmpty()) { return(View(dicts)); } string[] sortArray = sortdict.Split(','); int i = 1; foreach (string id1 in sortArray) { string gid; if (id1.IsGuid(out gid)) { BDict.UpdateSort(gid, i++); } } //BDict.RefreshCache(); //RoadFlow.Platform.Log.Add("保存了数据字典排序", "保存了ID为:" + id + "的同级排序", RoadFlow.Platform.Log.Types.数据字典); ViewBag.Script = "parent.frames[0].reLoad('" + refreshID + "');"; dicts = BDict.GetChildsByID(refreshID.ToGuid()); } return(View(dicts)); }
public ActionResult add1(FormCollection collection) { Dict dict = new Dict(); Next.WorkFlow.BLL.DictBLL bdict = new Next.WorkFlow.BLL.DictBLL(); string id = Request.QueryString["id"]; if (!id.IsGuid()) { var dictRoot = bdict.GetRoot(); id = dictRoot != null?dictRoot.ID.ToString() : ""; } if (!id.IsGuid()) { throw new Exception("未找到父级"); } if (collection != null) { string title = Request.Form["Title"]; string code = Request.Form["Code"]; string values = Request.Form["Values"]; string note = Request.Form["Note"]; string other = Request.Form["Other"]; dict.ID = Guid.NewGuid().ToString(); dict.Code = code.IsNullOrEmpty() ? null : code.Trim(); dict.Note = note.IsNullOrEmpty() ? null : note.Trim(); dict.Other = other.IsNullOrEmpty() ? null : other.Trim(); dict.ParentID = id.ToGuid(); dict.Sort = bdict.GetMaxSort(id.ToGuid()); dict.Title = title.Trim(); dict.Value = values.IsNullOrEmpty() ? null : values.Trim(); bdict.Insert(dict); //bdict.RefreshCache(); //RoadFlow.Platform.Log.Add("添加了数据字典项", dict.Serialize(), RoadFlow.Platform.Log.Types.数据字典); ViewBag.Script = "alert('添加成功!');parent.frames[0].reLoad('" + id + "');"; } return(View(dict)); }
public string TreeRefresh() { string id = Request.QueryString["refreshid"]; string gid; if (!id.IsGuid(out gid)) { Response.Write("[]"); } System.Text.StringBuilder json = new System.Text.StringBuilder("[", 1000); Next.WorkFlow.BLL.DictBLL BDict = new Next.WorkFlow.BLL.DictBLL(); var childs = BDict.GetChildsByID(gid).OrderBy(p => p.Sort); int i = 0; int count = childs.Count(); foreach (var child in childs) { var hasChilds = BDict.HasChilds(child.ID); json.Append("{"); json.AppendFormat("\"id\":\"{0}\",", child.ID); json.AppendFormat("\"parentID\":\"{0}\",", child.ParentID); json.AppendFormat("\"title\":\"{0}\",", child.Title); json.AppendFormat("\"type\":\"{0}\",", hasChilds ? "1" : "2"); json.AppendFormat("\"ico\":\"{0}\",", ""); json.AppendFormat("\"hasChilds\":\"{0}\",", hasChilds ? "1" : "0"); json.Append("\"childs\":["); json.Append("]"); json.Append("}"); if (i++ < count - 1) { json.Append(","); } } json.Append("]"); return(json.ToString()); }
public string Tree1() { Next.WorkFlow.BLL.DictBLL BDict = new Next.WorkFlow.BLL.DictBLL(); string rootid = Request.QueryString["root"]; bool ischild = "1" == Request.QueryString["ischild"];//是否要加载下级节点 string rootID = Guid.Empty.ToString(); if (!rootid.IsNullOrEmpty()) { if (!rootid.IsGuid(out rootID)) { var dict = BDict.GetByCode(rootid); if (dict != null) { rootID = dict.ID; } } } var root = rootID != Guid.Empty.ToString() ? BDict.FindByID(rootID) : BDict.GetRoot(); var rootHasChild = BDict.HasChilds(root.ID); System.Text.StringBuilder json = new System.Text.StringBuilder("[", 1000); json.Append("{"); json.AppendFormat("\"id\":\"{0}\",", root.ID); json.AppendFormat("\"parentID\":\"{0}\",", root.ParentID); json.AppendFormat("\"title\":\"{0}\",", root.Title); json.AppendFormat("\"type\":\"{0}\",", rootHasChild ? "0" : "2"); //类型:0根 1父 2子 json.AppendFormat("\"ico\":\"{0}\",", Url.Content("~/Assets/WorkFlow/images/ico/role.gif")); json.AppendFormat("\"hasChilds\":\"{0}\",", rootHasChild ? "1" : "0"); json.Append("\"childs\":["); var childs = BDict.GetChildsByID(root.ID); int i = 0; int count = childs.Count; foreach (var child in childs) { var hasChild = ischild && BDict.HasChilds(child.ID); json.Append("{"); json.AppendFormat("\"id\":\"{0}\",", child.ID); json.AppendFormat("\"parentID\":\"{0}\",", child.ParentID); json.AppendFormat("\"title\":\"{0}\",", child.Title); json.AppendFormat("\"type\":\"{0}\",", hasChild ? "1" : "2"); json.AppendFormat("\"ico\":\"{0}\",", ""); json.AppendFormat("\"hasChilds\":\"{0}\",", hasChild ? "1" : "0"); json.Append("\"childs\":["); json.Append("]"); json.Append("}"); if (i++ < count - 1) { json.Append(","); } } json.Append("]"); json.Append("}"); json.Append("]"); return(json.ToString()); }
/// <summary> /// 根据显示方式得到显示的字符串 /// </summary> /// <param name="value"></param> /// <param name="displayModel"></param> /// <returns></returns> public string GetDisplayString(string value, string displayModel, string format = "", string dbconnID = "", string sql = "") { string value1 = string.Empty; switch ((displayModel ?? "").ToLower()) { case "normal": default: value1 = value; break; case "dict_id_title": var dict = new DictBLL().FindByID(value.ToGuid()); value1 = dict == null ? "" : dict.Title; break; case "dict_id_code": var dict1 = new DictBLL().FindByID(value.ToGuid()); value1 = dict1 == null ? "" : dict1.Code; break; case "dict_id_value": var dict2 = new DictBLL().FindByID(value.ToGuid()); value1 = dict2 == null ? "" : dict2.Value; break; case "dict_id_note": var dict3 = new DictBLL().FindByID(value.ToGuid()); value1 = dict3 == null ? "" : dict3.Note; break; case "dict_id_other": var dict4 = new DictBLL().FindByID(value.ToGuid()); value1 = dict4 == null ? "" : dict4.Other; break; case "dict_code_title": var dict5 = new DictBLL().GetByCode(value); value1 = dict5 == null ? "" : dict5.Title; break; case "dict_code_id": var dict6 = new DictBLL().GetByCode(value); value1 = dict6 == null ? "" : dict6.ID.ToString(); break; case "dict_code_value": var dict7 = new DictBLL().GetByCode(value); value1 = dict7 == null ? "" : dict7.Value; break; case "dict_code_note": var dict8 = new DictBLL().GetByCode(value); value1 = dict8 == null ? "" : dict8.Note; break; case "dict_code_other": var dict9 = new DictBLL().GetByCode(value); value1 = dict9 == null ? "" : dict9.Other; break; case "organize_id_name": value1 = new DeptBLL().GetNames(value); break; case "files_link": string[] files = value.Split('|'); StringBuilder links = new StringBuilder(); //links.Append("<div>"); foreach (string file in files) { links.AppendFormat("<a target=\"_blank\" class=\"blue\" href=\"{0}\">{1}</a><br/>", file, System.IO.Path.GetFileName(file)); } //links.Append("</div>"); value1 = links.ToString(); break; case "files_img": string[] files1 = value.Split('|'); StringBuilder links1 = new StringBuilder(); //links.Append("<div>"); foreach (string file in files1) { links1.AppendFormat("<img src=\"{0}\" />", file); } //links.Append("</div>"); value1 = links1.ToString(); break; case "datetime_format": value1 = value.ToDateTime().ToString(format ?? Utility.Config.DateFormat); break; case "number_format": value1 = value.ToDecimal().ToString(format); break; case "table_fieldvalue": DBConnectionBLL dbconn = new DBConnectionBLL(); DataTable dt = dbconn.GetDataTable(dbconn.FindByID(dbconnID.ToGuid()), sql + "'" + value + "'"); value1 = dt.Rows.Count > 0 && dt.Columns.Count > 0 ? dt.Rows[0][0].ToString() : ""; break; } return(value1); }