public static MvcHtmlString CheckBoxList(this HtmlHelper htmlHelper, string name, string codeCategory, RepeatDirection repeatDirection = RepeatDirection.Horizontal) { RoadFlow.Platform.DictionaryBLL bll = new RoadFlow.Platform.DictionaryBLL(); var codes = bll.GetListByCode(codeCategory); return(GenerateHtml(name, codes, repeatDirection, "checkbox", null)); }
public string TreeRefresh() { string id = Request.QueryString["refreshid"]; Guid gid; if (!id.IsGuid(out gid)) { Response.Write("[]"); } System.Text.StringBuilder json = new System.Text.StringBuilder("[", 1000); RoadFlow.Platform.DictionaryBLL BDict = new RoadFlow.Platform.DictionaryBLL(); var childs = BDict.GetChilds(gid).OrderBy(p => p.Sort); int i = 0; int count = childs.Count(); foreach (var child in childs) { json.Append("{"); json.AppendFormat("\"id\":\"{0}\",", child.ID); json.AppendFormat("\"parentID\":\"{0}\",", child.ParentID); json.AppendFormat("\"title\":\"{0}\",", child.Title); json.AppendFormat("\"ico\":\"{0}\",", ""); json.AppendFormat("\"hasChilds\":\"{0}\",", BDict.HasChilds(child.ID.Value) ? "1" : "0"); json.Append("\"childs\":["); json.Append("]"); json.Append("}"); if (i++ < count - 1) { json.Append(","); } } json.Append("]"); return(json.ToString()); }
private ActionResult Query(string title1, string address) { string pager; string appid = Request.QueryString["appid"]; string tabid = Request.QueryString["tabid"]; string typeid = Request.QueryString["typeid"]; RoadFlow.Platform.DictionaryBLL bdict = new RoadFlow.Platform.DictionaryBLL(); RoadFlow.Platform.AppLibraryBLL bapp = new RoadFlow.Platform.AppLibraryBLL(); string typeidstring = typeid.IsGuid() ? bapp.GetAllChildsIDString(typeid.Convert <Guid>()) : ""; 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 <RoadFlow.Data.Model.AppLibraryModel> 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)); }
/// <summary> /// 编码转换 /// </summary> /// <returns></returns> public static DataTable DictionaryIdToName(DataTable dt) { Dictionary <string, string> piName = new Dictionary <string, string>(); var list = new RoadFlow.Platform.DictionaryBLL().GetAll(); //编码转换 for (int i = 0; i < dt.Rows.Count; i++) { for (int j = 0; j < dt.Columns.Count; j++) { if (dt.Columns[j].ColumnName == "SW_ZJ" || dt.Columns[j].ColumnName == "SY_ZJ") { } else { if (list.FindAll(x => x.Code == dt.Columns[j].ColumnName).Count > 0) { string temp = Convert.ToString(dt.Rows[i][j]); RoadFlow.Data.Model.DictionaryModel dictionary = list.Find(p => p.ID.ToString().ToUpper() == temp.ToUpper()); if (dictionary != null) { dt.Rows[i][j] = dictionary.Title; } else { dt.Rows[i][j] = "已删除"; } } } } } return(dt); }
/// <summary> /// 获取大厦详情 /// </summary> /// <param name="id"></param> /// <returns></returns> public string GetDetails(string id) { var info = new RoadFlow.Platform.BuildingsAndBuildingMonthInfoBLL().Get(Guid.Parse(id)); //大楼信息 DataTable ep = new RoadFlow.Platform.EnterpriseAndEnterpriseTaxBLL().GetAllByBuildingID(id); //入驻企业信息 if (info == null) { return(string.Empty); } else { var dictionarys = new RoadFlow.Platform.DictionaryBLL().GetListAll(); info.LYJBName = dictionarys.Find(p => p.ID == info.LYJB.Value) == null ? "" : dictionarys.Find(p => p.ID == info.LYJB.Value).Title; info.LYLXName = dictionarys.Find(p => p.ID == info.LYLX.Value) == null ? "" : dictionarys.Find(p => p.ID == info.LYLX.Value).Title; info.JSJDName = dictionarys.Find(p => p.ID == info.JSJD.Value) == null ? "" : dictionarys.Find(p => p.ID == info.JSJD.Value).Title; info.SSJDName = dictionarys.Find(p => p.ID == info.SSJD.Value) == null ? "" : dictionarys.Find(p => p.ID == info.SSJD.Value).Title; info.SY_ZJName = dictionarys.Find(p => p.ID == info.SY_ZJ.Value) == null ? "" : dictionarys.Find(p => p.ID == info.SY_ZJ.Value).Title; info.SW_ZJName = dictionarys.Find(p => p.ID == info.SW_ZJ.Value) == null ? "" : dictionarys.Find(p => p.ID == info.SW_ZJ.Value).Title; info.TCZSName = dictionarys.Find(p => p.ID == info.TCZS.Value) == null ? "" : dictionarys.Find(p => p.ID == info.TCZS.Value).Title; info.ZYKTName = dictionarys.Find(p => p.ID == info.ZYKT.Value) == null ? "" : dictionarys.Find(p => p.ID == info.ZYKT.Value).Title; info.LYCQQKName = dictionarys.Find(p => p.ID == info.LYCQQK.Value) == null ? "" : dictionarys.Find(p => p.ID == info.LYCQQK.Value).Title; //info = ConvertType(info); //ep = ConvertType(ep); Dictionary <string, string> columnName = new Dictionary <string, string>(); return(new { info, ep, columnName }.ToJson()); } }
// // GET: /Controls/SelectDict/ public ActionResult Index() { RoadFlow.Platform.DictionaryBLL Dict = new RoadFlow.Platform.DictionaryBLL(); string values = Request.QueryString["values"]; string rootid = Request.QueryString["rootid"]; string defaultValuesString = ""; System.Text.StringBuilder defautlSB = new System.Text.StringBuilder(); foreach (string value in values.Split(',')) { Guid id; if (!value.IsGuid(out id)) { continue; } defautlSB.AppendFormat("<div onclick=\"currentDel=this;showinfo('{0}');\" class=\"selectorDiv\" ondblclick=\"currentDel=this;del();\" value=\"{0}\">", value); defautlSB.Append(Dict.GetTitle(id)); defautlSB.Append("</div>"); } defaultValuesString = defautlSB.ToString(); ViewBag.defaultValuesString = defaultValuesString; return(View()); }
public BuildingsController() { PageSize = 13; BuildingsAndBuildingMonthInfoBLL = new RoadFlow.Platform.BuildingsAndBuildingMonthInfoBLL(); TableAttribute = new RoadFlow.Platform.TableAttribute(); BLL = new RoadFlow.Platform.BuildingsDataBLL(); DictionaryBLL = new RoadFlow.Platform.DictionaryBLL(); }
public string Tree1() { RoadFlow.Platform.DictionaryBLL BDict = new RoadFlow.Platform.DictionaryBLL(); string rootid = Request.QueryString["root"]; Guid rootID = Guid.Empty; if (!rootid.IsNullOrEmpty()) { if (!rootid.IsGuid(out rootID)) { var dict = BDict.GetByCode(rootid); if (dict != null) { rootID = dict.ID.Value; } } } var root = rootID != Guid.Empty ? BDict.Get(rootID) : BDict.GetRoot(); 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("\"ico\":\"{0}\",", Url.Content("~/images/ico/role.gif")); json.AppendFormat("\"hasChilds\":\"{0}\",", BDict.HasChilds(root.ID.Value) ? "1" : "0"); json.Append("\"childs\":["); var childs = BDict.GetChilds(root.ID.Value); int i = 0; int count = childs.Count; foreach (var child in childs) { json.Append("{"); json.AppendFormat("\"id\":\"{0}\",", child.ID); json.AppendFormat("\"parentID\":\"{0}\",", child.ParentID); json.AppendFormat("\"title\":\"{0}\",", child.Title); json.AppendFormat("\"ico\":\"{0}\",", ""); json.AppendFormat("\"hasChilds\":\"{0}\",", BDict.HasChilds(child.ID.Value) ? "1" : "0"); json.Append("\"childs\":["); json.Append("]"); json.Append("}"); if (i++ < count - 1) { json.Append(","); } } json.Append("]"); json.Append("}"); json.Append("]"); return(json.ToString()); }
public static MvcHtmlString CheckBoxListFor <TModel, TProperty>(this HtmlHelper <TModel> htmlHelper, Expression <Func <TModel, TProperty> > expression, string codeCategory, RepeatDirection repeatDirection = RepeatDirection.Horizontal) { RoadFlow.Platform.DictionaryBLL bll = new RoadFlow.Platform.DictionaryBLL(); var codes = bll.GetListByCode(codeCategory); ModelMetadata metadata = ModelMetadata.FromLambdaExpression <TModel, TProperty>(expression, htmlHelper.ViewData); string name = ExpressionHelper.GetExpressionText(expression); string fullHtmlFieldName = htmlHelper.ViewContext.ViewData.TemplateInfo.GetFullHtmlFieldName(name); return(GenerateHtml(fullHtmlFieldName, codes, repeatDirection, "checkbox", metadata.Model)); }
//街道统计 public ActionResult Index() { StatisticsIndexViewModel viewModel = new StatisticsIndexViewModel(); string ssjd = Request["ssjd"]; RoadFlow.Platform.DictionaryBLL DictionaryBLL = new RoadFlow.Platform.DictionaryBLL(); viewModel.ParaSSJD = new SelectList(DictionaryBLL.GetListByCode("SSJD").ToList <RoadFlow.Data.Model.DictionaryModel>(), "ID", "Title", ssjd);; viewModel.List = BuildingsStreetStatisticsBLL.GetBySSJD(ssjd); return(View(viewModel)); }
public ActionResult Body(FormCollection collection) { RoadFlow.Platform.DictionaryBLL bdict = new RoadFlow.Platform.DictionaryBLL(); RoadFlow.Data.Model.DictionaryModel dict = null; string id = Request.QueryString["id"]; if (id.IsGuid()) { dict = bdict.Get(id.Convert <Guid>()); } if (dict == null) { dict = bdict.GetRoot(); } if (collection != null) { string refreshID = dict.ParentID == Guid.Empty ? dict.ID.ToString() : dict.ParentID.ToString(); //删除 if (!Request.Form["Delete"].IsNullOrEmpty()) { int i = bdict.DeleteAndAllChilds(dict.ID.Value); //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 string GetNote() { string id = Request.QueryString["id"]; Guid gid; string note = ""; if (id.IsGuid(out gid)) { var dict = new RoadFlow.Platform.DictionaryBLL().Get(gid); if (dict != null) { note = dict.Note; } } return(note); }
public string GetNames() { string values = Request.QueryString["values"]; RoadFlow.Platform.DictionaryBLL Dict = new RoadFlow.Platform.DictionaryBLL(); System.Text.StringBuilder sb = new System.Text.StringBuilder(); foreach (string value in values.Split(',')) { var dict = Dict.Get(value.Convert <Guid>()); if (dict != null) { sb.Append(dict.Title); sb.Append(','); } } return(sb.ToString().TrimEnd(',')); }
public ActionResult Sort(FormCollection collection) { RoadFlow.Platform.DictionaryBLL BDict = new RoadFlow.Platform.DictionaryBLL(); string id = Request.QueryString["id"]; string refreshID = ""; Guid dictid; List <RoadFlow.Data.Model.DictionaryModel> dicts = new List <RoadFlow.Data.Model.DictionaryModel>(); if (id.IsGuid(out dictid)) { var dict = BDict.Get(dictid); if (dict != null) { dicts = BDict.GetChilds(dict.ParentID.Value); 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) { Guid 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.GetChilds(refreshID.Convert <Guid>()); } return(View(dicts)); }
/// <summary> /// 查询拥有权限。 /// </summary> /// <returns></returns> private Dictionary <Guid, string> GetPermission(DataTable dt, ElementOrganizeType type) { Dictionary <Guid, string> permission = new Dictionary <Guid, string>(); //权限列表 List <RoadFlow.Data.Model.DictionaryModel> dictionary = new RoadFlow.Platform.DictionaryBLL().GetListByCode("LPMC").ToList <RoadFlow.Data.Model.DictionaryModel>(); List <string> list = new List <string>(); foreach (DataRow dr in dt.Rows) { list.Clear(); foreach (DataRow item in BLL.GetByTypeAndOrganizeID(type, (Guid)dr["ID"]).Rows) { list.Add(dictionary.Find(p => p.ID == (Guid)item["ElementID"]).Title); } permission.Add((Guid)dr["ID"], string.Join(",", list)); } return(permission); }
/// <summary> /// 楼栋列表视图初始化(商务局,街道办,报送单位) /// </summary> /// <returns></returns> private BuildingIndexViewModel BuildingInit(int type) { BuildingIndexViewModel viewModel = new BuildingIndexViewModel(); string pager = string.Empty; Dictionary <KeyValuePair <string, RoadFlow.Data.Model.SQLFilterType>, object> where = IndexGetMoreWhere();//更多条件 #region 固定where if (!string.IsNullOrWhiteSpace(Request["Name"])) { viewModel.Name = Request["Name"]; where.Add(new KeyValuePair <string, RoadFlow.Data.Model.SQLFilterType>("Name", RoadFlow.Data.Model.SQLFilterType.CHARINDEX), viewModel.Name); } if (!string.IsNullOrWhiteSpace(Request["SSJD"])) { viewModel.SSJD = Request["SSJD"]; where.Add(new KeyValuePair <string, RoadFlow.Data.Model.SQLFilterType>("SSJD", RoadFlow.Data.Model.SQLFilterType.EQUAL), viewModel.SSJD); } #endregion if (type == 0) {//商务局 viewModel.List = BuildingsAndBuildingMonthInfoBLL.GetPagerData(out pager, PageSize, RoadFlow.Utility.Tools.GetPageNumber(), where); } else if (type == 1) { //街道办 var ssjd = new RoadFlow.Platform.DictionaryBLL().GetCurrentSSJD(); viewModel.SSJD = ssjd == null ? "" : ssjd.Value.ToString(); if (string.IsNullOrWhiteSpace(Request["SSJD"])) { where.Add(new KeyValuePair <string, RoadFlow.Data.Model.SQLFilterType>("SSJD", RoadFlow.Data.Model.SQLFilterType.EQUAL), viewModel.SSJD); } viewModel.List = BuildingsAndBuildingMonthInfoBLL.GetPagerData(out pager, PageSize, RoadFlow.Utility.Tools.GetPageNumber(), where); } else { //报送单位 viewModel.List = BuildingsAndBuildingMonthInfoBLL.GetCurrentUsersOrganizeList(out pager, PageSize, RoadFlow.Utility.Tools.GetPageNumber(), where); } viewModel.Pager = pager; viewModel.Display = GetColItemList();//读取显示字段配置信息 viewModel.Dictionarys = DictionaryBLL.GetListAll(); viewModel.SSJDList = new SelectList(DictionaryBLL.GetListByCode("SSJD").ToList <RoadFlow.Data.Model.DictionaryModel>(), "ID", "Title", viewModel.SSJD); return(viewModel); }
/// <summary> /// 转换数据编码 /// </summary> /// <param name="dt"></param> /// <returns></returns> public DataTable ConvertType(DataTable dt) { //取得编码字典 var list = new RoadFlow.Platform.DictionaryBLL().GetAll(); //编码转换 for (int i = 0; i < dt.Rows.Count; i++) { for (int j = 0; j < dt.Columns.Count; j++) { if (list.FindAll(x => x.Code == dt.Columns[j].ColumnName).Count > 0) { string temp = Convert.ToString(dt.Rows[i][j]); dt.Rows[i][j] = list.Find(x => x.ID.ToString() == temp).Title; } } } return(dt); }
/// <summary> /// 编码转换,将Guid转成对应数据字典的名称 /// </summary> /// <param name="table"></param> /// <returns></returns> private static DataTable FindDictionaryTitle(this DataTable table) { #region 编码转换,将Guid转成对应数据字典的名称 RoadFlow.Platform.DictionaryBLL dictionaryBLL = new RoadFlow.Platform.DictionaryBLL(); var dictionarys = dictionaryBLL.GetListAll(); //编码转换 for (int i = 0; i < table.Rows.Count; i++) { for (int j = 0; j < table.Columns.Count; j++) { if (dictionarys.FindAll(x => x.Code == table.Columns[j].ColumnName).Count > 0) { string temp = (string)table.Rows[i][j]; table.Rows[i][j] = dictionarys.Find(x => x.ID.ToString() == temp).Title; } } } #endregion return(table); }
public ActionResult add1(FormCollection collection) { RoadFlow.Data.Model.DictionaryModel dict = new RoadFlow.Data.Model.DictionaryModel(); RoadFlow.Platform.DictionaryBLL bdict = new RoadFlow.Platform.DictionaryBLL(); 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(); dict.Code = code.IsNullOrEmpty() ? null : code.Trim(); dict.Note = note.IsNullOrEmpty() ? null : note.Trim(); dict.Other = other.IsNullOrEmpty() ? null : other.Trim(); dict.ParentID = id.Convert <Guid>(); dict.Sort = bdict.GetMaxSort(id.Convert <Guid>()); dict.Title = title.Trim(); dict.Value = values.IsNullOrEmpty() ? null : values.Trim(); bdict.Add(dict); //bdict.RefreshCache(); RoadFlow.Platform.Log.Add("添加了数据字典项", dict.Serialize(), RoadFlow.Platform.Log.Types.数据字典); ViewBag.Script = "alert('添加成功!');parent.frames[0].reLoad('" + id + "');"; } return(View(dict)); }
/// <summary> /// TypeFilter代码提炼 /// </summary> /// <param name="keyword"></param> /// <param name="col">table几列</param> /// <returns></returns> public string TypeFilterRefining(string keyword, int beginNum, int col = 4) { StringBuilder content = new StringBuilder(); List <RoadFlow.Data.Model.DictionaryModel> list = new RoadFlow.Platform.DictionaryBLL().GetAllChilds(keyword); if (keyword == "TCZS") { content.AppendFormat("<table data-name=\"{1}\" num=\"{0}\" style=\"width:50%;\" ><tr>", beginNum, keyword); } else { content.AppendFormat("<table data-name=\"{1}\" num=\"{0}\"><tr>", beginNum, keyword); } int i = 0; content.AppendFormat("<td><a class=\"item\" href=\"javascript:void(0)\" data-value=\"{1}\">{0}</a></td>", "全部", -1); i++; foreach (var item in list) { i++; content.AppendFormat("<td><a class=\"item\" href=\"javascript:void(0)\" data-value=\"{1}\">{0}</a></td>", item.Title, item.ID); if ((list.Count + 1) / col > 1) //不止一行 加1的原因是前边有一个全部项。 { if (i % col == 0 && i != list.Count) { content.Append("</tr><tr>"); } } else { if (i % col == 0) { content.Append("</tr><tr>"); } } } content.Append("</tr></table>"); return(content.ToString()); }