public void MixDictionary(StringObjectDictionary sod) { this.MixInWithDictionary(sod); sod.Remove("Id"); sod.Remove("Name"); sod.Remove("IsParent"); attributes = sod.ToJson(); }
public CollectionInvokeResult <ArticleColumn> Query2(string strParms) { CollectionInvokeResult <ArticleColumn> result = new CollectionInvokeResult <ArticleColumn> { Success = true }; try { User currentUser = new User { UserId = NormalSession.UserId.ToGuid(), UserType = NormalSession.UserType }; if (!currentUser.isSuperAdmin()) { var dictionary = new StringObjectDictionary().MixInJson(strParms); string getColumnId; string getGroupId = "select a.GroupId from Pub_Group a,Pub_GroupMember b,Pub_User c where a.GroupId=b.GroupId and b.UserId=c.UserId and c.UserId='" + NormalSession.UserId.ToGuid() + "'"; IList <StringObjectDictionary> groupIds = BuilderFactory.DefaultBulder().ExecuteNativeSqlForQuery(getGroupId); if (groupIds.Count > 0) { IList <ArticleColumn> articleColumnList = new List <ArticleColumn>(); foreach (var groupId in groupIds) { getColumnId = "select distinct a.ColumnId,b.COL_Name,b.OrderNo from Pub_ArticleColumnPermit a,Pub_ArticleColumn b where a.ColumnId=b.ColumnId and a.PermitType=" + dictionary["PermitType"] + " and a.Status=" + dictionary["Status"] + " and b.AreaId='" + dictionary["AreaId"] + "' and OBJ_ID='" + groupId["GroupId"] + "' order by OrderNo asc"; IList <StringObjectDictionary> columnIds = BuilderFactory.DefaultBulder(GetHttpHeader("ConnectId")).ExecuteNativeSqlForQuery(getColumnId); if (columnIds.Count > 0) { foreach (var columnId in columnIds) { if (articleColumnList.Count(s => s.ColumnId == columnId["ColumnId"].ToString().ToGuid()) > 0) { continue; } articleColumnList.Add(new ArticleColumn { ColumnId = columnId["ColumnId"].ToString().ToGuid(), COL_Name = columnId["COL_Name"].ToString() }); } } } result.rows = articleColumnList; } } else { var dictionary = new StringObjectDictionary().MixInJson(strParms); dictionary.Remove("PermitType"); result.rows = BuilderFactory.DefaultBulder(GetHttpHeader("ConnectId")).List <ArticleColumn>(dictionary); } } catch (Exception ex) { result.Success = false; result.ErrorMessage = ex.Message; } return(result); }
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)); } }
public CollectionInvokeResult <ServiceListDaily_All_V> QueryTodayService(ServiceListDaily_All_V serviceListDaily_All_V) { CollectionInvokeResult <ServiceListDaily_All_V> result = new CollectionInvokeResult <ServiceListDaily_All_V> { Success = true }; try { StringObjectDictionary filters = new StringObjectDictionary(); filters = serviceListDaily_All_V.ToStringObjectDictionary(false); List <string> whereClause = new List <string>(); if (!string.IsNullOrEmpty(serviceListDaily_All_V.DoStatus)) { string[] doStatus = serviceListDaily_All_V.DoStatus.Split(','); foreach (var item in doStatus) { whereClause.Add(string.Format(" '{0} '", item.ToString())); } } filters.Add("WhereClause", " DATEDIFF(D,CheckInTime,GETDATE())=0 "); if (whereClause.Count > 0) { filters.Remove("DoStatus"); filters["WhereClause"] += " and DoStatus in(" + string.Join(" , ", whereClause.ToArray()) + ")"; } filters.Add("OrderByClause", " CheckInTime desc "); result.rows = BuilderFactory.DefaultBulder().List <ServiceListDaily_All_V>(filters); } catch (Exception ex) { result.Success = false; result.ErrorMessage = ex.Message; } 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); }