public static Dictionary <string, object> GetCustomerServiceDataByProjectID(int ProjectID) { Dictionary <string, object> dic = null; CustomerService data = null; CustomerService[] dataList = new CustomerService[] { }; var parameters = new List <SqlParameter>(); parameters.Add(new SqlParameter("@ProjectID", ProjectID)); dataList = GetList <CustomerService>("select * from [CustomerService] where ProjectID=@ProjectID", parameters).ToArray(); if (dataList.Length > 0) { data = dataList.FirstOrDefault(p => p.ServiceStatus == 0 || p.ServiceStatus == 3 || p.ServiceStatus == 10); } if (data == null) { return(dic); } dic = new Dictionary <string, object>(); dic["GongDanType"] = ""; if (data.ServiceType1ID > 0) { var type = ServiceType.GetServiceType(data.ServiceType1ID); dic["GongDanType"] = type != null ? type.ServiceTypeName : string.Empty; } dic["GongDanAddTime"] = data.AddTime.ToString("yyyy-MM-dd HH:mm:ss"); dic["GongDanStatusDesc"] = data.ServiceStatusDesc; dic["GongDanRemark"] = ""; var chuLiList = CustomerServiceChuli.GetCustomerServiceChuliList(data.ID); if (chuLiList.Length > 0) { var chuLiData = chuLiList.FirstOrDefault(p => !string.IsNullOrEmpty(p.ChuliNote)); dic["GongDanRemark"] = chuLiData != null ? chuLiData.ChuliNote : ""; } dic["GongDanContent"] = data.ServiceContent; var dataGongDanList = dataList.Where(p => !p.IsSuggestion).ToArray(); var dataTouSuList = dataList.Where(p => p.IsSuggestion).ToArray(); dic["HisotryGongDanCount"] = dataGongDanList.Length; dic["HisotryTouSuCount"] = dataTouSuList.Length; return(dic); }
public static User[] GetAccpetUserListByServiceProjectID(int ProjectID, bool IsAccpetUser = false, bool IsProcessUser = false, int ServerTypeID = 0) { if (ProjectID <= 0) { return(new User[] { }); } List <SqlParameter> parameters = new List <SqlParameter>(); List <string> conditions = new List <string>(); conditions.Add("([Type]=@Type or [IsAllowAPPUserLogin]=1)"); parameters.Add(new SqlParameter("@Type", UserTypeDefine.APPUser.ToString())); if (IsAccpetUser) { ServiceType typeData = null; if (ServerTypeID > 0) { typeData = ServiceType.GetServiceType(ServerTypeID); } bool isAllowLianJie = false; bool isAllowBiaoYang = false; bool isAllowGuiHua = false; if (typeData != null) { isAllowLianJie = !typeData.DisableShenJi; } if (typeData != null && typeData.ServiceTypeName.Equals("建议表扬")) { isAllowBiaoYang = true; } if (typeData != null && typeData.ServiceTypeName.Equals("规划设计")) { isAllowGuiHua = true; } if (isAllowBiaoYang) { conditions.Add("(PositionName='内业' or [PositionName]='客服')"); } else if (isAllowGuiHua) { conditions.Add("([PositionName]='客服')"); } else { string ModuleCode = "1101172"; if (isAllowLianJie) { ModuleCode = "1101171"; } conditions.Add("exists(select 1 from [RoleModule] where ([UserID]=[User].[UserID] or exists(select 1 from [UserRoles] where [RoleID]=[RoleModule].RoleID and [UserID]=[User].[UserID])) and exists(select 1 from [SysMenu] where ID=[RoleModule].[ModuleId] and [ModuleCode]=@ModuleCode))"); parameters.Add(new SqlParameter("@ModuleCode", ModuleCode)); } } if (IsProcessUser) { conditions.Add("exists(select 1 from [RoleModule] where ([UserID]=[User].[UserID] or exists(select 1 from [UserRoles] where [RoleID]=[RoleModule].RoleID and [UserID]=[User].[UserID])) and exists(select 1 from [SysMenu] where ID=[RoleModule].[ModuleId] and [ModuleCode]='1101160'))"); } var allProjectList = new Project[] { }; if (ProjectID > 0) { List <int> ProjectIDList = new List <int>(); ProjectIDList.Add(ProjectID); List <string> cmdlist = new List <string>(); var myProjectIDList = Project.GetProjectIDListbyIDList(ProjectIDList: ProjectIDList); if (myProjectIDList.Length > 0) { conditions.Add("exists(select 1 from [RoleProject] where [ProjectID] in (" + string.Join(",", myProjectIDList) + ") and ([UserID]=[User].UserID or [RoleID] in (select RoleID from [UserRoles] where [UserID]=[User].UserID)))"); } } if (ServerTypeID > 0) { conditions.Add("exists(select 1 from [UserServiceType] where [ServiceTypeID]=@ServiceTypeID and (UserID=[User].[UserID] or exists(select 1 from [UserRoles] where [RoleID]=[UserServiceType].RoleID and [UserID]=[User].UserID)))"); parameters.Add(new SqlParameter("@ServiceTypeID", ServerTypeID)); } conditions.Add("([PositionName]!='400专员' or PositionName is null)"); string sqlText = "select * from [User] where " + string.Join(" and ", conditions.ToArray()); //Utility.LogHelper.WriteDebug("GetAccpetUserListByServiceProjectID.sqlText", sqlText); return(GetList <User>(sqlText, parameters).ToArray()); }