//9.1.2 查询集团预定义组 public string QueryCompanyGroup(QChat_Query qchat) { QchatQEDService qqs = new QchatQEDService(); qqs = getQchatQEDService(qchat.username, qchat.password, qchat.deviceID, qchat.urlIp); //查询参数 QueryRequest queryRequest = new QueryRequest(); queryRequest.mainParam = qchat.mainParam; //"xghcnc933731"; //为管理员名称 queryRequest.pageSize = qchat.pageSize; //10; //查询条数,默认为10 queryRequest.startPos = qchat.startPos; //0; //起始位置 QedRequest qedr = new QedRequest(); qedr.queryRequest = queryRequest; QedResponse response = qqs.queryCompanyGroup(qedr); CompanyGroupResponse companyResponse = response.companyGroupResponse; StringBuilder sb = new StringBuilder(); if (companyResponse != null && companyResponse.groupInfo != null) { sb.AppendLine("count:" + companyResponse.count.ToString()); sb.AppendLine("Response:" + companyResponse.response.description.ToString()); sb.AppendLine("reserve:" + companyResponse.response.reserve); sb.AppendLine("returnCode:" + companyResponse.response.returnCode + "\n"); sb.AppendLine("groupInfo: " + companyResponse.groupInfo.ToString()); for (int i = 0; i < companyResponse.groupInfo.Length; i++) { sb.AppendLine("结果" + i); sb.AppendLine("code:" + companyResponse.groupInfo[i].code); sb.AppendLine("domain:" + companyResponse.groupInfo[i].domain); sb.AppendLine("memberCount:" + companyResponse.groupInfo[i].memberCount.ToString()); sb.AppendLine("name:" + companyResponse.groupInfo[i].name); sb.AppendLine("policy:" + companyResponse.groupInfo[i].policy); sb.AppendLine("title: " + companyResponse.groupInfo[i].title); sb.AppendLine("type:" + companyResponse.groupInfo[i].type.ToString()); } } else { sb.AppendLine("返回信息为null"); } Console.WriteLine(sb); //Console.ReadKey(); return(sb.ToString()); }
public CompanyGroupResponse ProcessCompanyGroup(string format, CompanyGroupRequest request) { if (string.IsNullOrEmpty(format)) { format = "JSON"; } switch (format.ToUpper()) { case "XML": { WebOperationContext.Current.OutgoingResponse.Format = WebMessageFormat.Xml; } break; case "JSON": { WebOperationContext.Current.OutgoingResponse.Format = WebMessageFormat.Json; } break; } CompanyGroupResponse retVal = new CompanyGroupResponse(); DBT.TCompanyGroup dbCompanyGroup = new DBT.TCompanyGroup(); if (request == null) { retVal.Success = false; retVal.ErrorHint = "Request is empty"; retVal.TechnicalError = "DataModels.HrTrackServiceModels.CompanyGroup request is null"; return(retVal); } switch (request.Action) { case DataModels.HrTrackServiceModels.ActionType.Create: { DataModels.CompanyGroup dbCompanyGroupItem = Mapper.Map <DataModels.CompanyGroup>(request.CompanyGroupItem); try { dbCompanyGroupItem.GroupGUID = Guid.NewGuid(); var successItem = dbCompanyGroup.CreatCompanyGroup(dbCompanyGroupItem); if (successItem == null) { retVal.ErrorHint = "Failed to create item"; retVal.TechnicalError = "dbCompanyGroup.CreatCompanyGroup(dbCompanyGroupItem); failed."; retVal.Success = false; return(retVal); } retVal.CompanyGroupItemList = new List <CompanyGroupItem>(); retVal.CompanyGroupItemList.Add(Mapper.Map <DataModels.HrTrackServiceModels.CompanyGroupItem>(successItem)); } catch (Exception exc) { retVal.ErrorHint = "Failed to create item"; retVal.TechnicalError = exc.Message; retVal.Success = false; return(retVal); } } break; case DataModels.HrTrackServiceModels.ActionType.GetAll: { try { retVal.CompanyGroupItemList = new List <CompanyGroupItem>(); var dbCompanyGroupList = dbCompanyGroup.GetAllCompanyGroups(); foreach (var item in dbCompanyGroupList) { var res = Mapper.Map <DataModels.HrTrackServiceModels.CompanyGroupItem>(item); retVal.CompanyGroupItemList.Add(res); } } catch (Exception exc) { } } break; } return(retVal); }