/// <summary> ///统计当前用户下的自定义数据的数量 /// </summary> /// <returns></returns> public static string getCount() { var Count = ""; Count = BaseDT.SDE.TD_MOUNTAIN.getNum(SystemCls.getCurUserOrgNo()); return(Count); }
/// <summary> /// 获取单条记录 /// </summary> /// <returns></returns> public static OD_USER_Model getModel(OD_USER_SW sw) { OD_USER_Model m = new OD_USER_Model(); DataTable dt = BaseDT.OD_USER.getDT(sw); DataTable dtUser = BaseDT.T_SYSSEC_USER.getDT(new T_SYSSEC_IPSUSER_SW { curOrgNo = SystemCls.getCurUserOrgNo() }); if (dt.Rows.Count > 0) { int i = 0; m.ODUID = dt.Rows[i]["ODUID"].ToString(); m.ONDUTYDATE = PublicClassLibrary.ClsSwitch.SwitDate(dt.Rows[i]["ONDUTYDATE"].ToString()); m.BYORGNO = dt.Rows[i]["BYORGNO"].ToString(); m.ONDUTYUSERTYPE = dt.Rows[i]["ONDUTYUSERTYPE"].ToString(); m.ONDUTYUSERID = dt.Rows[i]["ONDUTYUSERID"].ToString(); m.ISATTENDED = dt.Rows[i]["ISATTENDED"].ToString(); m.ATTENDEDTIME = PublicClassLibrary.ClsSwitch.SwitTM(dt.Rows[i]["ATTENDEDTIME"].ToString()); m.USERNAME = BaseDT.T_SYSSEC_USER.getNameByUserList(dtUser, m.ONDUTYUSERID); } dt.Clear(); dt.Dispose(); dtUser.Clear(); dtUser.Dispose(); return(m); }
/// <summary> ///统计当前用户下的隔离带的记录数量 /// </summary> /// <returns></returns> public static string getCount() { var Count = ""; Count = BaseDT.DC_UTILITY_ISOLATIONSTRIP.getNum(new DC_UTILITY_ISOLATIONSTRIP_SW { BYORGNO = SystemCls.getCurUserOrgNo() }); return(Count); }
/// <summary> ///统计当前用户下的资源的记录数量 /// </summary> /// <returns></returns> public static string getCount() { var Count = ""; Count = BaseDT.DC_RESOURCE_NEW.getNum(new DC_RESOURCE_NEW_SW { ORGNOS = SystemCls.getCurUserOrgNo() }); return(Count); }
/// <summary> ///统计当前用户下的瞭望台的记录数量 /// </summary> /// <returns></returns> public static string getCount() { var Count = ""; Count = BaseDT.DC_UTILITY_OVERWATCH.getNum(new DC_UTILITY_OVERWATCH_SW { ORGNOS = SystemCls.getCurUserOrgNo() }); return(Count); }
/// <summary> ///获取植物的记录数量 /// </summary> /// <returns></returns> public static string getCount() { var Count = ""; Count = BaseDT.WILD_BOTANYDISTRIBUTE.getNum(new WILD_BOTANYDISTRIBUTE_SW { BYORGNO = SystemCls.getCurUserOrgNo() }); return(Count); }
/// <summary> ///统计当前用户下的监测站的记录数量 /// </summary> /// <returns></returns> public static string getCount() { var Count = ""; Count = BaseDT.DC_UTILITY_MONITORINGSTATION.getNum(new DC_UTILITY_MONITORINGSTATION_SW { BYORGNO = SystemCls.getCurUserOrgNo() }); return(Count); }
/// <summary> ///统计当前用户下的防火通道的记录数量 /// </summary> /// <returns></returns> public static string getCount() { var Count = ""; Count = BaseDT.DC_UTILITY_FIRECHANNEL.getNum(new DC_UTILITY_FIRECHANNEL_SW { BYORGNO = SystemCls.getCurUserOrgNo() }); return(Count); }
/// <summary> ///统计当前用户下的宣传碑牌的记录数量 /// </summary> /// <returns></returns> public static string getCount() { var Count = ""; Count = BaseDT.DC_UTILITY_PROPAGANDASTELE.getNum(new DC_UTILITY_PROPAGANDASTELE_SW { BYORGNO = SystemCls.getCurUserOrgNo() }); return(Count); }
/// <summary> ///统计当前用户下的车辆数量 /// </summary> /// <returns></returns> public static string getCount() { var Count = ""; Count = BaseDT.DC_CAR.getNum(new DC_CAR_SW { BYORGNO = SystemCls.getCurUserOrgNo() }); return(Count); }
/// <summary> /// 根据当前单位获取气象信息 /// </summary> /// <param name="sw">参见模型</param> /// <returns>返回气象信息</returns> public static string getWeather(YJ_WEATHER_SW sw) { if (string.IsNullOrEmpty(sw.BYORGNO)) { sw.BYORGNO = SystemCls.getCurUserOrgNo(); } YJ_WEATHER_Model wm = YJ_WEATHERCls.getModel(new YJ_WEATHER_SW { BYORGNO = sw.BYORGNO }); string str; if (string.IsNullOrEmpty(wm.WEATHERDATE) == false)// (!string.IsNullOrEmpty(wm.THIGH) && !string.IsNullOrEmpty(wm.THIGH) && !string.IsNullOrEmpty(wm.THIGH)) { str = "[" + PublicClassLibrary.ClsSwitch.SwitDate(wm.WEATHERDATE) + " " + wm.orgName + "] 最高气温" + wm.THIGH + "℃,最低气温" + wm.TLOWER + "℃,雨量" + wm.P + "mm"; } else { str = "暂无气象信息"; } return(str); }
/// <summary> /// 获取反馈火情相关数据 /// </summary> /// <param name="jcfid">监测火情id</param> /// <returns></returns> public static JCFireFKInfoModel GetFKFireInfoData(string jcfid) { DataTable dt = BaseDT.JC_FIRETICKLING.GetFKDT(jcfid);//获取反馈信息记录 JCFireFKInfoModel m = new JCFireFKInfoModel(); if (dt.Rows.Count == 1) { #region 监测火情信息 m.JC_FireData.JCFID = dt.Rows[0]["JCFID"].ToString(); m.JC_FireData.WXBH = dt.Rows[0]["WXBH"].ToString(); m.JC_FireData.DQRDBH = dt.Rows[0]["DQRDBH"].ToString(); m.JC_FireData.RSMJ = dt.Rows[0]["RSMJ"].ToString(); m.JC_FireData.JD = dt.Rows[0]["JCJD"].ToString(); m.JC_FireData.WD = dt.Rows[0]["JCWD"].ToString(); m.JC_FireData.RECEIVETIME = ClsSwitch.SwitTM(dt.Rows[0]["RECEIVETIME"].ToString()); m.JC_FireData.ISSUEDTIME = ClsSwitch.SwitTM(dt.Rows[0]["ISSUEDTIME"].ToString()); m.JC_FireData.ZQWZ = dt.Rows[0]["ZQWZ"].ToString(); m.JC_FireData.JCMANSTATE = dt.Rows[0]["JCMANSTATE"].ToString(); m.JC_FireData.FIRENAME = dt.Rows[0]["FIRENAME"].ToString(); m.JC_FireData.FIREFROMID = dt.Rows[0]["FIREFROMID"].ToString(); //火情原始id m.JC_FireData.FIREFROM = dt.Rows[0]["FIREFROM"].ToString(); m.JC_FireData.BYORGNO = dt.Rows[0]["XFORGNO"].ToString(); //下发单位 m.JC_FireData.FIRETIME = ClsSwitch.SwitTM(dt.Rows[0]["FIRETIME"].ToString()); m.JC_FireData.PFFLAG = dt.Rows[0]["PFFLAG"].ToString(); #endregion #region 火情反馈信息 m.JC_FireFKData.DL = dt.Rows[0]["DL"].ToString(); m.JC_FireFKData.FORESTNAME = dt.Rows[0]["FORESTNAME"].ToString(); m.JC_FireFKData.FORESTFIRETYPE = dt.Rows[0]["FORESTFIRETYPE"].ToString(); m.JC_FireFKData.FUELTYPE = dt.Rows[0]["FUELTYPE"].ToString(); m.JC_FireFKData.HOTTYPE = dt.Rows[0]["HOTTYPE"].ToString(); m.JC_FireFKData.CHECKTIME = ClsSwitch.SwitTM(dt.Rows[0]["CHECKTIME"].ToString()); m.JC_FireFKData.YY = dt.Rows[0]["YY"].ToString(); m.JC_FireFKData.JXHQSJ = dt.Rows[0]["JXHQSJ"].ToString(); m.JC_FireFKData.FIREBEGINTIME = ClsSwitch.SwitTM(dt.Rows[0]["FIREBEGINTIME"].ToString()); m.JC_FireFKData.FIREENDTIME = ClsSwitch.SwitTM(dt.Rows[0]["FIREENDTIME"].ToString()); m.JC_FireFKData.ISOUTFIRE = dt.Rows[0]["ISOUTFIRE"].ToString(); m.JC_FireFKData.BURNEDAREA = dt.Rows[0]["BURNEDAREA"].ToString(); m.JC_FireFKData.OVERDOAREA = dt.Rows[0]["OVERDOAREA"].ToString(); m.JC_FireFKData.LOSTFORESTAREA = dt.Rows[0]["LOSTFORESTAREA"].ToString(); m.JC_FireFKData.ELSELOSSINTRO = dt.Rows[0]["ELSELOSSINTRO"].ToString(); m.JC_FireFKData.FIREINTRO = dt.Rows[0]["FIREINTRO"].ToString(); m.JC_FireFKData.BYORGNO = dt.Rows[0]["BYORGNO"].ToString(); m.JC_FireFKData.MANUSERID = dt.Rows[0]["MANUSERID"].ToString(); m.JC_FireFKData.MANSTATE = dt.Rows[0]["MANSTATE"].ToString(); m.JC_FireFKData.MANTIME = dt.Rows[0]["MANTIME"].ToString(); m.JC_FireFKData.AUDITREASON = dt.Rows[0]["AUDITREASON"].ToString(); //审核不通过理由 m.JC_FireFKData.ADDRESS = dt.Rows[0]["ADDRESS"].ToString(); //实际发生地 //坐标偏移量计算 84坐标转火星坐标 string jd = string.IsNullOrEmpty(dt.Rows[0]["JD"].ToString()) ? dt.Rows[0]["JCJD"].ToString() : dt.Rows[0]["JD"].ToString(); //实际发生经度 string wd = string.IsNullOrEmpty(dt.Rows[0]["WD"].ToString()) ? dt.Rows[0]["JCWD"].ToString() : dt.Rows[0]["WD"].ToString(); //实际发生纬度 if (!string.IsNullOrEmpty(jd) && !string.IsNullOrEmpty(wd)) { double[] drr = ClsPositionTrans.GpsTransform(double.Parse(wd), double.Parse(jd), "1");//中心点偏移 m.JC_FireFKData.JD = drr[1].ToString(); m.JC_FireFKData.WD = drr[0].ToString(); } // m.JC_FireFKData.JD = string.IsNullOrEmpty(dt.Rows[0]["JD"].ToString()) ? dt.Rows[0]["JCJD"].ToString() : dt.Rows[0]["JD"].ToString();//实际发生经度 //m.JC_FireFKData.WD = string.IsNullOrEmpty(dt.Rows[0]["WD"].ToString()) ? dt.Rows[0]["JCWD"].ToString() : dt.Rows[0]["WD"].ToString();//实际发生纬度 #endregion //组织机构名 if (string.IsNullOrEmpty(m.JC_FireFKData.BYORGNO)) { m.JC_FireFKData.BYORGNO = SystemCls.getCurUserOrgNo(); } DataTable orgdt = BaseDT.T_SYS_ORG.getDT(new T_SYS_ORGSW() { ORGNO = m.JC_FireFKData.BYORGNO }); m.OrgName = BaseDT.T_SYS_ORG.getName(orgdt, m.JC_FireFKData.BYORGNO); //用户名 if (string.IsNullOrEmpty(m.JC_FireFKData.MANUSERID)) { m.JC_FireFKData.MANUSERID = SystemCls.getUserID(); } m.UserName = T_SYSSEC_IPSUSERCls.getModel(new T_SYSSEC_IPSUSER_SW() { USERID = m.JC_FireFKData.MANUSERID }).USERNAME; } dt.Clear(); dt.Dispose(); return(m); }
/// <summary> /// 获取视频列表 /// </summary> /// <param name="orgno"></param> /// <param name="eid"></param> /// <returns></returns> public static string getSynTree(string orgno, string eid) { JArray jObjects = new JArray(); string curUserOrg = SystemCls.getCurUserOrgNo();//获取当前登录用户的机构编码 if (string.IsNullOrEmpty(orgno) == false) { curUserOrg = orgno; } if (string.IsNullOrEmpty(orgno)) { var str = ""; if (PublicCls.OrgIsZhen(curUserOrg)) { str = PublicCls.GetOrgNameByOrgNO(curUserOrg.Substring(0, 6) + "000000000"); } else { str = PublicCls.GetOrgNameByOrgNO(curUserOrg); } JObject root = new JObject(); if (PublicCls.OrgIsShi(curUserOrg)) { root = new JObject { { "id", "1111" },//ORGNO { "text", str } }; } var resultlist = JC_MONITORCls.getListModel(new JC_MONITOR_BASICINFO_SW { BYORGNO = curUserOrg }); //获取所有有权限的监控摄像 if (resultlist.Any()) { var devOrgSXList = resultlist.Select(p => p.BYORGNO.Substring(0, 6) + "000000000").Distinct(); if (devOrgSXList.Any()) { JArray devSXArrary = new JArray(); foreach (var orgsx in devOrgSXList) { JObject rootSX = new JObject { { "id", orgsx },//ORGNO { "text", PublicCls.GetOrgNameByOrgNO(orgsx) } //{"state","closed"} }; var devOrgXZList = resultlist.Select(p => new { p.BYORGNO, p.ORGNAME }).Distinct() .Where(p => p.BYORGNO.Substring(0, 6) + "000000000" == orgsx); if (devOrgXZList.Any()) { JArray devXZArrary = new JArray(); foreach (var orgxz in devOrgXZList) { JObject rootXZ = new JObject { { "id", orgxz.BYORGNO },//ORGNO { "text", orgxz.ORGNAME } // {"state","closed"} }; var devlist = resultlist.Where(p => p.BYORGNO == orgxz.BYORGNO); if (devlist.Any()) { JArray devArrary = new JArray(); foreach (var dev in devlist) { JObject rootDevice = new JObject { { "id", dev.EMID }, { "text", dev.EMNAME }, { "objId", dev.OBJID }, { "templateId", dev.TEMPLATEDID }, { "ip", dev.IP }, { "port", dev.PORT }, { "type", dev.TYPE }, { "isVideo", true } }; devArrary.Add(rootDevice); } rootXZ.Add("children", devArrary); if (PublicCls.OrgIsZhen(curUserOrg))//乡镇级用户 { jObjects.Add(rootXZ); break; } devXZArrary.Add(rootXZ); } } rootSX.Add("children", devXZArrary); if (PublicCls.OrgIsXian(curUserOrg))//县级用户 { jObjects.Add(rootSX); break; } devSXArrary.Add(rootSX); } } if (PublicCls.OrgIsShi(curUserOrg))//市级用户 { root.Add("children", devSXArrary); } } if (PublicCls.OrgIsShi(curUserOrg)) { jObjects.Add(root); } } } else { var str = PublicCls.GetOrgNameByOrgNO(curUserOrg); JObject root = new JObject { { "id", "1111" }, //ORGNO { "text", str } }; var devlist = JC_MONITORCls.getListModel(new JC_MONITOR_BASICINFO_SW { BYORGNO = curUserOrg, EMID = eid }); //获取所有有权限的监控摄像 if (devlist.Any()) { JArray devArrary = new JArray(); foreach (var dev in devlist) { JObject rootDevice = new JObject { { "id", dev.EMID }, { "text", dev.EMNAME }, { "objId", dev.OBJID }, { "templateId", dev.TEMPLATEDID }, { "ip", dev.IP }, { "port", dev.PORT }, { "type", dev.TYPE }, { "isVideo", true } }; devArrary.Add(rootDevice); } root.Add("children", devArrary); jObjects.Add(root); } } return(JsonConvert.SerializeObject(jObjects)); }
/// <summary> /// 获取视频列表异步树 /// </summary> /// <param name="OrgNo"></param> /// <param name="eid"></param> /// <returns></returns> public static string getTree(string OrgNo, string eid) { JArray jObjects = new JArray(); string curUserOrg = SystemCls.getCurUserOrgNo();//获取当前登录用户的机构编码 if (string.IsNullOrEmpty(OrgNo) == false) { curUserOrg = OrgNo; } DataTable dtOrg = BaseDT.T_SYS_ORG.getDT(new T_SYS_ORGSW { TopORGNO = curUserOrg, SYSFLAG = ConfigCls.getSystemFlag() }); //获取当前登录用户有权限查看的单位 DataTable dtFRUser = BaseDT.JC_MONITOR_BASICINFO.getDT(new JC_MONITOR_BASICINFO_SW { BYORGNO = curUserOrg, EMID = eid }); //获取所有有权限的监控摄像 #region 市级用户 if (PublicCls.OrgIsShi(curUserOrg)) { DataRow[] drOrg = dtOrg.Select("", "ORGNO"); if (drOrg.Length > 0) { JObject root = new JObject { { "id", drOrg[0]["ORGNO"].ToString() },//ORGNO { "text", drOrg[0]["ORGNAME"].ToString() }, { "treeType", "org" }, }; JArray childArray = new JArray(); DataRow[] drOrgC = dtOrg.Select("SUBSTRING(ORGNO,1,4) = '" + curUserOrg.Substring(0, 4) + "' AND ORGNO<>'" + curUserOrg + "' and SUBSTRING(ORGNO,7,3)='000'", "");//获取所有县且〈〉市的 for (int i = 0; i < drOrgC.Length; i++) { JObject rootC = new JObject { { "id", drOrgC[i]["ORGNO"].ToString() },//ORGNO { "text", drOrgC[i]["ORGNAME"].ToString() }, { "state", "closed" }, { "treeType", "org" } }; childArray.Add(rootC); } root.Add("children", childArray); jObjects.Add(root); } } #endregion #region 县级用户 else if (PublicCls.OrgIsXian(curUserOrg)) { DataRow[] drOrg = dtOrg.Select("", "ORGNO"); if (drOrg.Length > 0) { JObject root = new JObject { { "id", drOrg[0]["ORGNO"].ToString() },//ORGNO { "text", drOrg[0]["ORGNAME"].ToString() }, { "state", "closed" }, { "treeType", "org" } }; JArray jObjectsC = new JArray(); DataRow[] drOrgC = dtOrg.Select("SUBSTRING(ORGNO,1,6) = '" + curUserOrg.Substring(0, 6) + "' AND ORGNO<>'" + curUserOrg + "'", ""); //获取所有县且〈〉市的 for (int i = 0; i < drOrgC.Length; i++) { JObject rootC = new JObject { { "id", drOrgC[i]["ORGNO"].ToString() },//ORGNO { "text", drOrgC[i]["ORGNAME"].ToString() }, { "state", "closed" }, { "treeType", "org" } }; //root.Add("children", getTreeChild(dtOrg, dtFRUser, dtRealTmp, drOrg[i]["ORGNO"].ToString()));//继续获取护林员 jObjectsC.Add(rootC); if (string.IsNullOrEmpty(OrgNo) == false)//异步加载,不显示县名 { jObjects.Add(rootC); } } if (string.IsNullOrEmpty(OrgNo))//县级用户登录 { jObjects.Add(root); root.Add("children", jObjectsC); } } } #endregion #region 乡镇用户 else { DataRow[] drOrg = dtOrg.Select("", "ORGNO"); if (drOrg.Length > 0) { JObject root = new JObject { { "id", drOrg[0]["ORGNO"].ToString() },//ORGNO { "text", drOrg[0]["ORGNAME"].ToString() }, { "state", "closed" }, { "treeType", "org" } }; DataRow[] drFRUser = dtFRUser.Select("BYORGNO = '" + curUserOrg + "'", "");//获取所有县且〈〉市的 JArray jObjectsC = new JArray(); for (int i = 0; i < drFRUser.Length; i++) { StringBuilder sb = new StringBuilder(); JObject rootC = new JObject { { "id", drFRUser[i]["EMID"].ToString() }, { "text", drFRUser[i]["EMNAME"].ToString() }, { "objId", drFRUser[i]["OBJID"].ToString() }, { "templateId", drFRUser[i]["TEMPLATEDID"].ToString() }, { "ip", drFRUser[i]["ip"].ToString() }, { "port", drFRUser[i]["PORT"].ToString() }, { "isVideo", true } }; jObjectsC.Add(rootC); if (string.IsNullOrEmpty(OrgNo) == false)//异步加载,不显示乡镇名 { jObjects.Add(rootC); } } if (string.IsNullOrEmpty(OrgNo))//乡镇级用户登录 { jObjects.Add(root); root.Add("children", jObjectsC); } } } #endregion dtOrg.Clear(); dtOrg.Dispose(); return(JsonConvert.SerializeObject(jObjects)); }
/// <summary> /// 根据组织机构获取短信发送tree字符串 /// </summary> /// <param name="orgno"></param> /// <param name="type"></param> /// <returns></returns> public static SendMessage_Model getstr(string orgno, string type) { var s = ""; var d = ""; var dt = new DataTable(); var dtvillage = new DataTable(); var dtipuser = new DataTable(); if (orgno == "1") { dt = BaseDT.T_SYS_ORG_LINK.getDT(new T_SYS_ORG_LINK_SW { BYORGNO = SystemCls.getCurUserOrgNo() }); //列表 } else if (orgno == "2") { dtipuser = BaseDT.T_IPSFR_USER.getDT(new T_IPSFR_USER_SW { BYORGNO = SystemCls.getCurUserOrgNo() }); } else { if (PublicCls.OrgIsShi(orgno) == false && PublicCls.OrgIsXian(orgno) == false && PublicCls.OrgIsZhen(orgno) == false) { dtvillage = BaseDT.T_SYS_ORG_CWH.getVillagecComDT(new T_SYS_ORG_CWH_SW { CWHID = orgno }); } else { dtvillage = BaseDT.T_SYS_ORG_CWH.getVillagecComDT(new T_SYS_ORG_CWH_SW { BYORGNO = orgno }); dt = BaseDT.T_SYS_ORG_LINK.getDT(new T_SYS_ORG_LINK_SW { BYORGNO = orgno }); //列表 dtipuser = BaseDT.T_IPSFR_USER.getDT(new T_IPSFR_USER_SW { BYORGNO = orgno }); } } if (type == "1") { if (PublicCls.OrgIsShi(orgno) == false && PublicCls.OrgIsXian(orgno) == false && PublicCls.OrgIsZhen(orgno) == false) { for (int i = 0; i < dtvillage.Rows.Count; i++) { T_SYS_ORG_LINK_Model m = new T_SYS_ORG_LINK_Model(); m.NAME = dtvillage.Rows[i]["NAME"].ToString(); m.PHONE = dtvillage.Rows[i]["PHONE"].ToString(); s += m.NAME + ","; d += m.PHONE + ","; } } else { for (int i = 0; i < dt.Rows.Count; i++) { T_SYS_ORG_LINK_Model m = new T_SYS_ORG_LINK_Model(); m.NAME = dt.Rows[i]["NAME"].ToString(); m.PHONE = dt.Rows[i]["PHONE"].ToString(); s += m.NAME + ","; d += m.PHONE + ","; } for (int i = 0; i < dtvillage.Rows.Count; i++) { T_SYS_ORG_LINK_Model m = new T_SYS_ORG_LINK_Model(); m.NAME = dtvillage.Rows[i]["NAME"].ToString(); m.PHONE = dtvillage.Rows[i]["PHONE"].ToString(); s += m.NAME + ","; d += m.PHONE + ","; } } } if (type == "2") { for (int i = 0; i < dtipuser.Rows.Count; i++) { T_SYS_ORG_LINK_Model m = new T_SYS_ORG_LINK_Model(); m.NAME = dtipuser.Rows[i]["HNAME"].ToString(); m.PHONE = dtipuser.Rows[i]["PHONE"].ToString(); s += m.NAME + ","; d += m.PHONE + ","; } } s = s.TrimEnd(','); d = d.TrimEnd(','); SendMessage_Model m1 = new SendMessage_Model(); m1.PHONELIST = d; m1.NAMELIST = s; dt.Clear(); dt.Dispose(); dtvillage.Clear(); dtvillage.Dispose(); dtipuser.Clear(); dtipuser.Dispose(); return(m1); }
/// <summary> /// 组织机构联系人TREE /// </summary> /// <param name="OrgNo">组织结构编码</param> /// <returns></returns> public static string GetOrgTree(string OrgNo) { JArray jObjects = new JArray(); string curUserOrg = SystemCls.getCurUserOrgNo();//获取当前登录用户的机构编码 if (string.IsNullOrEmpty(OrgNo) == false) { curUserOrg = OrgNo; } var dtOrg = BaseDT.T_SYS_ORG.getDT(new T_SYS_ORGSW { TopORGNO = curUserOrg, SYSFLAG = ConfigCls.getSystemFlag() }); //获取当前登录用户有权限查看的单位 DataTable dtLink = BaseDT.T_SYS_ORG_LINK.getDT(new T_SYS_ORG_LINK_SW { }); DataTable dtVillagecommittee = BaseDT.T_SYS_ORG_CWH.getDT(new T_SYS_ORG_CWH_SW { }); //JObject root = new JObject // { // { "id", "1"+"|" + "1" }, // { "text", "组织机构成员" } // }; #region 市级用户 if (PublicCls.OrgIsShi(curUserOrg)) { DataRow[] drOrg = dtOrg.Select("", "ORGNO"); //JArray childArrayroot = new JArray(); JObject root1 = new JObject { { "id", drOrg[0]["ORGNO"].ToString() }, { "text", drOrg[0]["ORGNAME"].ToString() }, { "treeType", "1" }, { "flag", "" } }; //childArrayroot.Add(root1); //root.Add("children", childArrayroot); JArray childArray = new JArray(); DataRow[] drLink = dtLink.Select("BYORGNO = '" + curUserOrg + "'", ""); for (int i = 0; i < drLink.Length; i++) { StringBuilder sb = new StringBuilder(); sb.AppendFormat("<font title={0}>", drLink[i]["PHONE"].ToString()); sb.AppendFormat("{0}[{1}] </font>", drLink[i]["NAME"].ToString(), drLink[i]["USERJOB"].ToString()); JObject roota = new JObject { { "id", drLink[i]["PHONE"].ToString() }, { "text", sb.ToString() }, { "flag", drLink[i]["NAME"].ToString() }, { "phone", drLink[i]["PHONE"].ToString() } }; childArray.Add(roota); } DataRow[] drOrgC = dtOrg.Select("SUBSTRING(ORGNO,1,4) = '" + curUserOrg.Substring(0, 4) + "' AND ORGNO<>'" + curUserOrg + "' and SUBSTRING(ORGNO,7,9)='000000000'", "");//获取所有县且〈〉市的 for (int i = 0; i < drOrgC.Length; i++) { JObject rootb = new JObject { { "id", drOrgC[i]["ORGNO"].ToString() },//ORGNO { "text", drOrgC[i]["ORGNAME"].ToString() }, { "flag", "" }, { "state", "closed" }, }; childArray.Add(rootb); } root1.Add("children", childArray); jObjects.Add(root1); } #endregion #region 县级用户 else if (PublicCls.OrgIsXian(curUserOrg)) { DataRow[] drOrg = dtOrg.Select("", "ORGNO"); //JArray childArrayroot = new JArray(); JObject root1 = new JObject { { "id", drOrg[0]["ORGNO"].ToString() }, { "text", drOrg[0]["ORGNAME"].ToString() }, { "flag", "" } }; //childArrayroot.Add(root1); //root.Add("children", childArrayroot); JArray jObjectsC = new JArray(); DataRow[] drLink = dtLink.Select("BYORGNO = '" + curUserOrg + "'", ""); for (int i = 0; i < drLink.Length; i++) { StringBuilder sb = new StringBuilder(); sb.AppendFormat("<font title={0}>", drLink[i]["PHONE"].ToString()); sb.AppendFormat("{0}[{1}] </font>", drLink[i]["NAME"].ToString(), drLink[i]["USERJOB"].ToString()); JObject rootc = new JObject { { "id", drLink[i]["PHONE"].ToString() }, { "text", sb.ToString() }, { "flag", drLink[i]["NAME"].ToString() }, { "phone", drLink[i]["PHONE"].ToString() } }; jObjectsC.Add(rootc); if (string.IsNullOrEmpty(OrgNo) == false)//异步加载,不显示县名 { jObjects.Add(rootc); } } DataRow[] drOrgC = dtOrg.Select("SUBSTRING(ORGNO,1,6) = '" + curUserOrg.Substring(0, 6) + "' AND ORGNO<>'" + curUserOrg + "' and SUBSTRING(ORGNO,10,6)='000000'", ""); //获取所有镇且〈〉县的 for (int i = 0; i < drOrgC.Length; i++) { JObject rootd = new JObject { { "id", drOrgC[i]["ORGNO"].ToString() },//ORGNO { "text", drOrgC[i]["ORGNAME"].ToString() }, { "flag", "" }, { "state", "closed" }, }; jObjectsC.Add(rootd); if (string.IsNullOrEmpty(OrgNo) == false)//异步加载,不显示县名 { jObjects.Add(rootd); } } if (string.IsNullOrEmpty(OrgNo))//县级用户登录 { jObjects.Add(root1); root1.Add("children", jObjectsC); } } #endregion #region 乡镇级用户 else if (PublicCls.OrgIsZhen(curUserOrg)) { DataRow[] drOrg = dtOrg.Select("", "ORGNO"); //JArray childArrayroot = new JArray(); JObject root1 = new JObject { { "id", drOrg[0]["ORGNO"].ToString() }, { "text", drOrg[0]["ORGNAME"].ToString() }, { "flag", "" }, { "treeType", "1" }, }; //childArrayroot.Add(root1); //root.Add("children", childArrayroot); JArray childArray = new JArray(); DataRow[] drLink = dtLink.Select("BYORGNO = '" + curUserOrg + "'", ""); for (int i = 0; i < drLink.Length; i++) { StringBuilder sb = new StringBuilder(); sb.AppendFormat("<font title={0}>", drLink[i]["PHONE"].ToString()); sb.AppendFormat("{0}[{1}] </font>", drLink[i]["NAME"].ToString(), drLink[i]["USERJOB"].ToString()); JObject rootf = new JObject { { "id", drLink[i]["PHONE"].ToString() }, { "text", sb.ToString() }, { "flag", drLink[i]["NAME"].ToString() }, { "phone", drLink[i]["PHONE"].ToString() } }; childArray.Add(rootf); if (string.IsNullOrEmpty(OrgNo) == false)//异步加载 { jObjects.Add(rootf); } } DataRow[] drVillagecommittee = dtVillagecommittee.Select("BYORGNO = '" + curUserOrg + "'", "");//获取乡下面的村委会 for (int i = 0; i < drVillagecommittee.Length; i++) { JObject rootg = new JObject { { "id", drVillagecommittee[i]["CWHID"].ToString() },//ORGNO { "text", drVillagecommittee[i]["CWHNAME"].ToString() }, { "state", "closed" } }; childArray.Add(rootg); if (string.IsNullOrEmpty(OrgNo) == false)//异步加载 { jObjects.Add(rootg); } } if (string.IsNullOrEmpty(OrgNo))//乡镇用户登录 { //jObjects.Add(root); root1.Add("children", childArray); } } else { JArray childArray = new JArray(); DataRow[] drLink = dtLink.Select("BYORGNO = '" + curUserOrg + "'", ""); for (int i = 0; i < drLink.Length; i++) { StringBuilder sb = new StringBuilder(); sb.AppendFormat("<font title={0}>", drLink[i]["PHONE"].ToString()); if (string.IsNullOrEmpty(drLink[i]["UNITNAME"].ToString()) == false) { sb.AppendFormat("{0}[{1}][{2}] </font>", drLink[i]["NAME"].ToString(), drLink[i]["USERJOB"].ToString(), drLink[i]["UNITNAME"].ToString()); } else { sb.AppendFormat("{0}[{1}][{2}] </font>", drLink[i]["NAME"].ToString(), drLink[i]["USERJOB"].ToString(), "--"); } JObject rootf = new JObject { { "id", drLink[i]["PHONE"].ToString() }, { "text", sb.ToString() }, { "flag", drLink[i]["NAME"].ToString() }, { "phone", drLink[i]["PHONE"].ToString() } }; childArray.Add(rootf); if (string.IsNullOrEmpty(OrgNo) == false)//异步加载 { jObjects.Add(rootf); } } } #endregion dtOrg.Clear(); dtOrg.Dispose(); return(JsonConvert.SerializeObject(jObjects)); }
/// <summary> /// 获取所有系统菜单 /// </summary> /// <param name="sw">参见T_SYS_MENU_SW</param> /// <returns>参见SystemMenu_Model</returns> public static IEnumerable <SystemMenu_Model> getT_SYS_MENUModel(T_SYS_MENU_SW sw) { var result = new List <SystemMenu_Model>(); if (string.IsNullOrEmpty(SystemCls.getUserID())) { return(result); } StringBuilder sb = new StringBuilder(1000); sb.AppendFormat(" FROM T_SYS_MENU WHERE 1=1"); sb.AppendFormat(" AND SYSFLAG='{0}' ", sw.SYSFLAG); sb.AppendFormat(" AND MENURIGHTFLAG in (select RIGHTID from T_SYSSEC_ROLE_RIGHT where (ROLEID in (select ROLEID from T_SYSSEC_USER_ROLE where USERID={0} ) and RIGHTID in(select RIGHTID from T_SYSSEC_RIGHT where SYSFLAG='{1}')) and roleid in (select roleid from T_SYSSEC_ROLE where SYSFLAG='{1}') )", SystemCls.getUserID(), ConfigCls.getSystemFlag()); if (string.IsNullOrEmpty(sw.MENUCODE) == false) { sb.AppendFormat(" AND left(MENUCODE,3) in({0}) ", sw.MENUCODE); } if (string.IsNullOrEmpty(sw.MenuCodeList) == false) { sb.AppendFormat(" AND left(MENUCODE,3) in({0}) ", sw.MenuCodeList); } string sql = "SELECT MENUID,MENUCODE,MENUNAME,MENUURL,MENUICO,LICLASS,ORDERBY,MENURIGHTFLAG,SYSFLAG,MENUOPENMETHOD, MENULINKMODE, MENUDROWMTHOD, ISTOPMENU " + sb.ToString() + " "; DataSet ds = DataBaseClass.FullDataSet(sql); DataTable dt = ds.Tables[0]; DataRow[] dr = dt.Select("len(MENUCODE)=3", "ORDERBY"); //获取上报数据 DataTable dtR = BaseDT.T_IPSRPT_REPORT.getDT(new T_IPSRPT_REPORT_SW { MANSTATE = "0", orgNo = SystemCls.getCurUserOrgNo() }); CookieModel cookieInfo = SystemCls.getCookieInfo();//登录用户信息 for (int i = 0; i < dr.Length; i++) { SystemMenu_Model m = new SystemMenu_Model(); m.MENUCODE = dr[i]["MENUCODE"].ToString(); m.MENUICO = dr[i]["MENUICO"].ToString(); m.MENUNAME = dr[i]["MENUNAME"].ToString(); m.LICLASS = dr[i]["LICLASS"].ToString(); m.MENUOPENMETHOD = dr[i]["MENUOPENMETHOD"].ToString(); m.MENULINKMODE = dr[i]["MENULINKMODE"].ToString(); m.MENUDROWMTHOD = dr[i]["MENUDROWMTHOD"].ToString(); m.ISTOPMENU = dr[i]["ISTOPMENU"].ToString(); long mShowCount = 0;//一级菜单显示数量 var SubM = new List <T_SYS_MENU_Model>(); DataRow[] dr1 = dt.Select("len(MENUCODE)=6 and SUBSTRING(MENUCODE,1,3)='" + dr[i]["MENUCODE"].ToString() + "'", "ORDERBY"); for (int k = 0; k < dr1.Length; k++) { T_SYS_MENU_Model mm = new T_SYS_MENU_Model(); mm.MENUCODE = dr1[k]["MENUCODE"].ToString(); mm.MENUURL = dr1[k]["MENUURL"].ToString().Replace("[USERID]", cookieInfo.UID).Replace("[LOGINUSERNAME]", cookieInfo.userName); mm.MENUNAME = dr1[k]["MENUNAME"].ToString(); mm.MENUICO = dr1[k]["MENUICO"].ToString(); mm.LICLASS = dr1[k]["LICLASS"].ToString(); //获取需要显示提醒数量的菜单 string MENUCODE = dr1[k]["MENUCODE"].ToString(); string count = "0"; if (MENUCODE == "001004") { count = BaseDT.T_IPS_ALARM.getDT(new T_IPS_ALARM_SW { orgNo = SystemCls.getCurUserOrgNo(), MANSTATE = "0" }).Rows.Count.ToString(); } if (MENUCODE == "001003") { count = BaseDT.T_IPS_HOTS.getDT(new T_IPS_HOTS_SW { MANSTATE = "0" }).Rows.Count.ToString(); } if (MENUCODE.Substring(0, 3) == "002") { string tmpCode = MENUCODE.Substring(3, 3); if (tmpCode.Substring(0, 2) == "00") { tmpCode = tmpCode.Substring(2, 1); } else if (tmpCode.Substring(0, 1) == "0") { tmpCode = tmpCode.Substring(1, 2); } else { tmpCode = tmpCode.Substring(2, 1); } count = BaseDT.T_IPSRPT_REPORT.getCountByType(dtR, tmpCode); mm.TID = tmpCode;//类别ID 上报序号 } if (MENUCODE.Substring(0, 3) == "003") { string tmpCode = MENUCODE.Substring(3, 3); if (tmpCode.Substring(0, 2) == "00") { tmpCode = tmpCode.Substring(2, 1); } else if (tmpCode.Substring(0, 1) == "0") { tmpCode = tmpCode.Substring(1, 2); } else { tmpCode = tmpCode.Substring(2, 1); } //count = BaseDT.T_IPSRPT_REPORT.getCountByType(dtR, tmpCode); mm.TID = tmpCode; //类别ID 上报序号 } mShowCount += Convert.ToInt64(count); if (count == "0") { count = ""; } mm.showCount = count; SubM.Add(mm); } m.showCount = (mShowCount == 0) ? "" : mShowCount.ToString(); m.subMenuModel = SubM; result.Add(m); } ds.Clear(); ds.Dispose(); dt.Clear(); dt.Dispose(); return(result); }
/// <summary> /// 获取用户自定义菜单 /// </summary> /// <param name="sw">参见T_SYS_MENU_SW</param> /// <returns>html代码</returns> public static string getT_SYS_DEFINEMENU(T_SYS_MENU_SW sw) { if (string.IsNullOrEmpty(sw.UID)) { return(""); } StringBuilder sb = new StringBuilder(1000); sb.AppendFormat(" FROM T_SYS_MENU WHERE 1=1"); bool bln = DataBaseClass.JudgeRecordExists("SELECT MENUCODE FROM T_SYS_DEFINEMENU WHERE (UID=" + sw.UID + ") AND SYSFLAG='" + sw.SYSFLAG + "'"); if (bln) { sb.AppendFormat(" AND MENUCODE IN (SELECT MENUCODE FROM T_SYS_DEFINEMENU WHERE UID={0} AND SYSFLAG='{1}') ", sw.UID, sw.SYSFLAG); sb.AppendFormat(" AND MENURIGHTFLAG in (select RIGHTID from T_SYSSEC_ROLE_RIGHT where (ROLEID in (select ROLEID from T_SYSSEC_USER_ROLE where USERID={0} )) and roleid in(select roleid from T_SYSSEC_ROLE where SYSFLAG='{1}') )", getUserID(), ConfigCls.getSystemFlag()); } else { sb.AppendFormat(" AND MENUCODE IN(SELECT MENUCODE FROM T_SYS_DEFINEMENU WHERE UID=0 AND SYSFLAG='{1}') ", sw.UID, sw.SYSFLAG); } string sql = "SELECT MENUID,MENUCODE,MENUNAME,MENUURL,MENUICO,LICLASS,ORDERBY,MENURIGHTFLAG,SYSFLAG " + sb.ToString() + " "; DataSet ds = DataBaseClass.FullDataSet(sql); StringBuilder sb1 = new StringBuilder(); DataTable dtR = BaseDT.T_IPSRPT_REPORT.getDT(new T_IPSRPT_REPORT_SW { MANSTATE = "0", orgNo = SystemCls.getCurUserOrgNo() }); sb1.AppendFormat("<ul class=\"nav ace-nav\">"); for (int i = 0; i < ds.Tables[0].Rows.Count; i++) { string MENUCODE = ds.Tables[0].Rows[i]["MENUCODE"].ToString(); string count = ""; switch (MENUCODE) { case "002001": count = BaseDT.T_IPSRPT_REPORT.getCountByType(dtR, "1"); break; case "002002": count = BaseDT.T_IPSRPT_REPORT.getCountByType(dtR, "2"); break; case "002003": count = BaseDT.T_IPSRPT_REPORT.getCountByType(dtR, "3"); break; case "001004": count = BaseDT.T_IPS_ALARM.getDT(new T_IPS_ALARM_SW { orgNo = SystemCls.getCurUserOrgNo(), MANSTATE = "0" }).Rows.Count.ToString(); break; case "001003": count = BaseDT.T_IPS_HOTS.getDT(new T_IPS_HOTS_SW { MANSTATE = "0" }).Rows.Count.ToString(); break; default: break; } if (count == "0") { count = ""; } string liclass = ds.Tables[0].Rows[i]["LICLASS"].ToString(); if (string.IsNullOrEmpty(liclass)) { liclass = "light-blue"; } sb1.AppendFormat("<li class=\"{0}\">", liclass); sb1.AppendFormat(" <a class=\"dropdown-toggle\" href=\"{0}\">", ds.Tables[0].Rows[i]["MENUURL"].ToString()); if (string.IsNullOrEmpty(count) == false) { sb1.AppendFormat(" <i class=\"{0} icon-spin\"></i> {1}", ds.Tables[0].Rows[i]["MENUICO"].ToString(), ds.Tables[0].Rows[i]["MENUNAME"].ToString()); sb1.AppendFormat(" <span class=\"badge badge-important\">{0}</span>", count); } else { sb1.AppendFormat(" <i class=\"{0}\"></i> {1}", ds.Tables[0].Rows[i]["MENUICO"].ToString(), ds.Tables[0].Rows[i]["MENUNAME"].ToString()); } sb1.AppendFormat(" </a>"); sb1.AppendFormat("</li>"); //T_SYS_MENU_Model m = new T_SYS_MENU_Model(); //m.MENUID = ds.Tables[0].Rows[i]["MENUID"].ToString(); //m.MENUCODE = ds.Tables[0].Rows[i]["MENUCODE"].ToString(); //m.MENUNAME = ds.Tables[0].Rows[i]["MENUNAME"].ToString(); //m.MENUURL = ds.Tables[0].Rows[i]["MENUURL"].ToString(); //m.MENUICO = ds.Tables[0].Rows[i]["MENUICO"].ToString(); //m.ORDERBY = ds.Tables[0].Rows[i]["ORDERBY"].ToString(); //m.MENURIGHTFLAG = ds.Tables[0].Rows[i]["MENURIGHTFLAG"].ToString(); //m.SYSFLAG = ds.Tables[0].Rows[i]["SYSFLAG"].ToString(); //result.Add(m); } CookieModel cookieInfo = SystemCls.getCookieInfo();//当前登录用户姓名 sb1.AppendFormat(" <li class=\"light-blue\">"); sb1.AppendFormat(" <a data-toggle=\"dropdown\" href=\"#\" class=\"dropdown-toggle\">"); sb1.AppendFormat(" <img class=\"nav-user-photo\" src=\"../Content/themes/assets/avatars/user.jpg\" alt=\"Jason's Photo\" />"); sb1.AppendFormat(" <span class=\"user-info\">"); sb1.AppendFormat(" <small>欢迎光临,</small>"); sb1.AppendFormat(" <font color=\"red\">{0}</font>", cookieInfo.trueName); sb1.AppendFormat(" </span>"); sb1.AppendFormat(" <i class=\"icon-caret-down\"></i>"); sb1.AppendFormat(" </a>"); sb1.AppendFormat(" <ul class=\"user-menu pull-right dropdown-menu dropdown-yellow dropdown-caret dropdown-close\">"); sb1.AppendFormat(" <li class=\"divider\"></li>"); sb1.AppendFormat(" <li>"); sb1.AppendFormat(" <a href=\"/System/LoginOut\">"); sb1.AppendFormat(" <i class=\"icon-off\"></i>"); sb1.AppendFormat(" 退出"); sb1.AppendFormat(" </a>"); sb1.AppendFormat(" </li>"); sb1.AppendFormat(" </ul>"); sb1.AppendFormat("</li>"); sb1.AppendFormat("</ul>"); ds.Clear(); dtR.Clear(); dtR.Dispose(); return(sb1.ToString()); }