/// <summary> /// 部門一覧の取得 /// </summary> /// <remarks> /// 指定した事業所の部門一覧を取得する /// </remarks> /// <param name='operations'> /// The operations group for this extension method. /// </param> /// <param name='companyId'> /// 事業所ID /// </param> /// <param name='cancellationToken'> /// The cancellation token. /// </param> public static async Task <SectionsIndexResponse> ListAsync(this ISections operations, int companyId, CancellationToken cancellationToken = default(CancellationToken)) { using (var _result = await operations.ListWithHttpMessagesAsync(companyId, null, cancellationToken).ConfigureAwait(false)) { return(_result.Body); } }
/// <summary> /// 部門の更新 /// </summary> /// <remarks> /// 指定した事業所の部門を更新する /// </remarks> /// <param name='operations'> /// The operations group for this extension method. /// </param> /// <param name='id'> /// </param> /// <param name='parameters'> /// 部門の更新 /// </param> /// <param name='cancellationToken'> /// The cancellation token. /// </param> public static async Task <SectionsUpdateResponse> UpdateAsync(this ISections operations, int id, SectionParams parameters = default(SectionParams), CancellationToken cancellationToken = default(CancellationToken)) { using (var _result = await operations.UpdateWithHttpMessagesAsync(id, parameters, null, cancellationToken).ConfigureAwait(false)) { return(_result.Body); } }
public CommittedProjects(ICommitted committedRepo, ISections sectionsRepo) { this.committedRepo = committedRepo; this.sectionsRepo = sectionsRepo; List <CommittedEntity> GetAnyProjects(int id, BridgeCareContext db, UserInformationModel userInformation) => committedRepo.GetCommittedProjects(id, db); List <CommittedEntity> GetPermittedProjects(int id, BridgeCareContext db, UserInformationModel userInformation) => committedRepo.GetPermittedCommittedProjects(id, db, userInformation.Name); void SaveAnyProjects(List <CommittedProjectModel> models, BridgeCareContext db, UserInformationModel userInformation) => committedRepo.SaveCommittedProjects(models, db); void SavePermittedProjects(List <CommittedProjectModel> models, BridgeCareContext db, UserInformationModel userInformation) => committedRepo.SavePermittedCommittedProjects(models, db, userInformation.Name); CommittedProjectsGetMethods = new Dictionary <string, CommittedProjectsGetMethod> { [Role.ADMINISTRATOR] = GetAnyProjects, [Role.DISTRICT_ENGINEER] = GetPermittedProjects, [Role.CWOPA] = GetPermittedProjects, [Role.PLANNING_PARTNER] = GetPermittedProjects }; CommittedProjectsSaveMethods = new Dictionary <string, CommittedProjectsSaveMethod> { [Role.ADMINISTRATOR] = SaveAnyProjects, [Role.DISTRICT_ENGINEER] = SavePermittedProjects, [Role.CWOPA] = SavePermittedProjects, [Role.PLANNING_PARTNER] = SavePermittedProjects }; }
public WordDocument( IReadOnlyCollection <IExternalHyperLink> externalHyperLinks, IReadOnlyCollection <IWord> words, IReadOnlyCollection <ITable> tables, IReadOnlyCollection <IShape> shapes, IListOfShapes listOfShapes, IListOfTables listOfTables, ISections sections) { Guard.ObjectNotNull(() => externalHyperLinks); Guard.ObjectNotNull(() => words); Guard.ObjectNotNull(() => tables); Guard.ObjectNotNull(() => shapes); Guard.ObjectNotNull(() => listOfShapes); Guard.ObjectNotNull(() => listOfTables); ExternalHyperLinks = externalHyperLinks; Words = words; Tables = tables; Shapes = shapes; ListOfShapes = listOfShapes; ListOfTables = listOfTables; Sections = sections; }
/// <summary> /// 部門の削除 /// </summary> /// <remarks> /// 指定した事業所の部門を削除する /// </remarks> /// <param name='operations'> /// The operations group for this extension method. /// </param> /// <param name='id'> /// </param> /// <param name='companyId'> /// 事業所ID /// </param> /// <param name='cancellationToken'> /// The cancellation token. /// </param> public static async Task DestroyAsync(this ISections operations, int id, int companyId, CancellationToken cancellationToken = default(CancellationToken)) { (await operations.DestroyWithHttpMessagesAsync(id, companyId, null, cancellationToken).ConfigureAwait(false)).Dispose(); }
public async Task <IWordDocument> LoadAsync(string filePath) { nat.Application app = null; nat.Document doc = null; try { app = new nat.Application(); doc = app.Documents.Open(filePath); IReadOnlyCollection <IExternalHyperLink> externalLinks = null; IReadOnlyCollection <IWord> words = null; IReadOnlyCollection <ITable> tables = null; IReadOnlyCollection <IShape> shapes = null; IListOfShapes listOfShapes = null; IListOfTables listOfTables = null; ISections sections = null; var tasks = new List <Task> { Task.Run( async() => { Console.WriteLine($"{ DateTime.Now.ToLongTimeString() } starting words"); words = await _wordFactory.CreateAllAsync(doc); Console.WriteLine($"{ DateTime.Now.ToLongTimeString() } finished words"); }), Task.Run( async() => { Console.WriteLine($"{ DateTime.Now.ToLongTimeString() } starting externalLinks"); externalLinks = await _externalHyperLinkFactory.CreateAllAsync(doc); Console.WriteLine($"{ DateTime.Now.ToLongTimeString() } finished externalLinks"); }), Task.Run( async() => { Console.WriteLine($"{ DateTime.Now.ToLongTimeString() } starting tables"); tables = await _tableFactory.CreateAllAsync(doc); Console.WriteLine($"{ DateTime.Now.ToLongTimeString() } finished tables"); }), Task.Run( async() => { Console.WriteLine($"{ DateTime.Now.ToLongTimeString() } starting shapes"); shapes = await _shapeFactory.CreateAllAsync(doc); Console.WriteLine($"{ DateTime.Now.ToLongTimeString() } finished shapes"); }), Task.Run( async() => { Console.WriteLine($"{ DateTime.Now.ToLongTimeString() } starting listOfShapes"); listOfShapes = await _listFactory.CreateListOfShapesAsync(doc); Console.WriteLine($"{ DateTime.Now.ToLongTimeString() } finished listOfShapes"); }), Task.Run( async() => { Console.WriteLine($"{ DateTime.Now.ToLongTimeString() } starting listOfTables"); listOfTables = await _listFactory.CreateListOfTablesAsync(doc); Console.WriteLine($"{ DateTime.Now.ToLongTimeString() } finished listOfTables"); }), Task.Run( async() => { Console.WriteLine($"{ DateTime.Now.ToLongTimeString() } starting sections"); sections = await _sectionsFactory.CreateAsync(doc); Console.WriteLine($"{ DateTime.Now.ToLongTimeString() } finished sections"); }) }; await Task.WhenAll(tasks); IWordDocument result = new WordDocument( externalLinks, words, tables, shapes, listOfShapes, listOfTables, sections); return(result); } finally { if (doc != null) { doc.Close(); Marshal.ReleaseComObject(doc); } if (app != null) { app.Quit(); Marshal.ReleaseComObject(app); } _wordKiller.KillAllInstances(); } }
public CommittedProjects(ICommitted committedRepo, ISections sectionsRepo) { this.committedRepo = committedRepo; this.sectionsRepo = sectionsRepo; }