private static void GetDepartment2(string id) { GetDepartment model = new GetDepartment(); try { model = DepartmentBll.Get(id); if (model != null) { if (model.errcode == "0") { string json = model.ToJson(); Console.Write("成功:\n" + json); } else { Console.Write(model.errmsg); } } else { Console.Write("无返回数据"); } } catch (Exception ex) { Console.Write(ex.Message); } }
public IActionResult Load(long?ID, long?CompanyId, long?languageID = 1) { GetDepartment operation = new GetDepartment(); operation.ID = ID; operation.CompanyID = CompanyId; if (languageID.HasValue) { operation.LangID = languageID; } else { operation.LangID = 1; } var result = operation.QueryAsync().Result; if (result is ValidationsOutput) { return(Ok(new ApiResult <List <ValidationItem> >() { Data = ((ValidationsOutput)result).Errors })); } else { return(Ok((List <Department>)result)); } }
/// <summary> /// 获取部门详情 /// </summary> /// <param name="id"></param> /// <returns></returns> public static GetDepartment Get(string id) { AccessToken accessToken = TokenHelp.GetAccessToken(); string url = DingTalkUrlHelp.GetDepartment(accessToken.Value, id); GetDepartment model = new GetDepartment(); model = DingTalkHttpHelp <GetDepartment> .Get(url); return(model); }
public async Task <GetDepartment> GetDepartmentForEdit(EntityDto input) { var output = new GetDepartment { }; var persion = _departmentRepository .GetAll().Where(p => p.Id == input.Id).FirstOrDefault(); output.Departments = persion.MapTo <DepartmentListDto>(); return(output); }
private static string GetDepartment(string Id) { GetDepartment model = new GetDepartment(); try { model = DepartmentBll.Get(Id); } catch (Exception ex) { Console.Write(ex.Message); } return(model.ToJson()); }
/// <summary> /// Hämta en specifik avdelning /// </summary> public DepartmentResponse Get(GetDepartment request) { var department = DepartmentRepository.GetDepartment(request.Id); if (department == null) { Response.StatusCode = (int)HttpStatusCode.NotFound; return(null); } return(new DepartmentResponse { Department = department.ConvertTo <DepartmentDTO>() }); }
/// <summary> /// 根据部门名称获取钉钉中的部门信息 /// </summary> /// <param name="name"></param> /// <returns></returns> public static GetDepartment GetByName(string name) { AccessToken accessToken = TokenHelp.GetAccessToken(); GetDepartmentList DepartmentList = GetList(); if (DepartmentList.errcode == 90002) { System.Threading.Thread.Sleep(1500); DepartmentList = GetList(); } var dep = DepartmentList.department.Where(e => e.name.Equals(name)).ToList().FirstOrDefault(); if (dep != null) { GetDepartment model = Get(dep.id); return(model); } else { return(null); } }