// リスト 9 private static void CallCreateDocument() { var assignMembers = new List <AssignMember>(); assignMembers.Add(new AssignMember() { UserId = "tanaka", UserName = "******" }); assignMembers.Add(new AssignMember() { UserId = "sakamoto", UserName = "******" }); RoomReservationInfo item = new RoomReservationInfo() { Id = "00001", Room = "第1会議室", Title = "Cosmos DB移行についての打ち合わせ", ReservedUserId = "daigo", ReservedUserName = "******", Start = new DateTime(2017, 5, 30, 10, 0, 0), End = new DateTime(2017, 5, 30, 11, 0, 0), AssignMembers = assignMembers }; // ドキュメント作成メソッド呼び出し var manager = new DocumentDbManager(); manager.CreateDocument(item).Wait(); }
private static void UsePostTrigger() { var manager = new DocumentDbManager(); var createResult = manager.CreatePostTrigger(@"..\..\\postTriggerExample.js").Result; var assignMembers = new List <AssignMember>(); assignMembers.Add(new AssignMember() { UserId = "tanaka", UserName = "******" }); assignMembers.Add(new AssignMember() { UserId = "sakamoto", UserName = "******" }); RoomReservationInfo item = new RoomReservationInfo() { Id = "A00004", Room = "第1会議室", Title = "Cosmos DB移行についての打ち合わせ", ReservedUserId = "daigo", ReservedUserName = "******", Start = new DateTime(2017, 6, 3, 18, 09, 0), End = new DateTime(2017, 6, 3, 10, 0, 0), AssignMembers = assignMembers }; var callResult = manager.CreateDocumentWithPostTrigger(item).Result; Console.WriteLine(callResult); }
private static void UsePreTrigger() { var manager = new DocumentDbManager(); var createResult = manager.CreatePreTrigger(@"..\..\\validatePreTrriger.js").Result; var assignMembers = new List <AssignMember>(); assignMembers.Add(new AssignMember() { UserId = "tanaka", UserName = "******" }); RoomReservationInfo item = new RoomReservationInfo() { Id = "Pre0000000001", Room = "第1会議室", Title = "プリトリガーについて打ち合わせ", ReservedUserId = "daigo", ReservedUserName = "******", Start = new DateTime(2017, 6, 30, 18, 09, 0), End = new DateTime(2017, 6, 30, 19, 0, 0), AssignMembers = assignMembers }; var callResult = manager.CreateDocumentWithPreTrigger(item).Result; Console.WriteLine(callResult); }
public async Task <Document> CreateDocument(RoomReservationInfo roomReservationInfo) { var document = await this.client.CreateDocumentAsync( UriFactory.CreateDocumentCollectionUri( DocumentDbManager.DatabaseId, DocumentDbManager.CollectionId), roomReservationInfo); return(document); }
public async Task <Document> CreateDocumentWithPreTrigger(RoomReservationInfo roomReservationInfo) { RequestOptions options = new RequestOptions(); options.PreTriggerInclude = new List <string>(); options.PreTriggerInclude.Add("validatePreTrriger"); var document = await this.client.CreateDocumentAsync( UriFactory.CreateDocumentCollectionUri( DocumentDbManager.DatabaseId, DocumentDbManager.CollectionId), roomReservationInfo, options); return(document); }
public async Task <Document> ReplaceDocument(RoomReservationInfo roomReservationInfo) { var doc = await this.client.ReplaceDocumentAsync( UriFactory.CreateDocumentUri( DocumentDbManager.DatabaseId, DocumentDbManager.CollectionId, roomReservationInfo.Id), roomReservationInfo, new RequestOptions() { AccessCondition = new AccessCondition() { Condition = roomReservationInfo._etag, Type = AccessConditionType.IfMatch } }); return(doc); }
private static void CallFindByIdWithParam() { var manager = new DocumentDbManager(); RoomReservationInfo info = manager.FindByIdWithParam("スタンディングテーブル", "0000000004"); }