AdminManager.cs 109 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532
  1. using AIPlatform.Protocol.Entities;
  2. using AIPlatform.Protocol.Entities.Ventilator;
  3. using AIPlatform.Protocol.Model;
  4. using System;
  5. using System.Collections.Generic;
  6. using System.IO;
  7. using System.Threading.Tasks;
  8. namespace aipadmin
  9. {
  10. public class AdminManager
  11. {
  12. public static AdminManager Shared { get; }
  13. static AdminManager()
  14. {
  15. Shared = new AdminManager();
  16. }
  17. private AdminAccountSession _session;
  18. private LabelerAccountSession _seniorLabelerSession;
  19. /// <summary>
  20. /// Gets if the admin has been logon.
  21. /// </summary>
  22. public bool HasLogon => _session != null;
  23. /// <summary>
  24. /// Gets if current login admin is root admin.
  25. /// </summary>
  26. public bool IsRoot { get; private set; }
  27. /// <summary>
  28. /// Gets the current session id.
  29. /// </summary>
  30. public AdminAccountSession Session
  31. {
  32. get => _session;
  33. private set
  34. {
  35. if (_session != value)
  36. {
  37. _session = value;
  38. SessionChanged?.Invoke(this, EventArgs.Empty);
  39. }
  40. }
  41. }
  42. /// <summary>
  43. /// Gets the current session id.
  44. /// </summary>
  45. public LabelerAccountSession SeniorLabelerSession
  46. {
  47. get => _seniorLabelerSession;
  48. private set
  49. {
  50. if (_seniorLabelerSession != value)
  51. {
  52. _seniorLabelerSession = value;
  53. }
  54. }
  55. }
  56. /// <summary>
  57. /// Raised when session id changed.
  58. /// </summary>
  59. public event EventHandler SessionChanged;
  60. /// <summary>
  61. /// Login admin to the system,
  62. /// </summary>
  63. /// <param name="name">The name of the admin</param>
  64. /// <param name="password">The password of the admin</param>
  65. /// <returns>The login result.</returns>
  66. public async Task<LoginResultCode> LoginAsync(string name, string password)
  67. {
  68. var result = await ServerProxy.AdminService.LoginAsync(name, password);
  69. if (result.ResultCode == LoginResultCode.Success)
  70. {
  71. _session = result.Session;
  72. IsRoot = _session.IsRoot;
  73. }
  74. else
  75. {
  76. _session = null;
  77. IsRoot = false;
  78. }
  79. return result.ResultCode;
  80. }
  81. /// <summary>
  82. /// SeniorLabeler login to the system to check the labeler statistics
  83. /// </summary>
  84. /// <param name="name">The name of the senior labeler</param>
  85. /// <param name="password">The password of the senior labeler</param>
  86. /// <returns>The login result.</returns>
  87. public async Task<LoginResultCode> SeniorLabelerLoginAsync(string name, string password)
  88. {
  89. var result = await ServerProxy.AdminService.SeniorLabelerLoginAsync(name, password);
  90. if (result.ResultCode == LoginResultCode.Success)
  91. {
  92. _seniorLabelerSession = result.Session;
  93. }
  94. else
  95. {
  96. _session = null;
  97. }
  98. return result.ResultCode;
  99. }
  100. /// <summary>
  101. /// LogOff from the system.
  102. /// </summary>
  103. /// <returns></returns>
  104. public async Task LogOff()
  105. {
  106. await ServerProxy.AdminService.LogOff(_session.Id);
  107. }
  108. /// <summary>
  109. /// Set session manually.
  110. /// </summary>
  111. /// <param name="session">The session to set.</param>
  112. public void SetSession(AdminAccountSession session)
  113. {
  114. if (session == null)
  115. {
  116. _session = null;
  117. IsRoot = false;
  118. }
  119. else
  120. {
  121. _session = session;
  122. IsRoot = _session.IsRoot;
  123. }
  124. }
  125. #region Organization
  126. /// <summary>
  127. /// Get all organizations from system
  128. /// </summary>
  129. /// <returns>The loaded organizations.</returns>
  130. public async Task<List<Organization>> GetOrganizationsAsync()
  131. {
  132. return await ServerProxy.AdminService.GetOrganizationsAsync(_session.Id);
  133. }
  134. /// <summary>
  135. /// Get all organizations from system
  136. /// </summary>
  137. /// <param name="pageIndex">The index of page.</param>
  138. /// <param name="pageSize">The item count per page.</param>
  139. /// <param name="keyword">The searched key word.</param>
  140. /// <returns>The loaded organizations.</returns>
  141. public async Task<List<Organization>> GetOrganizationsAsync(int pageIndex, int pageSize, string keyword)
  142. {
  143. return await ServerProxy.AdminService.GetOrganizationsAsync(_session.Id, pageIndex, pageSize, keyword);
  144. }
  145. /// <summary>
  146. /// Get total organization count.
  147. /// </summary>
  148. /// <param name="keyword">The searched key word.</param>
  149. /// <returns>The organization count.</returns>
  150. public async Task<int> GetOrganizationCountAsync(string keyword)
  151. {
  152. return await ServerProxy.AdminService.GetOrganizationCountAsync(_session.Id, keyword);
  153. }
  154. /// <summary>
  155. /// Create an organization
  156. /// </summary>
  157. /// <param name="name">The name of the organization.</param>
  158. /// <param name="description">The description of the organization.</param>
  159. /// <returns></returns>
  160. public async Task<Organization> CreateOrganizationAsync(string name, string description, List<AuthorityBase> authorities, List<SupportedDataType> supportedDataTypes)
  161. {
  162. return await ServerProxy.AdminService.CreateOrganizationAsync(_session.Id, name, description, authorities, supportedDataTypes);
  163. }
  164. /// <summary>
  165. /// Delete an organization from the system.
  166. /// </summary>
  167. /// <returns>Void</returns>
  168. public async Task DeleteOrganizationAsync(long id)
  169. {
  170. await ServerProxy.AdminService.DeleteOrganizationAsync(_session.Id, id);
  171. }
  172. /// <summary>
  173. /// Check whether there are children in the organization.
  174. /// </summary>
  175. /// <param name="id">The id of organization.</param>
  176. /// <returns>The loaded organizations.</returns>
  177. public async Task<bool> ExistOrganizationChildrenAsync(long id)
  178. {
  179. return await ServerProxy.AdminService.ExistOrganizationChildrenAsync(_session.Id, id);
  180. }
  181. /// <summary>
  182. /// 检查组织下是否已绑定用户
  183. /// </summary>
  184. /// <param name="organizationId"></param>
  185. /// <returns></returns>
  186. public async Task<bool> ExistAccountByOrganizationAsync(long organizationId)
  187. {
  188. return await ServerProxy.AdminService.ExistAccountByOrganizationAsync(_session.Id, organizationId);
  189. }
  190. /// <summary>
  191. /// Update one organization.
  192. /// </summary>
  193. /// <param name="id">The id of organization.</param>
  194. /// <param name="description">The description of the organization.</param>
  195. /// <returns>Void</returns>
  196. public async Task UpdateOrganizationAsync(long id, string description, List<AuthorityBase> authorities, List<SupportedDataType> supportedDataTypes)
  197. {
  198. await ServerProxy.AdminService.UpdateOrganizationAsync(_session.Id, id, description, authorities, supportedDataTypes);
  199. }
  200. #endregion Organization
  201. #region 机构管理
  202. /// <summary>
  203. /// Get the Institution from system
  204. /// </summary>
  205. /// <returns>The loaded Institution.</returns>
  206. public async Task<Institution> GetInstitutionAsync(long id)
  207. {
  208. return await ServerProxy.AdminService.GetInstitutionAsync(_session.Id, id);
  209. }
  210. /// <summary>
  211. /// Get the Institutions by organizationId
  212. /// </summary>
  213. /// <returns>The loaded Institutions.</returns>
  214. public async Task<List<Institution>> GetInstitutionsByOrganizationIdAsync(long organizationId)
  215. {
  216. return await ServerProxy.AdminService.GetInstitutionsByOrganizationIdAsync(_session.Id, organizationId);
  217. }
  218. /// <summary>
  219. /// Get all Institutions from system
  220. /// </summary>
  221. /// <param name="pageIndex">The index of page.</param>
  222. /// <param name="pageSize">The item count per page.</param>
  223. /// <param name="keyword">The searched key word.</param>
  224. /// <returns>The loaded Institutions.</returns>
  225. public async Task<List<Institution>> GetInstitutionsAsync(int pageIndex, int pageSize, string keyword)
  226. {
  227. return await ServerProxy.AdminService.GetInstitutionsAsync(_session.Id, pageIndex, pageSize, keyword);
  228. }
  229. /// <summary>
  230. /// Get total Institution count.
  231. /// </summary>
  232. /// <param name="keyword">The searched key word.</param>
  233. /// <returns>The Institution count.</returns>
  234. public async Task<int> GetInstitutionCountAsync(string keyword)
  235. {
  236. return await ServerProxy.AdminService.GetInstitutionCountAsync(_session.Id, keyword);
  237. }
  238. /// <summary>
  239. /// Create the Institution
  240. /// </summary>
  241. /// <param name="name">The name of the Institution.</param>
  242. /// <param name="description">The description of the Institution.</param>
  243. /// <returns></returns>
  244. public async Task<Institution> CreateInstitutionAsync(string name, string description, List<EntityBase> organizations, InstitutionType type, bool isPaid)
  245. {
  246. return await ServerProxy.AdminService.CreateInstitutionAsync(_session.Id, name, description, organizations, type, isPaid);
  247. }
  248. /// <summary>
  249. /// Delete the Institution from the system.
  250. /// </summary>
  251. /// <returns>Void</returns>
  252. public async Task DeleteInstitutionAsync(long id)
  253. {
  254. await ServerProxy.AdminService.DeleteInstitutionAsync(_session.Id, id);
  255. }
  256. /// <summary>
  257. /// Update the Institution.
  258. /// </summary>
  259. /// <param name="id">The id of Institution.</param>
  260. /// <param name="description">The description of the Institution.</param>
  261. /// <returns>Void</returns>
  262. public async Task UpdateInstitutionAsync(long id, string description, List<EntityBase> organizations, InstitutionType type, bool isPaid)
  263. {
  264. await ServerProxy.AdminService.UpdateInstitutionAsync(_session.Id, id, description, organizations, type, isPaid);
  265. }
  266. /// <summary>
  267. /// 检查机构下是否已绑定用户
  268. /// </summary>
  269. /// <param name="sessionId"></param>
  270. /// <param name="institutionId"></param>
  271. /// <returns></returns>
  272. /// <exception cref="InvalidOperationException"></exception>
  273. public async Task<bool> ExistAccountByInstitutionIdAsync(long institutionId)
  274. {
  275. return await ServerProxy.AdminService.ExistAccountByInstitutionIdAsync(_session.Id, institutionId);
  276. }
  277. #endregion 机构管理
  278. #region admin
  279. /// <summary>
  280. /// Get all admins from system
  281. /// </summary>
  282. /// <returns>The loaded admins.</returns>
  283. public async Task<List<Account>> GetAccountsAsync(Role role = Role.None)
  284. {
  285. return await ServerProxy.AdminService.GetAccountsAsync(_session.Id, role);
  286. }
  287. /// <summary>
  288. /// Get total labeler count.
  289. /// </summary>
  290. /// <param name="keyword">The searched keyword.</param>
  291. /// <returns>The developer count.</returns>
  292. public async Task<int> GetAccountCountAsync(string keyword, long organizationId, long institutionId, Role role = Role.None)
  293. {
  294. return await ServerProxy.AdminService.GetAccountCountAsync(_session.Id, keyword, organizationId, institutionId, role);
  295. }
  296. /// <summary>
  297. /// Get all admins from system
  298. /// </summary>
  299. /// <param name="pageIndex">The index of page.</param>
  300. /// <param name="pageSize">The item count per page.</param>
  301. /// <param name="keyword">The searched key word.</param>
  302. /// <returns>The loaded admins.</returns>
  303. public async Task<List<Account>> GetAccountsAsync(int pageIndex, int pageSize, string keyword, long organizationId, long institutionId, Role role = Role.None)
  304. {
  305. return await ServerProxy.AdminService.GetAccountsAsync(_session.Id, pageIndex, pageSize, keyword, organizationId, institutionId, role);
  306. }
  307. /// <summary>
  308. /// Create a admin
  309. /// </summary>
  310. /// <param name="name">The name of the admin.</param>
  311. /// <param name="fullName">The full name of the admin.</param>
  312. /// <param name="password">The password of the admin account.</param>
  313. /// <returns></returns>
  314. public async Task<Account> CreateAccountAsync(string name, string fullName, string password, List<EntityBase> organizations, List<Role> roles, List<AuthorityBase> authorities,
  315. DeveloperAuthorityInfo developerAuthorityInfo, LabelerAuthorityInfo labelerAuthorityInfo, int handyToolExportDelay, long institutionId)
  316. {
  317. return await ServerProxy.AdminService.CreateAccountAsync(_session.Id, name, fullName, password, organizations, roles, authorities, developerAuthorityInfo, labelerAuthorityInfo, handyToolExportDelay, institutionId);
  318. }
  319. /// <summary>
  320. /// Delete a admin from the system.
  321. /// </summary>
  322. /// <returns>Void</returns>
  323. public async Task DeleteAccountAsync(long id)
  324. {
  325. await ServerProxy.AdminService.DeleteAccountAsync(_session.Id, id);
  326. }
  327. /// <summary>
  328. /// Update one admin.
  329. /// </summary>
  330. /// <param name="id"></param>
  331. /// <returns></returns>
  332. public async Task UpdateAccountAsync(long id, string fullName, List<EntityBase> organizations, List<Role> roles, List<AuthorityBase> authorities,
  333. DeveloperAuthorityInfo developerAuthorityInfo, LabelerAuthorityInfo labelerAuthorityInfo, int handyToolExportDelay, long institutionId)
  334. {
  335. await ServerProxy.AdminService.UpdateAccountAsync(_session.Id, id, fullName, organizations, roles, authorities, developerAuthorityInfo, labelerAuthorityInfo, handyToolExportDelay, institutionId);
  336. }
  337. /// <summary>
  338. /// Update one admin password.
  339. /// </summary>
  340. /// <param name="id">The id of admin to handle.</param>
  341. /// <param name="password">The password of the admin.</param>
  342. /// <returns>Void</returns>
  343. public async Task UpdateAccountPasswordAsync(long id, string password)
  344. {
  345. await ServerProxy.AdminService.UpdateAccountPasswordAsync(_session.Id, id, password);
  346. }
  347. /// <summary>
  348. /// Get the admin by admin id.
  349. /// </summary>
  350. /// <param name="adminId">The id of the admin</param>
  351. /// <returns>The admin</returns>
  352. public async Task<Account> GetAccountAsync(long adminId)
  353. {
  354. return await ServerProxy.AdminService.GetAccountAsync(_session.Id, adminId);
  355. }
  356. #endregion admin
  357. #region developer
  358. /// <summary>
  359. /// Get all developers from system
  360. /// </summary>
  361. /// <returns>The loaded developers.</returns>
  362. public async Task<List<DeveloperAccount>> GetDevelopersAsync()
  363. {
  364. return await ServerProxy.AdminService.GetDevelopersAsync(_session.Id);
  365. }
  366. /// <summary>
  367. /// Get all developers from system
  368. /// </summary>
  369. /// <param name="pageIndex">The index of page.</param>
  370. /// <param name="pageSize">The item count per page.</param>
  371. /// <param name="keyword">The searched key word.</param>
  372. /// <returns>The loaded developers.</returns>
  373. public async Task<List<DeveloperAccount>> GetDevelopersAsync(int pageIndex, int pageSize, string keyword)
  374. {
  375. return await ServerProxy.AdminService.FindDevelopersAsync(_session.Id, keyword, pageIndex, pageSize);
  376. }
  377. /// <summary>
  378. /// Get total developer count.
  379. /// </summary>
  380. /// <param name="keyword">The searched key word.</param>
  381. /// <returns>The developer count.</returns>
  382. public async Task<int> GetDeveloperCountAsync(string keyword)
  383. {
  384. return await ServerProxy.AdminService.GetDeveloperCountAsync(_session.Id, keyword);
  385. }
  386. /// <summary>
  387. /// Create a developer
  388. /// </summary>
  389. /// <param name="name">The name of the developer.</param>
  390. /// <param name="fullName">The full name of the developer.</param>
  391. /// <param name="password">The password of the developer account.</param>
  392. /// <returns></returns>
  393. public async Task<DeveloperAccount> CreateDeveloperAsync(string name, string fullName, string password, DateTime expireTime, List<EntityBase> organizations)
  394. {
  395. return await ServerProxy.AdminService.CreateDeveloperAsync(_session.Id, name, fullName, password, expireTime, organizations);
  396. }
  397. /// <summary>
  398. /// Delete a developer from the system.
  399. /// </summary>
  400. /// <param name="id">The if of developer to delete.</param>
  401. /// <returns>Void</returns>
  402. public async Task DeleteDeveloperAsync(long id)
  403. {
  404. await ServerProxy.AdminService.DeleteDeveloperAsync(_session.Id, id);
  405. }
  406. /// <summary>
  407. /// Create a work token for the developer.
  408. /// </summary>
  409. /// <param name="developer">The developer to handle.</param>
  410. /// <param name="expireTime">The token expire time.</param>
  411. /// <returns>Void</returns>
  412. public async Task CreateWorkTokenAsync(DeveloperAccount developer, DateTime expireTime)
  413. {
  414. await ServerProxy.AdminService.CreateTokenAsync(_session.Id, developer.Id, expireTime);
  415. }
  416. /// <summary>
  417. /// Delete work token.
  418. /// </summary>
  419. /// <param name="developer">The developer to handle.</param>
  420. /// <returns></returns>
  421. public async Task DeleteWorkTokenAsync(DeveloperAccount developer)
  422. {
  423. await ServerProxy.AdminService.DeleteWorkTokenAsync(_session.Id, developer.Id);
  424. }
  425. /// <summary>
  426. /// Update one developer account.
  427. /// </summary>
  428. /// <param name="id">The id of developer to handle.</param>
  429. /// <param name="fullName">The full name of the developer.</param>
  430. /// <param name="expireTime">The token expire time.</param>
  431. /// <returns>Void</returns>
  432. public async Task UpdateDeveloperAsync(long id, string fullName, DateTime expireTime, List<EntityBase> organizations)
  433. {
  434. await ServerProxy.AdminService.UpdateDeveloperAsync(_session.Id, id, fullName, expireTime, organizations);
  435. }
  436. /// <summary>
  437. /// Update one developer password.
  438. /// </summary>
  439. /// <param name="id">The id of developer to handle.</param>
  440. /// <param name="password">The password of the developer.</param>
  441. /// <returns>Void</returns>
  442. public async Task UpdateDeveloperPasswordAsync(long id, string password)
  443. {
  444. await ServerProxy.AdminService.UpdateDeveloperPasswordAsync(_session.Id, id, password);
  445. }
  446. #endregion developer
  447. #region labeler
  448. /// <summary>
  449. /// Get total labeler count.
  450. /// </summary>
  451. /// <param name="keyword">The searched keyword.</param>
  452. /// <returns>The developer count.</returns>
  453. public async Task<int> GetLabelerCountAsync(string keyword, long organizationId, long institutionId)
  454. {
  455. return await ServerProxy.AdminService.GetAccountCountAsync(_session.Id, keyword, organizationId, institutionId, Role.Labeler);
  456. }
  457. /// <summary>
  458. /// Get total labeler count.
  459. /// </summary>
  460. /// <param name="keyword">The searched keyword.</param>
  461. /// <param name="start">The start time.</param>
  462. /// <param name="end">The end time.</param>
  463. /// <returns>The developer count.</returns>
  464. public async Task<int> GetLabelerCountAsync(string keyword, DateTime start, DateTime end)
  465. {
  466. return await ServerProxy.AdminService.GetLabelerCountAsync(_session.Id, keyword, start, end);
  467. }
  468. /// <summary>
  469. /// Get labeled case count.
  470. /// </summary>
  471. /// <param name="keyword">The searched keyword.</param>
  472. /// <param name="start">The start time.</param>
  473. /// <param name="end">The end time.</param>
  474. /// <returns>The labeled case count</returns>
  475. public async Task<int> GetSameBatchLabelCaseCountAsync(long organizationId, long imageCategoryId, string keyword, DateTime start = new DateTime(), DateTime end = new DateTime(), DateTime updateStart = new DateTime(), DateTime updateEnd = new DateTime())
  476. {
  477. return await ServerProxy.AdminService.GetSameBatchLabelCaseCountAsync(_session.Id, organizationId, imageCategoryId, keyword, start, end, updateStart, updateEnd);
  478. }
  479. /// <summary>
  480. /// Get all developers from system
  481. /// </summary>
  482. /// <param name="pageIndex">The index of page.</param>
  483. /// <param name="pageSize">The item count per page.</param>
  484. /// <param name="keyword">The searched keyword.</param>
  485. /// <returns>The loaded developers.</returns>
  486. public async Task<List<LabelerAccount>> GetLabelersAsync(int pageIndex, int pageSize, string keyword)
  487. {
  488. return await ServerProxy.AdminService.GetLabelersAsync(_session.Id, keyword, pageIndex, pageSize);
  489. }
  490. /// <summary>
  491. /// Get all developers from system
  492. /// </summary>
  493. /// <param name="pageIndex">The index of page.</param>
  494. /// <param name="pageSize">The item count per page.</param>
  495. /// <param name="keyword">The searched keyword.</param>
  496. /// <param name="start">The start time.</param>
  497. /// <param name="end">The end time.</param>
  498. /// <returns>The loaded developers.</returns>
  499. public async Task<List<LabelerAccount>> GetLabelersAsync(int pageIndex, int pageSize, string keyword, DateTime start, DateTime end)
  500. {
  501. return await ServerProxy.AdminService.GetLabelersAsync(_session.Id, keyword, pageIndex, pageSize, start, end);
  502. }
  503. /// <summary>
  504. /// Create a labeler
  505. /// </summary>
  506. /// <param name="name">The name of the labeler</param>
  507. /// <param name="fullName">The full name of the labeler</param>
  508. /// <param name="password">The password of the labeler</param>
  509. /// <param name="comeFrom">where the labeler come from</param>
  510. /// <param name="qualification">The qualification of the labeler</param>
  511. /// <param name="seniorLabeler">The teacher of the labeler</param>
  512. /// <param name="organizations">The organizations of the labeler</param>
  513. /// <returns></returns>
  514. public async Task<LabelerAccount> CreateLabelerAsync(string name, string fullName, string password, string comeFrom, string qualification, bool isRemote, EntityBase seniorLabeler, List<EntityBase> organizations)
  515. {
  516. return await ServerProxy.AdminService.CreateLabelerAsync(_session.Id, name, fullName, password, comeFrom, qualification, isRemote, seniorLabeler, organizations);
  517. }
  518. /// <summary>
  519. /// Delete a labeler from the system.
  520. /// </summary>
  521. /// <returns>Void</returns>
  522. public async Task DeleteLabelerAsync(long id)
  523. {
  524. await ServerProxy.AdminService.DeleteLabelerAsync(_session.Id, id);
  525. }
  526. /// <summary>
  527. /// Update a labeler
  528. /// </summary>
  529. /// <param name="id">The id of the labeler</param>
  530. /// <param name="fullName">The full name of the labeler</param>
  531. /// <param name="comeFrom">where the labeler come from</param>
  532. /// <param name="qualification">The qualification of the labeler</param>
  533. /// <param name="seniorLabeler">The teacher of the labeler</param>
  534. /// <param name="organizations">The organizations of the labeler</param>
  535. /// <returns></returns>
  536. public async Task UpdateLabelerAsync(long id, string fullName, string comeFrom, string qualification, bool isRemote, EntityBase seniorLabeler, List<EntityBase> organizations)
  537. {
  538. await ServerProxy.AdminService.UpdateLabelerAsync(_session.Id, id, fullName, comeFrom, qualification, isRemote, seniorLabeler, organizations);
  539. }
  540. /// <summary>
  541. /// Update a labeler password.
  542. /// </summary>
  543. /// <param name="id">The id of labeler to handle.</param>
  544. /// <param name="password">The password of the labeler.</param>
  545. /// <returns>Void</returns>
  546. public async Task UpdateLabelerPasswordAsync(long id, string password)
  547. {
  548. await ServerProxy.AdminService.UpdateLabelerPasswordAsync(_session.Id, id, password);
  549. }
  550. #endregion labeler
  551. #region images
  552. /// <summary>
  553. /// Get group count by imageCategoryId.
  554. /// </summary>
  555. /// <param name="imageCategoryId">The id of image category.</param>
  556. /// <returns>The group count.</returns>
  557. public async Task<int> GetUltrasoundGroupCountAsync(long imageCategoryId, string keyword = null)
  558. {
  559. return await ServerProxy.AdminService.GetUltrasoundGroupCountAsync(_session.Id, imageCategoryId, keyword);
  560. }
  561. /// <summary>
  562. /// Get the labeled group count by imageCategoryId
  563. /// </summary>
  564. /// <param name="imageCategoryId">The image category id to handle.</param>
  565. /// <returns>The labeled group count.</returns>
  566. public async Task<int> GetLabeledGroupCountAsync(long imageCategoryId, string keyword = null)
  567. {
  568. return await ServerProxy.AdminService.GetLabeledGroupCountAsync(_session.Id, imageCategoryId, keyword);
  569. }
  570. /// <summary>
  571. /// Get the un-labeled group count by imageCategoryId
  572. /// </summary>
  573. /// <param name="imageCategoryId">The image category id to handle.</param>
  574. /// <returns>The un-labeled group count.</returns>
  575. public async Task<int> GetUnLabeledGroupCountAsync(long imageCategoryId, string keyword = null)
  576. {
  577. return await ServerProxy.AdminService.GetUnLabeledGroupCountAsync(_session.Id, imageCategoryId, keyword);
  578. }
  579. /// <summary>
  580. /// Get gold standard group count by imageCategoryId
  581. /// </summary>
  582. /// <param name="imageCategoryId">The id of image category.</param>
  583. /// <returns>The group count.</returns>
  584. public async Task<int> GetGoldStandardGroupCountAsync(long imageCategoryId, string keyword)
  585. {
  586. return await ServerProxy.AdminService.GetGoldStandardGroupCountAsync(_session.Id, imageCategoryId, keyword);
  587. }
  588. /// <summary>
  589. /// Get the labeled file count by tag
  590. /// </summary>
  591. /// <param name="imageCategoryId">The image category id to handle.</param>
  592. /// <returns>The labeled file count.</returns>
  593. public async Task<int> GetLabeledFileCountAsync(long imageCategoryId, string keyword = null)
  594. {
  595. return await ServerProxy.AdminService.GetLabeledFileCountAsync(_session.Id, imageCategoryId, keyword);
  596. }
  597. /// <summary>
  598. /// Get the un-labeled file count by tag
  599. /// </summary>
  600. /// <param name="imageCategoryId">The image category id to handle.</param>
  601. /// <returns>The un-labeled file count.</returns>
  602. public async Task<int> GetUnLabeledFileCountAsync(long imageCategoryId, string keyword = null)
  603. {
  604. return await ServerProxy.AdminService.GetUnLabeledFileCountAsync(_session.Id, imageCategoryId, keyword);
  605. }
  606. /// <summary>
  607. /// Get image count by imageCategoryId.
  608. /// </summary>
  609. /// <param name="imageCategoryId">The id of image category.</param>
  610. /// <returns>The image count.</returns>
  611. public async Task<int> GetUltrasoundFileCountAsync(long imageCategoryId, string keyword = null)
  612. {
  613. return await ServerProxy.AdminService.GetUltrasoundFileCountAsync(_session.Id, imageCategoryId, keyword);
  614. }
  615. /// <summary>
  616. /// Get gold standard image count by imageCategoryId
  617. /// </summary>
  618. /// <param name="imageCategoryId">The id of image category.</param>
  619. /// <returns>The image count.</returns>
  620. public async Task<int> GetGoldStandardFileCountAsync(long imageCategoryId, string keyword)
  621. {
  622. return await ServerProxy.AdminService.GetGoldStandardFileCountAsync(_session.Id, imageCategoryId, keyword);
  623. }
  624. /// <summary>
  625. /// Get un-gold standard image count by imageCategoryId
  626. /// </summary>
  627. /// <param name="imageCategoryId">The id of image category.</param>
  628. /// <returns>The image count.</returns>
  629. public async Task<int> GetUnGoldStandardFileCountAsync(long imageCategoryId, string keyword)
  630. {
  631. return await ServerProxy.AdminService.GetUnGoldStandardFileCountAsync(_session.Id, imageCategoryId, keyword);
  632. }
  633. /// <summary>
  634. /// Get the labeled file count by tag
  635. /// </summary>
  636. /// <param name="imageCategoryId">The image category id to handle.</param>
  637. /// <returns>The labeled file count.</returns>
  638. public async Task<int> GetDisputeLabeledFileCountAsync(long imageCategoryId, string keyword = null, bool isAssign = false, string keyWordLabele = null)
  639. {
  640. return await ServerProxy.AdminService.GetDisputeLabeledFileCountAsync(_session.Id, imageCategoryId, keyword, isAssign, keyWordLabele);
  641. }
  642. /// <summary>
  643. /// Get files by ultrasoundGroupId
  644. /// </summary>
  645. /// <param name="imageCategoryId">The id of image category.</param>
  646. /// <param name="ultrasoundGroupId">The id of ultrasound group.</param>
  647. /// <returns>The loaded files.</returns>
  648. public async Task<List<PreviewFileModel>> GetUltrasoundFilesByGroupIdAsync(long imageCategoryId, long ultrasoundGroupId)
  649. {
  650. return await ServerProxy.AdminService.GetUltrasoundFilesByGroupIdAsync(_session.Id, imageCategoryId, ultrasoundGroupId);
  651. }
  652. /// <summary>
  653. /// Get images by imageCategoryId
  654. /// </summary>
  655. /// <param name="imageCategoryId">The id of image category.</param>
  656. /// <param name="pageIndex">The index of the page.</param>
  657. /// <param name="pageSize">The item count per page.</param>
  658. /// <returns>The loaded files.</returns>
  659. public async Task<List<PreviewFileModel>> GetUltrasoundFilesInGroupAsync(long imageCategoryId, string keyword, int pageIndex, int pageSize)
  660. {
  661. return await ServerProxy.AdminService.GetUltrasoundFilesInGroupAsync(_session.Id, imageCategoryId, keyword, pageIndex, pageSize);
  662. }
  663. /// <summary>
  664. /// Get latest labeled files by imageCategoryId
  665. /// </summary>
  666. /// <param name="imageCategoryId">The id of image category.</param>
  667. /// <param name="pageIndex">The index of the page.</param>
  668. /// <param name="pageSize">The item count per page.</param>
  669. /// <returns>The loaded files.</returns>
  670. public async Task<List<PreviewFileModel>> GetLatestLabeledFilesInGroupAsync(long imageCategoryId, string keyword, int pageIndex, int pageSize)
  671. {
  672. return await ServerProxy.AdminService.GetLatestLabeledFilesInGroupAsync(_session.Id, imageCategoryId, keyword, pageIndex, pageSize);
  673. }
  674. /// <summary>
  675. /// Get unlabeled files by imageCategoryId
  676. /// </summary>
  677. /// <param name="imageCategoryId">The id of image category.</param>
  678. /// <param name="pageIndex">The index of the page.</param>
  679. /// <param name="pageSize">The item count per page.</param>
  680. /// <returns>The loaded files.</returns>
  681. public async Task<List<PreviewFileModel>> GetUnLabeledFilesInGroupAsync(long imageCategoryId, string keyword, int pageIndex, int pageSize)
  682. {
  683. return await ServerProxy.AdminService.GetUnLabeledFilesInGroupAsync(_session.Id, imageCategoryId, keyword, pageIndex, pageSize);
  684. }
  685. /// <summary>
  686. /// Get gold standard images by imageCategoryId
  687. /// </summary>
  688. /// <param name="imageCategoryId">The id of image category.</param>
  689. /// <param name="pageIndex">The index of the page.</param>
  690. /// <param name="pageSize">The item count per page.</param>
  691. /// <returns>The loaded files.</returns>
  692. public async Task<List<PreviewFileModel>> GetGoldStandardFilesInGroupAsync(long imageCategoryId, string keyword, int pageIndex, int pageSize)
  693. {
  694. return await ServerProxy.AdminService.GetGoldStandardFilesInGroupAsync(_session.Id, imageCategoryId, keyword, pageIndex, pageSize);
  695. }
  696. /// <summary>
  697. /// Get labeled files by imageCategoryId
  698. /// </summary>
  699. /// <param name="imageCategoryId">The id of image category.</param>
  700. /// <param name="pageIndex">The index of the page.</param>
  701. /// <param name="pageSize">The item count per page.</param>
  702. /// <returns>The loaded files.</returns>
  703. public async Task<List<LabeledUltrasoundFile>> GetLabeledFilesAsync(long imageCategoryId, int pageIndex, int pageSize)
  704. {
  705. return await ServerProxy.AdminService.GetLabeledFilesAsync(_session.Id, imageCategoryId, pageIndex, pageSize);
  706. }
  707. /// <summary>
  708. /// Get latest labeled files by imageCategoryId/
  709. /// </summary>
  710. /// <param name="imageCategoryId">The id of image category.</param>
  711. /// <param name="pageIndex">The index of the page.</param>
  712. /// <param name="pageSize">The item count per page.</param>
  713. /// <returns>The loaded files.</returns>
  714. public async Task<List<PreviewFileModel>> GetDisputeUltrasoundFilesAsync(long imageCategoryId, string keyword, int pageIndex, int pageSize, bool isAssign, string keyWordLabele)
  715. {
  716. return await ServerProxy.AdminService.GetDisputeLabeledFilesAsync(_session.Id, imageCategoryId, keyword, pageIndex, pageSize, isAssign, keyWordLabele);
  717. }
  718. /// <summary>
  719. /// Get all labeler infos in the ultrasound file.
  720. /// </summary>
  721. /// <param name="ultrasoundFileId">The id of ultrasound file.</param>
  722. /// <param name="imageCategoryId">The id of image category.</param>
  723. /// <returns></returns>
  724. public async Task<List<LabelerInfo>> GetLabelerInfosAsync(long ultrasoundFileId, long imageCategoryId)
  725. {
  726. return await ServerProxy.AdminService.GetLabelerInfosAsync(_session.Id, ultrasoundFileId, imageCategoryId);
  727. }
  728. /// <summary>
  729. /// Get the latest labeled file info for one source image by labeledUltrasoundFileId.
  730. /// </summary>
  731. /// <returns>found ultrasound image</returns>
  732. public async Task<LabeledUltrasoundFileInfo> GetLatestLabeledUltrasoundFileInfoAsync(long labeledUltrasoundFileId)
  733. {
  734. return await ServerProxy.AdminService.GetLatestLabeledUltrasoundFileInfoAsync(_session.Id, labeledUltrasoundFileId);
  735. }
  736. /// <summary>
  737. /// Get labeled files except gold standard by ultrasound image id.
  738. /// </summary>
  739. /// <param name="ultrasoundFileId">The id of ultrasound file.</param>
  740. /// <returns>The loaded files.</returns>
  741. public async Task<List<LabeledUltrasoundFileInfo>> GetLabeledFilesByUltrasoundFileIdAsync(long ultrasoundFileId, long imageCategoryId)
  742. {
  743. return await ServerProxy.AdminService.GetLabeledUltrasoundFilesByUltrasoundFileIdAsync(_session.Id, ultrasoundFileId, imageCategoryId);
  744. }
  745. /// <summary>
  746. /// Get labeled files except gold standard by ultrasound image id.
  747. /// </summary>
  748. /// <param name="ultrasoundFileId">The id of ultrasound file.</param>
  749. /// <returns>The loaded files.</returns>
  750. public async Task<int> GetLabeledFilesCountByUltrasoundFileIdAsync(long ultrasoundFileId)
  751. {
  752. return await ServerProxy.AdminService.GetLabeledUltrasoundFilesCountByUltrasoundFileIdAsync(_session.Id, ultrasoundFileId);
  753. }
  754. /// <summary>
  755. /// Delete ultrasound image from the system.
  756. /// </summary>
  757. /// <param name="ultrasoundFileId">The id of the ultrasound image.</param>
  758. /// <returns></returns>
  759. public async Task DeleteUltrasoundFileAsync(long ultrasoundFileId)
  760. {
  761. await ServerProxy.AdminService.DeleteUltrasoundFileAsync(_session.Id, ultrasoundFileId);
  762. }
  763. /// <summary>
  764. /// Delete labeled ultrasound image from the system.
  765. /// </summary>
  766. /// <param name="labeledUltrasoundFileId">The id of the ultrasound image.</param>
  767. /// <returns></returns>
  768. public async Task DeleteLabeledUltrasoundFileAsync(long labeledUltrasoundFileId)
  769. {
  770. await ServerProxy.AdminService.DeleteLabeledUltrasoundFileAsync(_session.Id, labeledUltrasoundFileId);
  771. }
  772. /// <summary>
  773. /// Delete all labeled ultrasound image for one ultrasound image by the ultrasound image id.
  774. /// </summary>
  775. /// <param name="ultrasoundFileId">The id of the ultrasound image.</param>
  776. /// <returns></returns>
  777. public async Task DeleteAllLabeledUltrasoundFilesByUltrasoundFileIdAsync(long ultrasoundFileId)
  778. {
  779. await ServerProxy.AdminService.DeleteAllLabeledUltrasoundFilesByUltrasoundFileIdAsync(_session.Id, ultrasoundFileId);
  780. }
  781. /// <summary>
  782. /// Update labeled ultrasound image.
  783. /// </summary>
  784. /// <param name="labeledUltrasoundFileId">The id of the ultrasound image.</param>
  785. /// <param name="isGoldStandard">The value to indicate whether the labeled file is gold standard or not.</param>
  786. /// <returns></returns>
  787. public async Task UpdateLabeledUltrasoundFileAsync(long labeledUltrasoundFileId, bool isGoldStandard)
  788. {
  789. await ServerProxy.AdminService.UpdateLabeledUltrasoundFileAsync(_session.Id, labeledUltrasoundFileId, isGoldStandard);
  790. }
  791. /// <summary>
  792. /// Update labeled ultrasound image's is adoptable state.
  793. /// </summary>
  794. /// <param name="labeledUltrasoundFileId">The id of the ultrasound image.</param>
  795. /// <param name="isAdoptable">The value to indicate whether the labeled file is adoptable or not.</param>
  796. /// <returns></returns>
  797. public async Task UpdateLabeledUltrasoundFileIsAdoptableAsync(long labeledUltrasoundFileId, bool isAdoptable)
  798. {
  799. await ServerProxy.AdminService.UpdateLabeledUltrasoundFileIsAdoptableAsync(_session.Id, labeledUltrasoundFileId, isAdoptable);
  800. }
  801. /// <summary>
  802. /// Get archived image by archived image id.
  803. /// </summary>
  804. /// <param name="archivedImageId">The id of the archived image.</param>
  805. /// <returns>The found archived image.</returns>
  806. public async Task<ArchivedImage> GetArchivedImageAsync(long archivedImageId)
  807. {
  808. return await ServerProxy.AdminService.GetArchivedImageAsync(_session.Id, archivedImageId);
  809. }
  810. /// <summary>
  811. /// Get the labeled result by id.
  812. /// </summary>
  813. /// <param name="id"></param>
  814. /// <returns></returns>
  815. public async Task<LabeledResult> GetLabeledResultAsync(long id)
  816. {
  817. return await ServerProxy.AdminService.GetLabeledResultAsync(_session.Id, id);
  818. }
  819. /// <summary>
  820. /// Get un-assigned image count.
  821. /// </summary>
  822. /// <param name="imageCategoryId">The id of the tag.</param>
  823. /// <returns>The image's count.</returns>
  824. public async Task<int> GetUnAssignedImageCountAsync(long imageCategoryId)
  825. {
  826. return await ServerProxy.AdminService.GetUnAssignedImageCountAsync(_session.Id, imageCategoryId);
  827. }
  828. /// <summary>
  829. /// Get un-adoptable image count.
  830. /// </summary>
  831. /// <param name="imageCategoryId">The id of the tag.</param>
  832. /// <returns>The image's count.</returns>
  833. public async Task<int> GetUnAdoptableImageCountAsync(long imageCategoryId)
  834. {
  835. return await ServerProxy.AdminService.GetUnAdoptableImageCountAsync(_session.Id, imageCategoryId);
  836. }
  837. /// <summary>
  838. /// Get the assigned label cases.
  839. /// </summary>
  840. /// <param name="sameBatchLabelCaseId">The id of the same batch label case</param>
  841. /// <returns>The cases</returns>
  842. public async Task<List<AssignedLabelCase>> GetAssignedLabelCasesBySameBatchLabelCaseIdAsync(long sameBatchLabelCaseId)
  843. {
  844. return await ServerProxy.AdminService.GetAssignedLabelCasesBySameBatchLabelCaseIdAsync(_session.Id, sameBatchLabelCaseId);
  845. }
  846. /// <summary>
  847. /// Get case image count.
  848. /// </summary>
  849. /// <param name="caseId">The case id</param>
  850. /// <returns>The case image count.</returns>
  851. public async Task<int> GetCaseImageCountAsync(long caseId)
  852. {
  853. return await ServerProxy.AdminService.GetCaseImageCountAsync(_session.Id, caseId);
  854. }
  855. /// <summary>
  856. /// Get case image count.
  857. /// </summary>
  858. /// <param name="caseId">The case id</param>
  859. /// <returns>The labeled file count</returns>
  860. public async Task<int> GetLabeledCaseImageCountAsync(long caseId)
  861. {
  862. return await ServerProxy.AdminService.GetLabeledCaseImageCountAsync(_session.Id, caseId);
  863. }
  864. #endregion images
  865. #region uploader
  866. /// <summary>
  867. /// Add one un-labeled file into the system.
  868. /// </summary>
  869. /// <param name="imageCategoryId">The image category id</param>
  870. /// <param name="imageBatchId">The image batch id</param>
  871. /// <returns>Void</returns>
  872. public async Task<OpResult> AddUnLabeledFileAsync(long organinzationId, long imageCategoryId, long imageBatchId, UploadFileModel file)
  873. {
  874. return await ServerProxy.AdminService.AddUnLabeledFileAsync(_session.Id, organinzationId, imageCategoryId, imageBatchId, file);
  875. }
  876. /// <summary>
  877. /// 分段上传视频
  878. /// </summary>
  879. /// <param name="fileData"></param>
  880. /// <param name="fileName"></param>
  881. /// <param name="fileId"></param>
  882. /// <returns></returns>
  883. public async Task<OpResult> UploadVideoBatchSizeAsync(byte[] fileData, string fileName, string fileId)
  884. {
  885. try
  886. {
  887. using (var fileStream = new MemoryStream(fileData))
  888. {
  889. long batchSize = 10 * 1024 * 1024; // 10MB
  890. int bytesRead;
  891. var restBufferSize = fileStream.Length;
  892. if (restBufferSize < batchSize)
  893. {
  894. batchSize = restBufferSize;
  895. }
  896. byte[] buffer = new byte[batchSize];
  897. // 分块上传
  898. while ((bytesRead = await fileStream.ReadAsync(buffer, 0, (int)batchSize)) > 0)
  899. {
  900. var uploadResult = await ServerProxy.AdminService.UploadVideoBatchSizeAsync(fileId, fileName, buffer);
  901. restBufferSize = restBufferSize - batchSize;
  902. if (restBufferSize < batchSize && restBufferSize > 0)
  903. {
  904. batchSize = restBufferSize;
  905. Array.Resize(ref buffer, (int)batchSize);
  906. }
  907. if (uploadResult == null || uploadResult.ResultCode == OpResultCode.Error)
  908. {
  909. return uploadResult;
  910. }
  911. }
  912. }
  913. return new OpResult { ResultCode = OpResultCode.Success };
  914. }
  915. catch (Exception ex)
  916. {
  917. return new OpResult { ResultCode = OpResultCode.Error, Message = ex.ToString() };
  918. }
  919. }
  920. /// <summary>
  921. /// Get all labelers.
  922. /// </summary>
  923. /// <returns>LabelerAccounts from the system.</returns>
  924. public async Task<List<LabelerAccount>> GetLabelersAsync()
  925. {
  926. return await ServerProxy.AdminService.GetLabelersAsync(_session.Id);
  927. }
  928. /// <summary>
  929. /// Get senior labelers.
  930. /// </summary>
  931. /// <returns>LabelerAccounts from the system.</returns>
  932. public async Task<List<LabelerAccount>> GetSeniorLabelersAsync()
  933. {
  934. return await ServerProxy.AdminService.GetSeniorLabelersAsync(_session.Id);
  935. }
  936. #endregion uploader
  937. #region LabelPackage
  938. /// <summary>
  939. /// Create a label package/
  940. /// </summary>
  941. /// <param name="name">The name of the package.</param>
  942. /// <param name="organizations">The organizations of the package.</param>
  943. /// <returns></returns>
  944. public async Task<LabelPackage> CreateLabelPackageAsync(string name, List<EntityBase> organizations)
  945. {
  946. return await ServerProxy.AdminService.CreateLabelPackageAsync(_session.Id, name, organizations);
  947. }
  948. /// <summary>
  949. /// Create a label package content.
  950. /// </summary>
  951. /// <param name="content">The content</param>
  952. /// <returns>The id of the content</returns>
  953. public async Task<long> CreateLabelPackageContentAsync(string content)
  954. {
  955. return await ServerProxy.AdminService.CreateLabelPackageContentAsync(_session.Id, content);
  956. }
  957. /// <summary>
  958. /// Update the label package content.
  959. /// </summary>
  960. /// <param name="labelPackageContentId">The id of the content.</param>
  961. /// <param name="content">The content</param>
  962. /// <returns>Void</returns>
  963. public async Task UpdateLabelPackageContentAsync(long labelPackageContentId, string content)
  964. {
  965. await ServerProxy.AdminService.UpdateLabelPackageContentAsync(_session.Id, labelPackageContentId, content);
  966. }
  967. /// <summary>
  968. /// Gets all label packages.
  969. /// </summary>
  970. /// <returns>Label packages from the system.</returns>
  971. public async Task<List<LabelPackage>> GetLabelPackagesAsync()
  972. {
  973. return await ServerProxy.AdminService.GetLabelPackagesAsync(_session.Id);
  974. }
  975. /// <summary>
  976. /// Gets the label packages count by keyword.
  977. /// </summary>
  978. /// <returns>Label packages count from the system.</returns>
  979. public async Task<int> GetLabelPackagesCountAsync(string keyword)
  980. {
  981. return await ServerProxy.AdminService.GetLabelPackagesCountAsync(_session.Id, keyword);
  982. }
  983. /// <summary>
  984. /// Gets the label packages by keyword.
  985. /// </summary>
  986. /// <returns>Label packages from the system.</returns>
  987. public async Task<List<LabelPackage>> GetLabelPackagesAsync(int pageIndex, int pageSize, string keyword)
  988. {
  989. return await ServerProxy.AdminService.GetLabelPackagesAsync(_session.Id, pageIndex, pageSize, keyword);
  990. }
  991. /// <summary>
  992. /// Get label package content by id.
  993. /// </summary>
  994. /// <param name="labelPackageContentId">The id of the label package content.</param>
  995. /// <returns>The loaded label package content.</returns>
  996. public async Task<LabelPackageContent> GetLabelPackageContentAsync(long labelPackageContentId)
  997. {
  998. return await ServerProxy.AdminService.GetLabelPackageContentAsync(_session.Id, labelPackageContentId);
  999. }
  1000. /// <summary>
  1001. /// Delete the label package.
  1002. /// </summary>
  1003. /// <returns>Void</returns>
  1004. public async Task DeleteLabelPackageAsync(long labelPackageId)
  1005. {
  1006. await ServerProxy.AdminService.DeleteLabelPackageAsync(_session.Id, labelPackageId);
  1007. }
  1008. #endregion LabelPackage
  1009. #region CaseStatistics
  1010. /// <summary>
  1011. /// Get committed count.
  1012. /// </summary>
  1013. /// <param name="labelerId">The id of the labeler.</param>
  1014. /// <param name="start">The start time.</param>
  1015. /// <param name="end">The end time.</param>
  1016. /// <returns>The committed count.</returns>
  1017. public async Task<int> GetLabelerCommittedCountAsync(long labelerId, DateTime start, DateTime end)
  1018. {
  1019. return await ServerProxy.AdminService.GetLabeledImageCountAsync(_session.Id, labelerId, start, end);
  1020. }
  1021. /// <summary>
  1022. /// Get committed count.
  1023. /// </summary>
  1024. /// <param name="day">The day to filter.</param>
  1025. /// <returns>The committed count.</returns>
  1026. public async Task<int> GetDayCommittedCountAsync(DateTime day)
  1027. {
  1028. return await ServerProxy.AdminService.GetDayCommittedCountAsync(_session.Id, day);
  1029. }
  1030. /// <summary>
  1031. /// Get committed region count.
  1032. /// </summary>
  1033. /// <param name="labelerId">The id of the labeler.</param>
  1034. /// <param name="start">The start time.</param>
  1035. /// <param name="end">The end time.</param>
  1036. /// <returns>Get committed region count.</returns>
  1037. public async Task<int> GetLabelerCommittedRegionCountAsync(long labelerId, DateTime start, DateTime end)
  1038. {
  1039. return await ServerProxy.AdminService.GetLabeledRegionCountAsync(_session.Id, labelerId, start, end);
  1040. }
  1041. /// <summary>
  1042. /// Get assigned image count.
  1043. /// </summary>
  1044. /// <param name="labelerId">The id of the labeler.</param>
  1045. /// <returns>Get assigned image count.</returns>
  1046. public async Task<int> GetLabelerAssignedImageCountAsync(long labelerId)
  1047. {
  1048. return await ServerProxy.AdminService.GetAssignedImageCountAsync(_session.Id, labelerId);
  1049. }
  1050. /// <summary>
  1051. /// Get assigned image count.
  1052. /// </summary>
  1053. /// <param name="labelerId">The id of the labeler.</param>
  1054. /// <param name="start">The start time.</param>
  1055. /// <param name="end">The end time.</param>
  1056. /// <returns>Get assigned image count.</returns>
  1057. public async Task<int> GetLabelerAssignedImageCountAsync(long labelerId, DateTime start, DateTime end)
  1058. {
  1059. return await ServerProxy.AdminService.GetAssignedImageCountAsync(_session.Id, labelerId, start, end);
  1060. }
  1061. /// <summary>
  1062. /// Get left image count.
  1063. /// </summary>
  1064. /// <param name="labelerId">The id of the labeler.</param>
  1065. /// <returns>Get left image count.</returns>
  1066. public async Task<int> GetLabelerLeftImageCountAsync(long labelerId)
  1067. {
  1068. return await ServerProxy.AdminService.GetUnlabeledAssignedImageCountAsync(_session.Id, labelerId);
  1069. }
  1070. /// <summary>
  1071. /// Get labeler statistic data.
  1072. /// </summary>
  1073. /// <param name="labelerId">The id of the labeler.</param>
  1074. /// <param name="start">The start time.</param>
  1075. /// <param name="end">The end time.</param>
  1076. /// <returns>The labeler statistic data.</returns>
  1077. public async Task<LabelerStatisticData> GetLabelerStatisticDataAsync(long labelerId, DateTime start, DateTime end)
  1078. {
  1079. return await ServerProxy.AdminService.GetLabelerStatisticDataAsync(_session.Id, labelerId, start, end);
  1080. }
  1081. /// <summary>
  1082. /// Get labeler statistics by case id..
  1083. /// </summary>
  1084. /// <param name="caseId">The id of the label case.</param>
  1085. /// <returns>The labeler statistics.</returns>
  1086. public async Task<LabelCaseStatistic> GetLabelCaseStatisticAsync(long caseId)
  1087. {
  1088. return await ServerProxy.AdminService.GetLabelCaseStatisticAsync(_session.Id, caseId);
  1089. }
  1090. /// <summary>
  1091. /// Get labeler case statistics by the same batch label case id
  1092. /// </summary>
  1093. /// <param name="sameBatchLabelCaseId">The same batch label case id</param>
  1094. /// <returns></returns>
  1095. public async Task<List<LabelCaseStatistic>> GetLabelCaseStatisticsBySameBatchLabelCaseIdAsync(long sameBatchLabelCaseId)
  1096. {
  1097. return await ServerProxy.AdminService.GetLabelCaseStatisticsBySameBatchLabelCaseIdAsync(_session.Id, sameBatchLabelCaseId);
  1098. }
  1099. /// <summary>
  1100. /// Get SameBatchLabelCase statistics by case id..
  1101. /// </summary>
  1102. /// <param name="caseId">The id of the label case.</param>
  1103. /// <returns>The SameBatchLabelCase general statistics.</returns>
  1104. public async Task<SameBatchLabelCaseStatisticData> GetSameBatchLabelCaseStatisticsAsync(long caseId)
  1105. {
  1106. return await ServerProxy.AdminService.GetSameBatchLabelCaseStatisticsAsync(_session.Id, caseId);
  1107. }
  1108. /// <summary>
  1109. /// Get all the SameBatchLabelCase.
  1110. /// </summary>
  1111. /// <param name="pageIndex">The index of page.</param>
  1112. /// <param name="pageSize">The item count per page.</param>
  1113. /// <param name="keyword">The searched keyword.</param>
  1114. /// <param name="start">The start time.</param>
  1115. /// <param name="end">The end time.</param>
  1116. /// <returns>The loaded SameBatchLabelCase.</returns>
  1117. public async Task<List<SameBatchLabelCase>> GetSameBatchLabelCasesAsync(int pageIndex, int pageSize, long organizationId, long imageCategoryId, string keyword, DateTime start = new DateTime(), DateTime end = new DateTime(), DateTime updateStart = new DateTime(), DateTime updateEnd = new DateTime())
  1118. {
  1119. return await ServerProxy.AdminService.GetSameBatchLabelCasesAsync(_session.Id, pageIndex, pageSize, organizationId, imageCategoryId, keyword, start, end, updateStart, updateEnd);
  1120. }
  1121. /// <summary>
  1122. /// Get all the SameBatchLabelCase.
  1123. /// </summary>
  1124. /// <returns>The loaded SameBatchLabelCase.</returns>
  1125. public async Task<List<SameBatchLabelCase>> GetSameBatchLabelCasesAsync()
  1126. {
  1127. return await ServerProxy.AdminService.GetSameBatchLabelCasesAsync(_session.Id);
  1128. }
  1129. /// <summary>
  1130. /// Get the SameBatchLabelCases.
  1131. /// </summary>
  1132. /// <param name="id">The same batch label case id.</param>
  1133. /// <returns>The loaded SameBatchLabelCase.</returns>
  1134. public async Task<SameBatchLabelCase> GetSameBatchLabelCaseAsync(long id)
  1135. {
  1136. return await ServerProxy.AdminService.GetSameBatchLabelCaseAsync(_session.Id, id);
  1137. }
  1138. /// <summary>
  1139. /// Assign conflict labeled data to Senior labelers.
  1140. /// </summary>
  1141. /// <returns></returns>
  1142. public async Task AssignConflictLabeledDataAsync()
  1143. {
  1144. await ServerProxy.AdminService.AssignConflictLabeledDataAsync(_session.Id);
  1145. }
  1146. #endregion CaseStatistics
  1147. #region agents
  1148. /// <summary>
  1149. /// Get all online and registered agents.
  1150. /// </summary>
  1151. /// <returns>The agents.</returns>
  1152. public async Task<List<AgentInfoEx>> GetAgentsAsync()
  1153. {
  1154. return await ServerProxy.AdminService.GetAgentsAsync(_session.Id);
  1155. }
  1156. /// <summary>
  1157. /// Get the agents count from the system.
  1158. /// </summary>
  1159. /// <returns>Void</returns>
  1160. public async Task<int> GetAgentsCountAsync()
  1161. {
  1162. return await ServerProxy.AdminService.GetAgentsCountAsync(_session.Id);
  1163. }
  1164. /// <summary>
  1165. /// Register an agent into the system.
  1166. /// </summary>
  1167. /// <param name="agentVersion">The version of the agent</param>
  1168. /// <param name="agentName">The name of the agent.</param>
  1169. /// <param name="description">The description of the agent.</param>
  1170. /// <param name="hardwareCode">The hardware code of the agent.</param>
  1171. /// <param name="ipAddress">The ip address of the agent.</param>
  1172. /// <returns></returns>
  1173. public async Task RegisterAgentAsync(string agentVersion, string agentName, string description, string hardwareCode, string ipAddress, List<EntityBase> organizations)
  1174. {
  1175. await ServerProxy.AdminService.RegisterAgentAsync(_session.Id, agentVersion, agentName, description, hardwareCode, ipAddress, organizations);
  1176. }
  1177. /// <summary>
  1178. /// UnRegister an agent from the system.
  1179. /// </summary>
  1180. /// <param name="agentId">The agentId to un-register.</param>
  1181. /// <returns></returns>
  1182. public async Task UnRegisterAgentAsync(long agentId)
  1183. {
  1184. await ServerProxy.AdminService.UnRegisterAgentAsync(_session.Id, agentId);
  1185. }
  1186. /// <summary>
  1187. /// Update agent organizations from the system.
  1188. /// </summary>
  1189. /// <param name="sessionId">The session id of the admin.</param>
  1190. /// <param name="agentId">The agent id</param>
  1191. /// <param name="organizations">The organizations to update</param>
  1192. /// <returns>Void</returns>
  1193. public async Task UpdateAgentOrganizationsAsync(long agentId, List<EntityBase> organizations)
  1194. {
  1195. await ServerProxy.AdminService.UpdateAgentOrganizationsAsync(_session.Id, agentId, organizations);
  1196. }
  1197. #endregion agents
  1198. #region logs
  1199. /// <summary>
  1200. /// Get log item count.
  1201. /// </summary>
  1202. /// <returns>The log item count.</returns>
  1203. public async Task<int> GetLogItemCountAsync()
  1204. {
  1205. return await ServerProxy.AdminService.GetLogItemCountAsync(_session.Id);
  1206. }
  1207. /// <summary>
  1208. /// Get log items.
  1209. /// </summary>
  1210. /// <param name="pageIndex">The index of the page.</param>
  1211. /// <param name="pageSize">Items per page.</param>
  1212. /// <returns></returns>
  1213. public async Task<List<LogItem>> GetLogItemsAsync(int pageIndex, int pageSize, string keyword)
  1214. {
  1215. return await ServerProxy.AdminService.GetLogItemsAsync(_session.Id, pageIndex, pageSize, keyword);
  1216. }
  1217. #endregion logs
  1218. #region labeler client
  1219. /// <summary>
  1220. /// Get all labeler client infos count.
  1221. /// </summary>
  1222. /// <returns>All labeler client infos count.</returns>
  1223. public async Task<int> GetLabelerClientInfosCountAsync()
  1224. {
  1225. return await ServerProxy.AdminService.GetLabelerClientInfosCountAsync(_session.Id);
  1226. }
  1227. /// <summary>
  1228. /// Get all labeler client infos.
  1229. /// </summary>
  1230. /// <param name="pageIndex">The index of the page.</param>
  1231. /// <param name="pageSize">Items per page.</param>
  1232. /// <returns></returns>
  1233. public async Task<List<ClientUpgradeInfo>> GetLabelerClientInfosAsync(int pageIndex, int pageSize, string keyword)
  1234. {
  1235. return await ServerProxy.AdminService.GetLabelerClientInfosAsync(_session.Id, pageIndex, pageSize, keyword);
  1236. }
  1237. /// <summary>
  1238. /// Delete one labeler client info
  1239. /// </summary>
  1240. /// <param name="id">The labeler client info to delete.</param>
  1241. /// <returns></returns>
  1242. public async Task DeleteLabelerClientInfoAsync(long id)
  1243. {
  1244. await ServerProxy.AdminService.DeleteLabelerClientInfoAsync(_session.Id, id);
  1245. }
  1246. /// <summary>
  1247. /// Add one labeler client.
  1248. /// </summary>
  1249. /// <param name="version">The version of labeler client.</param>
  1250. /// <param name="description">The description of labeler client.</param>
  1251. /// <param name="clientData">The data of the labeler client.</param>
  1252. /// <param name="isDefault">True set to default.</param>
  1253. /// <returns></returns>
  1254. public async Task AddLabelerClientAsync(string fileName, string version, string description, byte[] clientData)
  1255. {
  1256. await ServerProxy.AdminService.AddLabelerClientAsync(_session.Id, fileName, version, description, clientData);
  1257. }
  1258. /// <summary>
  1259. /// Set labeler client to default one.
  1260. /// </summary>
  1261. /// <param name="labelerClientInfoId">The id of the labeler client info</param>
  1262. /// <returns></returns>
  1263. public async Task SetDefaultLabelerClientInfoAsync(long labelerClientInfoId)
  1264. {
  1265. await ServerProxy.AdminService.SetDefaultLabelerClientAsync(_session.Id, labelerClientInfoId);
  1266. }
  1267. #endregion labeler client
  1268. #region CaseAssignment
  1269. /// <summary>
  1270. /// Get ths labeler group
  1271. /// </summary>
  1272. /// <param name="imageCategoryId">The image category id</param>
  1273. /// <param name="labelerId">The labeler id</param>
  1274. /// <returns></returns>
  1275. public async Task<LabelerGroup> GetLabelerGroupAsync(long imageCategoryId, long labelerId)
  1276. {
  1277. return await ServerProxy.AdminService.GetLabelerGroupAsync(_session.Id, imageCategoryId, labelerId);
  1278. }
  1279. /// <summary>
  1280. /// Get the sum of the assigned count of AssignedLabelCase.
  1281. /// </summary>
  1282. /// <param name="imageCategoryId">The image category id</param>
  1283. /// <param name="labelerId">The labeler id</param>
  1284. /// <returns></returns>
  1285. public async Task<QuantityBase> GetAssignedCountForAssignedLabelCaseAsync(long imageCategoryId, long labelerId)
  1286. {
  1287. return await ServerProxy.AdminService.GetAssignedCountForAssignedLabelCaseAsync(_session.Id, imageCategoryId, labelerId);
  1288. }
  1289. /// <summary>
  1290. /// Get the sum of the assigned ultrasound file count.
  1291. /// </summary>
  1292. /// <returns></returns>
  1293. public async Task<int> GetAssignedUltrasoundFileCountAsync(long imageBatchId, AssignCondition condition, int assignGroupCount)
  1294. {
  1295. return await ServerProxy.AdminService.GetAssignedUltrasoundFileCountAsync(_session.Id, imageBatchId, condition, assignGroupCount);
  1296. }
  1297. /// <summary>
  1298. /// Assign files to labelers.
  1299. /// </summary>
  1300. /// <param name="caseName">The label case name.</param>
  1301. /// <param name="organization">The organization of label case.</param>
  1302. /// <param name="imageCategoryId">The tag id of the images.</param>
  1303. /// <param name="labelerInfos">The labelers to assign.</param>
  1304. /// <param name="mode">The assign mode.</param>
  1305. /// <param name="type">The assign type.</param>
  1306. /// <param name="condition">The assign condition.</param>
  1307. /// <param name="assignCount">The image count to assign.</param>
  1308. /// <returns>The assign operation id.</returns>
  1309. public async Task<OpResult> AssignLabelCaseAsync(long operationId, string caseName, EntityBase organization, long imageCategoryId, long imageBatchId, IEnumerable<AssignLabelerInfoModal> labelerInfos,
  1310. AssignMode mode, AssignType type, AssignCondition condition, QuantityBase assignCount, VideoItem videoItem)
  1311. {
  1312. return await ServerProxy.AdminService.AssignLabelCaseAsync(_session.Id, operationId, caseName, organization, imageCategoryId, imageBatchId, labelerInfos, mode, type, condition, assignCount, videoItem);
  1313. }
  1314. /// <summary>
  1315. /// Assign files to labelers.
  1316. /// </summary>
  1317. /// <param name="caseName">The label case name.</param>
  1318. /// <param name="organization">The organization of label case.</param>
  1319. /// <param name="imageCategoryId">The tag id of the images.</param>
  1320. /// <param name="labelerInfos">The labelers to assign.</param>
  1321. /// <param name="mode">The assign mode.</param>
  1322. /// <param name="type">The assign type.</param>
  1323. /// <param name="condition">The assign condition.</param>
  1324. /// <param name="assignCount">The image count to assign.</param>
  1325. /// <returns>The assign operation id.</returns>
  1326. public async Task<long> AssignDisputeLabelCaseAsync(string caseName, EntityBase organization, long imageCategoryId, long imageBatchId, List<SameBatchLabelerInfo> labelerInfos, AssignMode mode,
  1327. AssignType type, List<long> ultrasoundId)
  1328. {
  1329. return await ServerProxy.AdminService.AssignDisputeLabelCaseAsync(_session.Id, caseName, organization, imageCategoryId, imageBatchId, labelerInfos, mode, type, ultrasoundId);
  1330. }
  1331. /// <summary>
  1332. /// Assign label files to labelers for relabeled.
  1333. /// </summary>
  1334. /// <param name="caseName">The label case name.</param>
  1335. /// <param name="sameBatchLabelCaseId">The same batch label case id.</param>
  1336. /// <param name="assignedLabelCaseId">The assigned label case id.</param>
  1337. /// <returns>The assign operation id.</returns>
  1338. public async Task<long> AssignRelabelCaseAsync(string caseName, long sameBatchLabelCaseId, long assignedLabelCaseId, EntityBase imageBatch)
  1339. {
  1340. return await ServerProxy.AdminService.AssignRelabelCaseAsync(_session.Id, caseName, sameBatchLabelCaseId, assignedLabelCaseId, imageBatch);
  1341. }
  1342. /// <summary>
  1343. /// Assign labeled files to reviewers.
  1344. /// </summary>
  1345. /// <param name="sameBatchLabelCaseId"></param>
  1346. /// <param name="reviewers">The labelers to review.</param>
  1347. /// <returns></returns>
  1348. public async Task<long> AssignReviewCaseAsync(long sameBatchLabelCaseId, List<EntityBase> reviewers, List<AssignReviewInfo> assignReviewInfos, bool isHideLabelerName, bool isHideReviewerName)
  1349. {
  1350. return await ServerProxy.AdminService.AssignReviewCaseAsync(_session.Id, sameBatchLabelCaseId, reviewers, assignReviewInfos, isHideLabelerName, isHideReviewerName);
  1351. }
  1352. /// <summary>
  1353. /// Assign questioned label files to labeler.
  1354. /// </summary>
  1355. /// <param name="caseName">The label case name.</param>
  1356. /// <param name="organization">The organization of label case.</param>
  1357. /// <param name="imageCategoryId">The image category id.</param>
  1358. /// <returns>The assign operation id.</returns>
  1359. public async Task<long> AssignQuestionedFilesAsync(EntityBase organization, long imageCategoryId, long imageBatchId, List<EntityBase> labelers, List<AssignQuestionCaseViewModel> assignQuestionCaseViews)
  1360. {
  1361. return await ServerProxy.AdminService.AssignQuestionedFilesEachAsync(_session.Id, organization, imageCategoryId, imageBatchId, labelers, assignQuestionCaseViews);
  1362. }
  1363. /// <summary>
  1364. /// Get the progress of the assign operation.
  1365. /// </summary>
  1366. /// <param name="assignId">The id of the assign operation.</param>
  1367. /// <returns>The progress of the assign operation.</returns>
  1368. public async Task<int> GetAssignImagesProgressAsync(long assignId)
  1369. {
  1370. return await ServerProxy.AdminService.GetAssignImagesProgressAsync(_session.Id, assignId);
  1371. }
  1372. /// <summary>
  1373. /// Assign label case to labelers again.
  1374. /// </summary>
  1375. /// <param name="sameBatchLabelCaseId">The same batch label case id.</param>
  1376. /// <param name="labelers">The labelers.</param>
  1377. /// <returns></returns>
  1378. public async Task<long> AssignLabelCaseAgainAsync(long sameBatchLabelCaseId, List<EntityBase> labelers)
  1379. {
  1380. return await ServerProxy.AdminService.AssignLabelCaseAgainAsync(_session.Id, sameBatchLabelCaseId, labelers);
  1381. }
  1382. /// <summary>
  1383. /// Update same batch label case
  1384. /// </summary>
  1385. /// <param name="id">The id of SameBatchLabelCase.</param>
  1386. /// <param name="isHideLabelerName">Whether to hide Labeler Name.</param>
  1387. /// <returns></returns>
  1388. public async Task UpdateSameBatchLabelCaseAsync(long id, bool isHideLabelerName, bool isHideReviewerName)
  1389. {
  1390. await ServerProxy.AdminService.UpdateSameBatchLabelCaseAsync(_session.Id, id, isHideLabelerName, isHideReviewerName);
  1391. }
  1392. /// <summary>
  1393. /// Set label case to unadoptable
  1394. /// </summary>
  1395. /// <param name="sameBatchLabelCase">The updated SameBatchLabelCase.</param>
  1396. /// <returns></returns>
  1397. public async Task SetSameBatchLabelCaseToUnAdoptableAsync(SameBatchLabelCase sameBatchLabelCase)
  1398. {
  1399. await ServerProxy.AdminService.SetSameBatchLabelCaseToUnAdoptableAsync(_session.Id, sameBatchLabelCase);
  1400. }
  1401. /// <summary>
  1402. /// Clear labeled files
  1403. /// </summary>
  1404. /// <param name="sameBatchLabelCaseId">The same batch label case id.</param>
  1405. /// <returns></returns>
  1406. public async Task ClearLabeledFilesAsync(long sameBatchLabelCaseId)
  1407. {
  1408. await ServerProxy.AdminService.ClearLabeledFilesAsync(_session.Id, sameBatchLabelCaseId);
  1409. }
  1410. public async Task<List<AssignQuestionCaseViewModel>> GetQusetionInfoByBatchId(long batchId)
  1411. {
  1412. return await ServerProxy.AdminService.GetQusetionInfoByBatchId(_session.Id, batchId);
  1413. }
  1414. #endregion CaseAssignment
  1415. #region Reviewer Client
  1416. /// <summary>
  1417. /// Add one reviewer client.
  1418. /// </summary>
  1419. /// <param name="version">The version of reviewer client.</param>
  1420. /// <param name="description">The description of reviewer client.</param>
  1421. /// <param name="clientData">The data of the reviewer client.</param>
  1422. /// <returns></returns>
  1423. public async Task AddReviewerClientAsync(string fileName, string version, string description, byte[] clientData)
  1424. {
  1425. await ServerProxy.AdminService.AddReviewerClientAsync(_session.Id, fileName, version, description, clientData);
  1426. }
  1427. /// <summary>
  1428. /// Get the reviewer client infos.
  1429. /// </summary>
  1430. /// <returns>The found reviewer client infos.</returns>
  1431. public async Task<List<ClientUpgradeInfo>> GetReviewerClientInfosAsync(int pageIndex, int pageSize, string keyword)
  1432. {
  1433. return await ServerProxy.AdminService.GetReviewerClientInfosAsync(_session.Id, pageIndex, pageSize, keyword);
  1434. }
  1435. /// <summary>
  1436. /// Get all reviewer client infos count.
  1437. /// </summary>
  1438. /// <returns>All reviewer client infos count.</returns>
  1439. public async Task<int> GetReviewerClientInfosCountAsync()
  1440. {
  1441. return await ServerProxy.AdminService.GetReviewerClientInfosCountAsync(_session.Id);
  1442. }
  1443. /// <summary>
  1444. /// Set reviewer client to default one.
  1445. /// </summary>
  1446. /// <param name="reviewerClientInfoId">The id of the reviewer client info</param>
  1447. /// <returns></returns>
  1448. public async Task SetDefaultReviewerClientInfoAsync(long reviewerClientInfoId)
  1449. {
  1450. await ServerProxy.AdminService.SetDefaultReviewerClientAsync(_session.Id, reviewerClientInfoId);
  1451. }
  1452. /// <summary>
  1453. /// Delete one reviewer client info
  1454. /// </summary>
  1455. /// <returns></returns>
  1456. public async Task DeleteReviewerClientInfoAsync(long id)
  1457. {
  1458. await ServerProxy.AdminService.DeleteReviewerClientInfoAsync(_session.Id, id);
  1459. }
  1460. #endregion Reviewer Client
  1461. #region Train Tasks
  1462. /// <summary>
  1463. /// Get the train tasks count by keyword.
  1464. /// </summary>
  1465. /// <param name="keyword">The searched keyword.</param>
  1466. /// <returns>The searched train tasks count.</returns>
  1467. public async Task<int> GetTrainTasksCountAsync(string keyword)
  1468. {
  1469. return await ServerProxy.AdminService.GetTrainTasksCountAsync(_session.Id, keyword);
  1470. }
  1471. /// <summary>
  1472. /// Gets the train tasks by keyword.
  1473. /// </summary>
  1474. /// <param name="keyword">The searched keyword.</param>
  1475. /// <returns>The searched train tasks.</returns>
  1476. public async Task<List<TrainTaskModel>> GetTrainTasksAsync(int pageIndex, int pageSize, string keyword)
  1477. {
  1478. return await ServerProxy.AdminService.GetTrainTasksAsync(_session.Id, pageIndex, pageSize, keyword);
  1479. }
  1480. /// <summary>
  1481. /// Cancel train task.
  1482. /// </summary>
  1483. /// <param name="trainTaskId">The id of the train task.</param>
  1484. /// <returns></returns>
  1485. public async Task CancelTrainTaskAsync(long trainTaskId)
  1486. {
  1487. await ServerProxy.AdminService.CancelTrainTaskAsync(_session.Id, trainTaskId);
  1488. }
  1489. /// <summary>
  1490. /// Delete a train task from the system.
  1491. /// </summary>
  1492. /// <param name="trainTaskId">The id of the train task to be deleted.</param>
  1493. /// <returns>Void</returns>
  1494. public async Task DeleteTrainTaskAsync(long trainTaskId)
  1495. {
  1496. await ServerProxy.AdminService.DeleteTrainTaskAsync(_session.Id, trainTaskId);
  1497. }
  1498. #endregion Train Tasks
  1499. #region CaseAdjustment
  1500. /// <summary>
  1501. /// Get the label cases which assigned to a labeler.
  1502. /// </summary>
  1503. /// <param name="labelerId">The id of the labeler</param>
  1504. /// <returns>The cases</returns>
  1505. public async Task<List<AssignedLabelCase>> GetAssignedLabelCasesByLabelerIdAsync(long labelerId, int pageIndex, int pageSize, string keyword)
  1506. {
  1507. return await ServerProxy.AdminService.GetAssignedLabelCasesByLabelerIdAsync(_session.Id, labelerId, pageIndex, pageSize, keyword);
  1508. }
  1509. /// <summary>
  1510. /// Get all assignedLabelCases count of one labeler.
  1511. /// </summary>
  1512. /// <param name="labelerId">The labelerId which the cases assigned to.</param>
  1513. /// <returns>The assigned label case count.</returns>
  1514. public async Task<int> GetAssignedLabelCaseCountAsync(long labelerId, string keyword)
  1515. {
  1516. return await ServerProxy.AdminService.GetAssignedLabelCaseCountAsync(_session.Id, labelerId, keyword);
  1517. }
  1518. /// <summary>
  1519. /// Delete the label case by case id.
  1520. /// </summary>
  1521. /// <param name="caseId">The id of the case.</param>
  1522. /// <returns>Void</returns>
  1523. public async Task DeleteLabelCaseAsync(long caseId)
  1524. {
  1525. await ServerProxy.AdminService.DeleteLabelCaseAsync(_session.Id, caseId);
  1526. }
  1527. /// <summary>
  1528. /// Move up the label case by case id.
  1529. /// </summary>
  1530. /// <param name="caseId">The id of the case.</param>
  1531. /// <returns>Void</returns>
  1532. public async Task MoveUpLabelCaseAsync(long caseId)
  1533. {
  1534. await ServerProxy.AdminService.MoveUpLabelCaseAsync(_session.Id, caseId);
  1535. }
  1536. /// <summary>
  1537. /// Move down the label case by case id.
  1538. /// </summary>
  1539. /// <param name="caseId">The id of the case.</param>
  1540. /// <returns>Void</returns>
  1541. public async Task MoveDownLabelCaseAsync(long caseId)
  1542. {
  1543. await ServerProxy.AdminService.MoveDownLabelCaseAsync(_session.Id, caseId);
  1544. }
  1545. /// <summary>
  1546. /// Get the cases which assigned to a reviewer.
  1547. /// </summary>
  1548. /// <param name="reviewerId">The id of the reviewer</param>
  1549. /// <returns>The cases</returns>
  1550. public async Task<List<AssignedReviewCase>> GetAssignedReviewCasesByReviewerIdAsync(long reviewerId, int pageIndex, int pageSize, string keyword)
  1551. {
  1552. return await ServerProxy.AdminService.GetAssignedReviewCasesByReviewerIdAsync(_session.Id, reviewerId, pageIndex, pageSize, keyword);
  1553. }
  1554. /// <summary>
  1555. /// Get all assignedReviewCases count of one reviewer.
  1556. /// </summary>
  1557. /// <param name="reviewerId">The reviewerId which the cases assigned to.</param>
  1558. /// <returns>The assigned review case count.</returns>
  1559. public async Task<int> GetAssignedReviewCaseCountAsync(long reviewerId, string keyword)
  1560. {
  1561. return await ServerProxy.AdminService.GetAssignedReviewCaseCountAsync(_session.Id, reviewerId, keyword);
  1562. }
  1563. /// <summary>
  1564. /// Delete the review case by case id.
  1565. /// </summary>
  1566. /// <param name="caseId">The id of the review case.</param>
  1567. /// <returns>Void</returns>
  1568. public async Task DeleteReviewCaseAsync(long caseId)
  1569. {
  1570. await ServerProxy.AdminService.DeleteReviewCaseAsync(_session.Id, caseId);
  1571. }
  1572. /// <summary>
  1573. /// Move up the review case by case id.
  1574. /// </summary>
  1575. /// <param name="caseId">The id of the review case.</param>
  1576. /// <returns>Void</returns>
  1577. public async Task MoveUpReviewCaseAsync(long caseId)
  1578. {
  1579. await ServerProxy.AdminService.MoveUpReviewCaseAsync(_session.Id, caseId);
  1580. }
  1581. /// <summary>
  1582. /// Move down the review case by case id.
  1583. /// </summary>
  1584. /// <param name="caseId">The id of the review case.</param>
  1585. /// <returns>Void</returns>
  1586. public async Task MoveDownReviewCaseAsync(long caseId)
  1587. {
  1588. await ServerProxy.AdminService.MoveDownReviewCaseAsync(_session.Id, caseId);
  1589. }
  1590. /// <summary>
  1591. /// Relabel and reassign label case to labeler.
  1592. /// </summary>
  1593. /// <param name="caseName">The same batch label case name.</param>
  1594. /// <param name="labeler">The labeler.</param>
  1595. /// <param name="isHideReviewerName">The value to indicate whether the labeler client hide reviewer name.</param>
  1596. /// <param name="sourceAssignedLabelCaseId">The source assign label case id.</param>
  1597. /// <returns></returns>
  1598. public async Task<long> RelabelReassignedLabelCaseAsync(string caseName, EntityBase labeler, bool isHideReviewerName, long organizationId, long imageCategoryId, long imageCaseId, long sourceAssignedLabelCaseId, List<long> LabeledUltrasoundFileId = null, long reLabelRecordId = 0, long reLabelRecordCountId = 0)
  1599. {
  1600. return await ServerProxy.AdminService.RelabelReassignedLabelCaseAsync(_session.Id, caseName, labeler, isHideReviewerName, organizationId, imageCategoryId, imageCaseId, sourceAssignedLabelCaseId, LabeledUltrasoundFileId, reLabelRecordId, reLabelRecordCountId);
  1601. }
  1602. /// <summary>
  1603. /// 重新分配审核人员
  1604. /// </summary>
  1605. /// <param name="assignedLabelCaseId"></param>
  1606. /// <param name="laberUltrasoundFileIds"></param>
  1607. /// <param name="reviewer"></param>
  1608. /// <param name="ImageCategoryId"></param>
  1609. /// <param name="reLabelRecordCountId"></param>
  1610. /// <param name="reLabelRecordId"></param>
  1611. /// <returns></returns>
  1612. public async Task ReAssignReviewCaseAsync(long assignedLabelCaseId, List<long> laberUltrasoundFileIds, EntityBase reviewer, long ImageCategoryId, long reLabelRecordCountId, long reLabelRecordId)
  1613. {
  1614. await ServerProxy.AdminService.ReAssignReviewCaseAsync(_session.Id, assignedLabelCaseId, laberUltrasoundFileIds, reviewer, ImageCategoryId, reLabelRecordCountId, reLabelRecordId);
  1615. }
  1616. #endregion CaseAdjustment
  1617. #region LabelerStatistics
  1618. /// <summary>
  1619. /// Get labelers' label statistics.
  1620. /// </summary>
  1621. /// <param name="start">The start time</param>
  1622. /// <param name="end">The end time</param>
  1623. /// <returns>The labelers' label statistics.</returns>
  1624. public async Task<List<LabelerLabelStatistic>> GetLabelerStatisticsAsync(int pageIndex, int pageSize, string keyword, long organizationId, long imageCategoryId, DateTime start, DateTime end)
  1625. {
  1626. return await ServerProxy.AdminService.GetLabelerStatisticsAsync(_session.Id, pageIndex, pageSize, keyword, organizationId, imageCategoryId, start, end);
  1627. }
  1628. /// <summary>
  1629. /// Get labelers' label Groups count.
  1630. /// </summary>
  1631. /// <param name="keyword">The searched keyword.</param>
  1632. /// <returns>The labelers' label Groups count</returns>
  1633. public async Task<int> GetLabelerGroupsCountAsync(string keyword, long organizationId, long imageCategoryId)
  1634. {
  1635. return await ServerProxy.AdminService.GetLabelerGroupsCountAsync(_session.Id, keyword, organizationId, imageCategoryId);
  1636. }
  1637. #endregion LabelerStatistics
  1638. #region Developer Client
  1639. /// <summary>
  1640. /// Add one developer client.
  1641. /// </summary>
  1642. /// <param name="version">The version of developer client.</param>
  1643. /// <param name="description">The description of developer client.</param>
  1644. /// <param name="clientData">The data of the developer client.</param>
  1645. /// <returns></returns>
  1646. public async Task AddDeveloperClientAsync(string fileName, string version, string description, byte[] clientData)
  1647. {
  1648. await ServerProxy.AdminService.AddDeveloperClientAsync(_session.Id, fileName, version, description, clientData);
  1649. }
  1650. /// <summary>
  1651. /// Get the developer client infos.
  1652. /// </summary>
  1653. /// <returns>The found developer client infos.</returns>
  1654. public async Task<List<ClientUpgradeInfo>> GetDeveloperClientInfosAsync(int pageIndex, int pageSize, string keyword)
  1655. {
  1656. return await ServerProxy.AdminService.GetDeveloperClientInfosAsync(_session.Id, pageIndex, pageSize, keyword);
  1657. }
  1658. /// <summary>
  1659. /// Get all developer client infos count.
  1660. /// </summary>
  1661. /// <returns>All developer client infos count.</returns>
  1662. public async Task<int> GetDeveloperClientInfosCountAsync()
  1663. {
  1664. return await ServerProxy.AdminService.GetDeveloperClientInfosCountAsync(_session.Id);
  1665. }
  1666. /// <summary>
  1667. /// Set developer client to default one.
  1668. /// </summary>
  1669. /// <param name="developerClientInfoId">The id of the developer client info</param>
  1670. /// <returns></returns>
  1671. public async Task SetDefaultDeveloperClientInfoAsync(long developerClientInfoId)
  1672. {
  1673. await ServerProxy.AdminService.SetDefaultDeveloperClientAsync(_session.Id, developerClientInfoId);
  1674. }
  1675. /// <summary>
  1676. /// Delete one developer client info
  1677. /// </summary>
  1678. /// <param name="id">The developer client info to delete.</param>
  1679. /// <returns></returns>
  1680. public async Task DeleteDeveloperClientInfoAsync(long id)
  1681. {
  1682. await ServerProxy.AdminService.DeleteDeveloperClientInfoAsync(_session.Id, id);
  1683. }
  1684. #endregion Developer Client
  1685. #region Authority
  1686. /// <summary>
  1687. /// Get all authority menus from system
  1688. /// </summary>
  1689. /// <returns></returns>
  1690. public async Task<List<AuthorityMenu>> GetAuthorityMenusAsync()
  1691. {
  1692. return await ServerProxy.AdminService.GetAuthorityMenusAsync(_session.Id);
  1693. }
  1694. /// <summary>
  1695. /// Get defaulr authorities
  1696. /// </summary>
  1697. /// <returns></returns>
  1698. public async Task<List<AuthorityMenu>> GetDefaultAuthorityMenusAsync()
  1699. {
  1700. return await ServerProxy.AdminService.GetDefaultAuthorityMenusAsync(_session.Id);
  1701. }
  1702. #endregion Authority
  1703. #region image category
  1704. /// <summary>
  1705. /// Create a image category.
  1706. /// </summary>
  1707. /// <returns></returns>
  1708. public async Task<ImageCategory> CreateImageCategoryAsync(string name, CategoryLevel level, EntityBase parent, long organizatinId, long labelPackageContentId, long sameBatchLabelCaseId)
  1709. {
  1710. return await ServerProxy.AdminService.CreateImageCategoryAsync(_session.Id, name, level, parent, organizatinId, labelPackageContentId, sameBatchLabelCaseId);
  1711. }
  1712. /// <summary>
  1713. /// Delete a image category.
  1714. /// </summary>
  1715. /// <returns>Void</returns>
  1716. public async Task DeleteImageCategoryAsync(long id)
  1717. {
  1718. await ServerProxy.AdminService.DeleteImageCategoryAsync(_session.Id, id);
  1719. }
  1720. /// <summary>
  1721. /// Get the image category by id.
  1722. /// </summary>
  1723. /// <param name="id">The searched id.</param>
  1724. /// <returns>The loaded image category.</returns>
  1725. public async Task<ImageCategory> GetImageCategoryAsync(long id)
  1726. {
  1727. return await ServerProxy.AdminService.GetImageCategoryAsync(_session.Id, id);
  1728. }
  1729. /// <summary>
  1730. /// Get the image categories count by keyword.
  1731. /// </summary>
  1732. /// <param name="keyword">The searched keyword.</param>
  1733. /// <returns>The found image categories count.</returns>
  1734. public async Task<int> GetImageCategoriesCountAsync(string keyword)
  1735. {
  1736. return await ServerProxy.AdminService.GetImageCategoriesCountAsync(_session.Id, keyword);
  1737. }
  1738. /// <summary>
  1739. /// Get the image categories by keyword.
  1740. /// </summary>
  1741. /// <param name="keyword">The searched keyword.</param>
  1742. /// <returns>The loaded image categories.</returns>
  1743. public async Task<List<ImageCategory>> GetImageCategoriesAsync(int pageIndex, int pageSize, string keyword)
  1744. {
  1745. return await ServerProxy.AdminService.GetImageCategoriesAsync(_session.Id, pageIndex, pageSize, keyword);
  1746. }
  1747. /// <summary>
  1748. /// Get all image categories.
  1749. /// </summary>
  1750. /// <param name="keyword">The searched keyword.</param>
  1751. /// <returns>The loaded image categories.</returns>
  1752. public async Task<List<ImageCategory>> GetImageCategoriesAsync(string keyword)
  1753. {
  1754. return await ServerProxy.AdminService.GetImageCategoriesAsync(_session.Id, keyword);
  1755. }
  1756. /// <summary>
  1757. /// Get the image categories by parent id.
  1758. /// </summary>
  1759. /// <param name="parentId">The searched parent id.</param>
  1760. /// <returns>The loaded image categories.</returns>
  1761. public async Task<List<ImageCategory>> GetImageCategoriesByParentIdAsync(long parentId)
  1762. {
  1763. return await ServerProxy.AdminService.GetImageCategoriesByParentIdAsync(_session.Id, parentId);
  1764. }
  1765. /// <summary>
  1766. /// Get the image categories by category level.
  1767. /// </summary>
  1768. /// <param name="level">The searched category level.</param>
  1769. /// <returns>The loaded image categories.</returns>
  1770. public async Task<List<ImageCategory>> GetImageCategoriesByLevelAsync(CategoryLevel level)
  1771. {
  1772. return await ServerProxy.AdminService.GetImageCategoriesByLevelAsync(_session.Id, level);
  1773. }
  1774. /// <summary>
  1775. /// Get the cases of image categories by parent id.
  1776. /// </summary>
  1777. /// <param name="parentId">The searched parent id.</param>
  1778. /// <returns>The loaded image categories.</returns>
  1779. public async Task<List<ImageCategory>> GetImageCategoriesWithRelabeledCaseByParentIdAsync(long parentId)
  1780. {
  1781. return await ServerProxy.AdminService.GetImageCategoriesWithRelabeledCaseByParentIdAsync(_session.Id, parentId);
  1782. }
  1783. /// <summary>
  1784. /// Get the image categories by labelPackageId.
  1785. /// </summary>
  1786. /// <param name="labelPackageContentId">The label package content id.</param>
  1787. /// <returns>The loaded ImageCategories</returns>
  1788. public async Task<List<ImageCategory>> GetImageCategoriesHasChildrenAsync(long labelPackageContentId)
  1789. {
  1790. return await ServerProxy.AdminService.GetImageCategoriesHasChildrenAsync(_session.Id, labelPackageContentId);
  1791. }
  1792. /// <summary>
  1793. /// Update the image category hasChildren in system.
  1794. /// </summary>
  1795. /// <returns></returns>
  1796. public async Task UpdateImageCategoryHasChildrenAsync(long id, bool hasChildren)
  1797. {
  1798. await ServerProxy.AdminService.UpdateImageCategoryHasChildrenAsync(_session.Id, id, hasChildren);
  1799. }
  1800. /// <summary>
  1801. /// Update the image category that assigned users in system.
  1802. /// </summary>
  1803. /// <returns></returns>
  1804. public async Task UpdateImageCategoryUsersAsync(long id, AccountType accountType, List<EntityBase> users)
  1805. {
  1806. await ServerProxy.AdminService.UpdateImageCategoryUsersAsync(_session.Id, id, accountType, users);
  1807. }
  1808. /// <summary>
  1809. /// Update the image category gold standard and self-check image quantity item in system.
  1810. /// </summary>
  1811. /// <returns></returns>
  1812. public async Task UpdateImageCategoryGoldStandardAndSelfCheckQuantityItemAsync(long id, double goldStandardProportion, int goldStandardQualifiedPeople, double selfCheckProportion, bool isSupportedSkipFrame, VideoItem videoItem, DifficultyLevel difficultyLevel)
  1813. {
  1814. await ServerProxy.AdminService.UpdateImageCategoryGoldStandardAndSelfCheckQuantityItemAsync(_session.Id, id, goldStandardProportion, goldStandardQualifiedPeople, selfCheckProportion, isSupportedSkipFrame, videoItem, difficultyLevel);
  1815. }
  1816. #endregion image category
  1817. #region Developer share info
  1818. /// <summary>
  1819. /// Gets the developer share infos by keyword.
  1820. /// </summary>
  1821. /// <param name="keyword">The searched keyword.</param>
  1822. /// <returns>The loaded developer share infos.</returns>
  1823. public async Task<List<DeveloperShareInfo>> GetDeveloperShareInfosAsync(int pageIndex, int pageSize, string keyword)
  1824. {
  1825. return await ServerProxy.AdminService.GetDeveloperShareInfosAsync(_session.Id, pageIndex, pageSize, keyword);
  1826. }
  1827. /// <summary>
  1828. /// Gets the developer share infos count by keyword.
  1829. /// </summary>
  1830. /// <param name="keyword">The searched keyword.</param>
  1831. /// <returns>The loaded developer share infos count.</returns>
  1832. public async Task<int> GetDeveloperShareInfosCountAsync(string keyword)
  1833. {
  1834. return await ServerProxy.AdminService.GetDeveloperShareInfosCountAsync(_session.Id, keyword);
  1835. }
  1836. /// <summary>
  1837. /// Update shared developer folder
  1838. /// </summary>
  1839. /// <param name="state">The approval state</param>
  1840. /// <returns></returns>
  1841. public async Task UpdateSharedDeveloperFolderAsync(long id, ApprovalState state)
  1842. {
  1843. await ServerProxy.AdminService.UpdateSharedDeveloperFolderAsync(_session.Id, id, state);
  1844. }
  1845. #endregion Developer share info
  1846. #region treating process
  1847. /// <summary>
  1848. /// get treating process by ultrasoundid
  1849. /// </summary>
  1850. /// <param name="ultrasoundId"></param>
  1851. /// <returns></returns>
  1852. public async Task<TreatingProcess> GetTreatingProcessByultrasoundId(long ultrasoundId)
  1853. {
  1854. return await ServerProxy.AdminService.GetTreatingProcessByultrasoundId(_session.Id, ultrasoundId);
  1855. }
  1856. #endregion treating process
  1857. #region ReLabelRecord
  1858. public async Task<List<ReLabelRecord>> GetReLabelRecordBySameBatchLabelCaseId(long SameBatchLabelCaseId)
  1859. {
  1860. return await ServerProxy.AdminService.GetReLabelRecordBySameBatchLabelCaseId(_session.Id, SameBatchLabelCaseId);
  1861. }
  1862. #endregion ReLabelRecord
  1863. #region 呼吸机数据管理
  1864. /// <summary>
  1865. /// Add un-labeled Ventilator file into the system.
  1866. /// </summary>
  1867. /// <returns>Void</returns>
  1868. public async Task<VentilatorOpResult> AddUnLabeledVentilatorFileAsync(long organizationId, VentilatorFile ventilatorFile, byte[] fileData, string fileName)
  1869. {
  1870. return await ServerProxy.AdminService.AddUnLabeledVentilatorFileAsync(_session.Id, organizationId, ventilatorFile, fileData, fileName);
  1871. }
  1872. /// <summary>
  1873. /// Upload un-labeled Ventilator file into the system.
  1874. /// </summary>
  1875. /// <returns>Void</returns>
  1876. public async Task<OpResult> UploadUnLabeledVentilatorFileAsync(VentilatorFile ventilatorFile)
  1877. {
  1878. return await ServerProxy.AdminService.UploadUnLabeledVentilatorFileAsync(_session.Id, ventilatorFile);
  1879. }
  1880. /// <summary>
  1881. /// 获取呼吸文件数量
  1882. /// </summary>
  1883. /// <returns></returns>
  1884. public async Task<int> GetVentilatorFilesCountAsync(SearchVentilatorFileModel searchModel)
  1885. {
  1886. return await ServerProxy.AdminService.GetVentilatorFilesCountAsync(_session.Id, searchModel);
  1887. }
  1888. /// <summary>
  1889. /// 获取呼吸文件.
  1890. /// <param name="pageIndex">The index of page.</param>
  1891. /// <param name="pageSize">The item count per page.</param>
  1892. /// </summary>
  1893. public async Task<List<VentilatorFile>> GetVentilatorFilesAsync(int pageIndex, int pageSize, SearchVentilatorFileModel searchModel)
  1894. {
  1895. return await ServerProxy.AdminService.GetVentilatorFilesAsync(_session.Id, pageIndex, pageSize, searchModel);
  1896. }
  1897. /// <summary>
  1898. /// 获取呼吸文件.
  1899. /// </summary>
  1900. /// <param name="ventilatorId"></param>
  1901. /// <returns></returns>
  1902. public async Task<VentilatorFile> GetVentilatorFileByIdAsync(long ventilatorId)
  1903. {
  1904. return await ServerProxy.AdminService.GetVentilatorFileByIdAsync(_session.Id, ventilatorId);
  1905. }
  1906. /// <summary>
  1907. /// 更新呼吸文件
  1908. /// </summary>
  1909. /// <returns></returns>
  1910. public async Task UpdateVentilatorFileByIdAsync(VentilatorFile ventilatorFile)
  1911. {
  1912. await ServerProxy.AdminService.UpdateVentilatorFileByIdAsync(_session.Id, ventilatorFile);
  1913. }
  1914. /// <summary>
  1915. /// Download the Ventilator Files
  1916. /// </summary>
  1917. /// <param name="ventilatorIdList"></param>
  1918. /// <param name="deviceParameterList"></param>
  1919. /// <returns></returns>
  1920. public async Task<byte[]> DownloadVentilatorFilesAsync(List<long> ventilatorIdList, List<DeviceParameter> deviceParameterList)
  1921. {
  1922. return await ServerProxy.AdminService.DownloadVentilatorFilesAsync(_session.Id, ventilatorIdList, deviceParameterList);
  1923. }
  1924. /// <summary>
  1925. /// Get the VentilatorFileVersion count.
  1926. /// </summary>
  1927. /// <returns>The count of the VentilatorFileVersion.</returns>
  1928. public async Task<int> GetVentilatorFileVersionCountAsync(long ventilatorFileId)
  1929. {
  1930. return await ServerProxy.AdminService.GetVentilatorFileVersionCountAsync(_session.Id, ventilatorFileId);
  1931. }
  1932. /// <summary>
  1933. /// Get VentilatorFileVersion items.
  1934. /// </summary>
  1935. /// <param name="pageIndex">The index of the page.</param>
  1936. /// <param name="pageSize">The size of the page.</param>
  1937. /// <returns>The loaded VentilatorFileVersions</returns>
  1938. public async Task<List<VentilatorFileVersion>> GetVentilatorFileVersionsAsync(long ventilatorFileId, int pageIndex, int pageSize)
  1939. {
  1940. return await ServerProxy.AdminService.GetVentilatorFileVersionsAsync(_session.Id, ventilatorFileId, pageIndex, pageSize);
  1941. }
  1942. /// <summary>
  1943. /// Delete VentilatorFile by Id
  1944. /// </summary>
  1945. /// <param name="ventilatorFileId"></param>
  1946. /// <returns></returns>
  1947. public async Task DeleteVentilatorFileByIdAsync(long ventilatorFileId)
  1948. {
  1949. await ServerProxy.AdminService.DeleteVentilatorFileByIdAsync(_session.Id, ventilatorFileId);
  1950. }
  1951. /// <summary>
  1952. /// Sync the Ventilator Files
  1953. /// </summary>
  1954. /// <returns></returns>
  1955. public async Task<OpResult> SyncVentilatorFilesAsync(long organizationId)
  1956. {
  1957. return await ServerProxy.AdminService.SyncVentilatorFilesAsync(_session.Id, organizationId);
  1958. }
  1959. /// <summary>
  1960. /// 获取呼吸机参数信息
  1961. /// </summary>
  1962. /// <param name="id"></param>
  1963. /// <returns></returns>
  1964. public async Task<VentilatorParameterInfo> GetVentilatorParameterInfoByIdAsync(long id)
  1965. {
  1966. return await ServerProxy.AdminService.GetVentilatorParameterInfoByIdAsync(_session.Id, id);
  1967. }
  1968. #endregion 呼吸机数据管理
  1969. #region HandyTool Client
  1970. /// <summary>
  1971. /// Add one HandyTool client.
  1972. /// </summary>
  1973. /// <param name="version">The version of HandyTool client.</param>
  1974. /// <param name="description">The description of HandyTool client.</param>
  1975. /// <param name="clientData">The data of the HandyTool client.</param>
  1976. /// <returns></returns>
  1977. public async Task AddHandyToolClientAsync(string fileName, string version, string description, byte[] clientData)
  1978. {
  1979. await ServerProxy.AdminService.AddHandyToolClientAsync(_session.Id, fileName, version, description, clientData);
  1980. }
  1981. /// <summary>
  1982. /// Get the HandyTool client infos.
  1983. /// </summary>
  1984. /// <returns>The found HandyTool client infos.</returns>
  1985. public async Task<List<ClientUpgradeInfo>> GetHandyToolClientInfosAsync(int pageIndex, int pageSize, string keyword)
  1986. {
  1987. return await ServerProxy.AdminService.GetHandyToolClientInfosAsync(_session.Id, pageIndex, pageSize, keyword);
  1988. }
  1989. /// <summary>
  1990. /// Get all HandyTool client infos count.
  1991. /// </summary>
  1992. /// <returns>All HandyTool client infos count.</returns>
  1993. public async Task<int> GetHandyToolClientInfosCountAsync()
  1994. {
  1995. return await ServerProxy.AdminService.GetHandyToolClientInfosCountAsync(_session.Id);
  1996. }
  1997. /// <summary>
  1998. /// Set HandyTool client to default one.
  1999. /// </summary>
  2000. /// <param name="HandyToolClientInfoId">The id of the HandyTool client info</param>
  2001. /// <returns></returns>
  2002. public async Task SetDefaultHandyToolClientInfoAsync(long HandyToolClientInfoId)
  2003. {
  2004. await ServerProxy.AdminService.SetDefaultHandyToolClientAsync(_session.Id, HandyToolClientInfoId);
  2005. }
  2006. /// <summary>
  2007. /// Delete one HandyTool client info
  2008. /// </summary>
  2009. /// <returns></returns>
  2010. public async Task DeleteHandyToolClientInfoAsync(long id)
  2011. {
  2012. await ServerProxy.AdminService.DeleteHandyToolClientInfoAsync(_session.Id, id);
  2013. }
  2014. #endregion HandyTool Client
  2015. #region GatherCategory
  2016. /// <summary>
  2017. /// Create Gather Category
  2018. /// </summary>
  2019. /// <returns></returns>
  2020. public async Task CreateGatherCategoryAsync(string name, EntityBase organziation, List<EntityBase> gatherers)
  2021. {
  2022. await ServerProxy.AdminService.CreateGatherCategoryAsync(_session.Id, name, organziation, gatherers);
  2023. }
  2024. /// <summary>
  2025. /// Update Gather Category
  2026. /// </summary>
  2027. /// <returns></returns>
  2028. public async Task UpdateGatherCategoryAsync(long id, string name, List<EntityBase> gatherers)
  2029. {
  2030. await ServerProxy.AdminService.UpdateGatherCategoryAsync(_session.Id, id, name, gatherers);
  2031. }
  2032. /// <summary>
  2033. /// get Gather Category by id
  2034. /// </summary>
  2035. /// <returns></returns>
  2036. public async Task<GatherCategory> GetGatherCategoryByIdAsync(long id)
  2037. {
  2038. return await ServerProxy.AdminService.GetGatherCategoryByIdAsync(_session.Id, id);
  2039. }
  2040. /// <summary>
  2041. /// Get Gather Categories
  2042. /// </summary>
  2043. /// <returns></returns>
  2044. public async Task<List<GatherCategory>> GetGatherCategoriesByOrganizationIdAsync(long organizationId)
  2045. {
  2046. return await ServerProxy.AdminService.GetGatherCategoriesByOrganizationIdAsync(_session.Id, organizationId);
  2047. }
  2048. /// <summary>
  2049. /// Get Gather Categories
  2050. /// </summary>
  2051. /// <returns></returns>
  2052. public async Task<List<GatherCategory>> GetGatherCategoriesAsync(int pageIndex, int pageSize, SearchGatherCategoryModel searchGatherCategoryModel)
  2053. {
  2054. return await ServerProxy.AdminService.GetGatherCategoriesAsync(_session.Id, pageIndex, pageSize, searchGatherCategoryModel);
  2055. }
  2056. /// <summary>
  2057. /// Get Gather Categories Count
  2058. /// </summary>
  2059. /// <returns></returns>
  2060. public async Task<long> GetGatherCategoriesCountAsync(SearchGatherCategoryModel searchGatherCategoryModel)
  2061. {
  2062. return await ServerProxy.AdminService.GetGatherCategoriesCountAsync(_session.Id, searchGatherCategoryModel);
  2063. }
  2064. /// <summary>
  2065. /// Create Gather Data
  2066. /// </summary>
  2067. /// <returns></returns>
  2068. public async Task CreateGatherDataAsync(CategoryItem category, EntityBase organziation, EntityBase gatherer, string modelType, string source, int collectionQuantity, DateTime startTime, DateTime endTime, DateTime settlementTime)
  2069. {
  2070. await ServerProxy.AdminService.CreateGatherDataAsync(_session.Id, category, organziation, gatherer, modelType, source, collectionQuantity, startTime, endTime, settlementTime);
  2071. }
  2072. /// <summary>
  2073. /// Update Gather Data
  2074. /// </summary>
  2075. /// <returns></returns>
  2076. public async Task UpdateGatherDataAsync(long id, CategoryItem category, EntityBase organziation, EntityBase gatherer, string modelType, string source, int collectionQuantity, DateTime startTime, DateTime endTime, DateTime settlementTime)
  2077. {
  2078. await ServerProxy.AdminService.UpdateGatherDataAsync(_session.Id, id, category, organziation, gatherer, modelType, source, collectionQuantity, startTime, endTime, settlementTime);
  2079. }
  2080. /// <summary>
  2081. /// get Gather Data by id
  2082. /// </summary>
  2083. /// <returns></returns>
  2084. public async Task<GatherData> GetGatherDataByIdAsync(long id)
  2085. {
  2086. return await ServerProxy.AdminService.GetGatherDataByIdAsync(_session.Id, id);
  2087. }
  2088. /// <summary>
  2089. /// Get Gather Datas
  2090. /// </summary>
  2091. /// <returns></returns>
  2092. public async Task<List<GatherData>> GetGatherDatasAsync(int pageIndex, int pageSize, SearchGatherDataModel searchGatherDataModel)
  2093. {
  2094. return await ServerProxy.AdminService.GetGatherDatasAsync(_session.Id, pageIndex, pageSize, searchGatherDataModel);
  2095. }
  2096. /// <summary>
  2097. /// Get Gather Datas Count
  2098. /// </summary>
  2099. /// <returns></returns>
  2100. public async Task<long> GetGatherDatasCountAsync(SearchGatherDataModel searchGatherDataModel)
  2101. {
  2102. return await ServerProxy.AdminService.GetGatherDatasCountAsync(_session.Id, searchGatherDataModel);
  2103. }
  2104. #endregion GatherCategory
  2105. #region 定价管理
  2106. /// <summary>
  2107. /// 获取个体定价数据
  2108. /// </summary>
  2109. /// <param name="organizationId">组织Id</param>
  2110. /// <param name="type">标注/审核/采集类型</param>
  2111. /// <returns></returns>
  2112. public async Task<List<IndividualPrice>> GetIndividualPricesAsync(long organizationId, DataProcessingType type)
  2113. {
  2114. return await ServerProxy.AdminService.GetIndividualPricesAsync(_session.Id, organizationId, type);
  2115. }
  2116. /// <summary>
  2117. /// 新增个体定价
  2118. /// </summary>
  2119. /// <param name="item"></param>
  2120. /// <returns></returns>
  2121. public async Task CreateIndividualPriceAsync(IndividualPrice item)
  2122. {
  2123. await ServerProxy.AdminService.CreateIndividualPriceAsync(_session.Id, item);
  2124. }
  2125. /// <summary>
  2126. /// 更新个体定价
  2127. /// </summary>
  2128. /// <param name="price"></param>
  2129. /// <returns></returns>
  2130. public async Task UpdateIndividualPriceAsync(long id, double price)
  2131. {
  2132. await ServerProxy.AdminService.UpdateIndividualPriceAsync(_session.Id, id, price);
  2133. }
  2134. /// <summary>
  2135. /// 获取个体系数
  2136. /// </summary>
  2137. /// <param name="pageIndex">The index of page.</param>
  2138. /// <param name="pageSize">The item count per page.</param>
  2139. /// <param name="keyword">The searched keyword.</param>
  2140. /// <returns>The loaded developers.</returns>
  2141. public async Task<List<IndividualCoefficient>> GetIndividualCoefficientsAsync(int pageIndex, int pageSize, string keyword, long organizationId)
  2142. {
  2143. return await ServerProxy.AdminService.GetIndividualCoefficientsAsync(_session.Id, pageIndex, pageSize, keyword, organizationId);
  2144. }
  2145. /// <summary>
  2146. /// 获取个体系数数量
  2147. /// </summary>
  2148. /// <param name="keyword">The searched keyword.</param>
  2149. /// <returns>The developer count.</returns>
  2150. public async Task<int> GetIndividualCoefficientsCountAsync(string keyword, long organizationId)
  2151. {
  2152. return await ServerProxy.AdminService.GetIndividualCoefficientsCountAsync(_session.Id, keyword, organizationId);
  2153. }
  2154. /// <summary>
  2155. /// 新增个体系数
  2156. /// </summary>
  2157. /// <param name="item"></param>
  2158. /// <returns></returns>
  2159. public async Task CreateIndividualCoefficientAsync(IndividualCoefficient item)
  2160. {
  2161. await ServerProxy.AdminService.CreateIndividualCoefficientAsync(_session.Id, item);
  2162. }
  2163. /// <summary>
  2164. /// 更新个体系数
  2165. /// </summary>
  2166. /// <param name="item"></param>
  2167. /// <returns></returns>
  2168. public async Task UpdateIndividualCoefficientAsync(long id, double labelPriceCoefficient, double labelQuantityCoefficient, DateTime? startEffectiveTime, DateTime? endEffectiveTime)
  2169. {
  2170. await ServerProxy.AdminService.UpdateIndividualCoefficientAsync(_session.Id, id, labelPriceCoefficient, labelQuantityCoefficient, startEffectiveTime, endEffectiveTime);
  2171. }
  2172. /// <summary>
  2173. /// 删除个体系数
  2174. /// </summary>
  2175. /// <returns></returns>
  2176. public async Task DeleteIndividualCoefficientAsync(long id)
  2177. {
  2178. await ServerProxy.AdminService.DeleteIndividualCoefficientAsync(_session.Id, id);
  2179. }
  2180. /// <summary>
  2181. /// 获取机构定价
  2182. /// </summary>
  2183. /// <param name="pageIndex">The index of page.</param>
  2184. /// <param name="pageSize">The item count per page.</param>
  2185. /// <returns>The loaded developers.</returns>
  2186. public async Task<List<InstitutionalPrice>> GetInstitutionalPricesAsync(int pageIndex, int pageSize, long organizationId, long institutionId)
  2187. {
  2188. return await ServerProxy.AdminService.GetInstitutionalPricesAsync(_session.Id, pageIndex, pageSize, organizationId, institutionId);
  2189. }
  2190. /// <summary>
  2191. /// 获取机构定价数量
  2192. /// </summary>
  2193. /// <returns>The developer count.</returns>
  2194. public async Task<int> GetInstitutionalPricesCountAsync(long organizationId, long institutionId)
  2195. {
  2196. return await ServerProxy.AdminService.GetInstitutionalPricesCountAsync(_session.Id, organizationId, institutionId);
  2197. }
  2198. /// <summary>
  2199. /// 新增机构定价
  2200. /// </summary>
  2201. /// <param name="item"></param>
  2202. /// <returns></returns>
  2203. public async Task CreateInstitutionalPriceAsync(InstitutionalPrice item)
  2204. {
  2205. await ServerProxy.AdminService.CreateInstitutionalPriceAsync(_session.Id, item);
  2206. }
  2207. /// <summary>
  2208. /// 更新机构定价
  2209. /// </summary>
  2210. /// <param name="item"></param>
  2211. /// <returns></returns>
  2212. public async Task UpdateInstitutionalPriceAsync(long id, double labelPrice, double reviewPrice, double gatherPrice, double labelPriceCoefficient, double labelQuantityCoefficient, DateTime? startEffectiveTime, DateTime? endEffectiveTime)
  2213. {
  2214. await ServerProxy.AdminService.UpdateInstitutionalPriceAsync(_session.Id, id, labelPrice, reviewPrice, gatherPrice, labelPriceCoefficient, labelQuantityCoefficient, startEffectiveTime, endEffectiveTime);
  2215. }
  2216. /// <summary>
  2217. /// 删除机构定价
  2218. /// </summary>
  2219. /// <returns></returns>
  2220. public async Task DeleteInstitutionalPriceAsync(long id)
  2221. {
  2222. await ServerProxy.AdminService.DeleteInstitutionalPriceAsync(_session.Id, id);
  2223. }
  2224. /// <summary>
  2225. /// 创建定价相关操作记录
  2226. /// </summary>
  2227. /// <param name="item"></param>
  2228. /// <returns></returns>
  2229. public async Task CreatePricingOperateLogAsync(PricingOperateLog item)
  2230. {
  2231. await ServerProxy.AdminService.CreatePricingOperateLogAsync(_session.Id, item);
  2232. }
  2233. /// <summary>
  2234. /// 获取定价相关操作记录
  2235. /// </summary>
  2236. /// <returns></returns>
  2237. public async Task<List<PricingOperateLog>> GetPricingOperateLogsAsync(int pageIndex, int pageSize, long id, PricingType type)
  2238. {
  2239. return await ServerProxy.AdminService.GetPricingOperateLogsAsync(_session.Id, pageIndex, pageSize, id, type);
  2240. }
  2241. /// <summary>
  2242. /// 获取定价相关操作记录数量
  2243. /// </summary>
  2244. /// <returns></returns>
  2245. public async Task<int> GetPricingOperateLogsCountAsync(long id, PricingType type)
  2246. {
  2247. return await ServerProxy.AdminService.GetPricingOperateLogsCountAsync(_session.Id, id, type);
  2248. }
  2249. #endregion 定价管理
  2250. }
  2251. }