private IList <T> _getTreeData <T>(StringObjectDictionary param) where T : TreeNode, new() { if (param.ContainsKey("OrderByClause")) { param["OrderByClause"] = string.Join(",", param["OrderByClause"].ToString().Split("|".ToCharArray(), StringSplitOptions.RemoveEmptyEntries)); } param.Add("ErrorCode", null); param.Add("ErrorMessage", null); var results = BuilderFactory.DefaultBulder(GlobalManager.getConnectString(GetHttpHeader(GlobalManager.ConnectIdKey))).ExecuteSPForQuery <StringObjectDictionary>("SP_Sys_GetTreeData", param).Select(item => { T node = new T(); node.MixDictionary(item); node.pId = node.pId.Trim(); return(node); }).ToList(); return(results); }
private void _MessageLoopForAccessPoints() { foreach (var part in accessPointParts) { if (threadsToAccessPoints.ContainsKey(part.ObjectId)) { Thread accessPointThead = threadsToAccessPoints[part.ObjectId] as Thread; if (accessPointThead != null) { if (accessPointThead.IsAlive) { accessPointThead.Abort(); threadsToAccessPoints.Remove(part.ObjectId); } } } threadsToAccessPoints.Add(part.ObjectId, InitAccessPointThread(part)); } }
/// <summary> /// 检查是否存键名,并返回该键值 /// </summary> /// <param name="keyName">键名</param> /// <param name="content">json格式的字符串</param> /// <param name="val">键值</param> /// <returns>存在true,不存在fasle</returns> private bool HaveKey(string keyName, string content, out string val) { bool result = true; try { var SODic = new StringObjectDictionary().MixInJson(content); if (!SODic.ContainsKey(keyName)) { result = false; val = string.Empty; } else { val = Convert.ToString(SODic[keyName]); } } catch { result = false; val = string.Empty; } return(result); }
public EasyUIgridCollectionInvokeResult <StringObjectDictionary> EvaluatedReportInfo2(EasyUIgridCollectionParam <StringObjectDictionary> param) { EasyUIgridCollectionInvokeResult <StringObjectDictionary> result = new EasyUIgridCollectionInvokeResult <StringObjectDictionary> { Success = true }; try { /***********************begin 复杂查询添加代码*********************/ StringObjectDictionary filters = new StringObjectDictionary(); List <string> whereClause = new List <string>(); List <string> whereClause2 = new List <string>(); /**********************************************************/ if (param.filterFields != null) { foreach (var field in param.filterFields) { if (field.key != "FlowTo_Start") { filters[field.key] = field.value; } else { if (field.value.Length == 1) { if (filters.ContainsKey("Status")) { filters.Remove("Status"); } whereClause.Add(" Status ='1' "); } else if (field.value.Length == 2) { filters["FlowTo"] = field.value; } else if (field.value.Length == 3) { int flowTo = Int32.Parse(field.value.Substring(1)); if (flowTo == 10) { whereClause2.Add("FlowTo <> 10"); } else { whereClause2.Add("FlowFrom between " + (flowTo + 1).ToString() + " and " + (flowTo + 9).ToString()); } } } } } /***********************begin 模糊查询*********************/ if (param.fuzzyFields != null) { List <string> fuzzys = new List <string>(); foreach (var field in param.fuzzyFields) { fuzzys.Add(string.Format("{0} like '%{1}%'", field.key, field.value)); } if (fuzzys.Count > 0) { whereClause.Add("(" + string.Join((string.IsNullOrEmpty(param.fuzzyFieldOP) ? " AND " : " " + param.fuzzyFieldOP + " "), fuzzys.ToArray()) + ")"); } } /***********************begin 自定义代码*******************/ string sql = PermissionsCategoryView(); if (sql == "user") { whereClause.Add("'0'='1'"); } else if (sql != "admin") { whereClause.Add(sql); } /***********************end 自定义代码*********************/ if (whereClause.Count > 0) { filters.Add("WhereClause", string.Join(" AND ", whereClause.ToArray())); } if (whereClause2.Count > 0) { filters.Add("WhereClause2", string.Join(" AND ", whereClause2.ToArray())); } /**********************************************************/ gridCollectionPager.EasyUIgridDoPage4StringObjectDictionary("EvaluatedReportInfo_ListByPage", filters, param, ref result, null); } catch (Exception ex) { result.Success = false; result.ErrorMessage = ex.Message; } return(result); }
private void _MessageLoopForAccessPoints() { //检测CTI_Call txtObjectId.Text = string.Join(",", accessPointParts.Select(item => item.ObjectId).ToArray()); foreach (var part in accessPointParts) { if (threadsToAccessPoints.ContainsKey(part.ObjectId)) { Thread accessPointThead = threadsToAccessPoints[part.ObjectId] as Thread; if (accessPointThead != null) { if (accessPointThead.IsAlive) { accessPointThead.Abort(); threadsToAccessPoints.Remove(part.ObjectId); } } } threadsToAccessPoints.Add(part.ObjectId, ThreadAdapter.DoCircleTask( () => { if (lbResponseLog.Items.Count > 1000) { lbResponseLog.Items.Clear(); } if (lbResponseLog.Items.Count > 1000) { lbResponseLog.Items.Clear(); } #region 执行任务=》请求objectId对应的AccessPoint string url = part.Url + "/api/share/v1/SendWXMessageSchedule"; this.UIInvoke(() => { lbRequestLog.Items.Add("[" + part.ObjectId + "] " + url + " " + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")); }); HttpAdapter.postSyncAsJSON(url, (result, response) => { if ((bool)result.Success) { lbResponseLog.Items.Insert(0, "[" + part.ObjectId + "] " + result.ret); } else { lbResponseLog.Items.Insert(0, "[" + part.ObjectId + "] ErrorMessage: " + result.ErrorMessage); } }); #endregion }, 1000, () => { return(!isRunning); },//座席没登录则停止 () => { return(false); }//暂时永远不跳过 )); } }
public EasyUIgridCollectionInvokeResult <StringObjectDictionary> ListForEasyUIgridForFlow_ConnectId(string connectId, EasyUIgridCollectionParam <StringObjectDictionary> param) { EasyUIgridCollectionInvokeResult <StringObjectDictionary> result = new EasyUIgridCollectionInvokeResult <StringObjectDictionary> { Success = true }; try { /***********************begin 复杂查询添加代码*********************/ StringObjectDictionary filters = new StringObjectDictionary(); //if (param.instance != null) //{ // filters = param.instance.ToStringObjectDictionary(false); //} List <string> whereClause = new List <string>(); List <string> whereClause2 = new List <string>(); /**********************************************************/ if (param.filterFields != null) { foreach (var field in param.filterFields) { if (field.key != "FlowTo_Start") { filters[field.key] = field.value; } else { if (field.value.Length == 1) { if (filters.ContainsKey("Status")) { filters.Remove("Status"); } whereClause.Add("Status ='1'"); } else if (field.value.Length == 2) { filters["FlowTo"] = field.value; } else if (field.value.Length == 3) { int flowTo = Int32.Parse(field.value.Substring(1)); if (flowTo == 10) { whereClause2.Add("FlowTo <> 10"); } else { whereClause2.Add("FlowFrom between " + (flowTo + 1).ToString() + " and " + (flowTo + 9).ToString()); } } } } } /***********************begin 模糊查询*********************/ if (param.fuzzyFields != null) { List <string> fuzzys = new List <string>(); foreach (var field in param.fuzzyFields) { if (field.key == "Code" && field.value != "") { whereClause.Add(string.Format("ArticleId in (select ArticleId from Pub_ArticleColumn_Relation where Status=1 and ColumnId in( select ColumnId from Pub_ArticleColumn where Status=1 and Menu_Flag=1 and {0} like '{1}%' ))", field.key, field.value)); } else if (field.key.IndexOf("Code") > -1 && field.value == "") { } else { fuzzys.Add(string.Format("{0} like '%{1}%'", field.key, field.value)); } } if (fuzzys.Count > 0) { whereClause.Add("(" + string.Join((string.IsNullOrEmpty(param.fuzzyFieldOP) ? " AND " : " " + param.fuzzyFieldOP + " "), fuzzys.ToArray()) + ")"); } } /***********************end 模糊查询***********************/ /***********************begin 自定义代码*******************/ User currentUser = new User { UserId = NormalSession.UserId.ToGuid(), UserType = NormalSession.UserType }; if (!currentUser.isSuperAdmin()) { IList <GroupMember> groupMemberlist = BuilderFactory.DefaultBulder().List <GroupMember>(new { UserId = NormalSession.UserId }.ToStringObjectDictionary()); List <string> groupIds = new List <string>(); foreach (GroupMember groupMember in groupMemberlist) { groupIds.Add(groupMember.GroupId.ToString()); } whereClause.Add("ArticleId in(select a.ArticleId from Pub_ArticleColumn_Relation a inner join Pub_ArticleColumnPermit b on a.ColumnId=b.ColumnId where b.OBJ_ID in('" + string.Join(",", groupIds.ToArray()) + "'))"); } /***********************end 自定义代码*********************/ if (whereClause.Count > 0) { filters.Add("WhereClause", string.Join(" AND ", whereClause.ToArray())); } if (whereClause2.Count > 0) { filters.Add("WhereClause2", string.Join(" AND ", whereClause2.ToArray())); } /**********************************************************/ gridCollectionPager.EasyUIgridDoPage4StringObjectDictionary("ArticleInfo_ListByPage", filters, param, ref result, connectId); } catch (Exception ex) { result.Success = false; result.ErrorMessage = ex.Message; } return(result); }