private FullItem CreateItem(string title, FullItemDataRepository dataRepository) { FullItem newItem = dataRepository.Create(); newItem.ShortText = title; newItem.LongText = title; newItem.SetChoicesSingle("2"); newItem.SetChoicesMultiple(new string[] { "1", "2" }); newItem.YesNo = true; newItem.DateTime = new DateTime(1991, 12, 23); newItem.Number = 999; newItem.GuidField = new Guid("22200000-0000-0000-0000-000000000222"); newItem.ArrayOfGuids = new Guid[] { newItem.GuidField, newItem.GuidField, newItem.GuidField }; newItem.Address = this.GetAddress(); newItem.AddRelatedDynamicModuleMultiple(this.GetRelatedItem(0)); newItem.AddRelatedDynamicModuleMultiple(this.GetRelatedItem(1)); newItem.SetRelatedDynamicModuleSingle(this.GetRelatedItem(2)); newItem.AddNewsRelatedDataMultiple(this.GetNewItem(0)); newItem.AddNewsRelatedDataMultiple(this.GetNewItem(1)); newItem.SetNewsRelatedDataSingle(this.GetNewItem(2)); newItem.SetFirstClassification(this.GetFirstTaxonItem(0).Id); newItem.AddSecondClassification(this.GetSecondTaxonItem(1).Id, this.GetSecondTaxonItem(2).Id); newItem.AddMultipleImageField(this.GetImage(0)); newItem.AddMultipleImageField(this.GetImage(1)); newItem.SetSingleImageField(this.GetImage(3)); newItem.AddMultipleVideoField(this.GetVideo(0)); newItem.AddMultipleVideoField(this.GetVideo(1)); newItem.SetSingleVideoField(this.GetVideo(3)); newItem.AddMultipleFileField(this.GetDocument(0)); newItem.AddMultipleFileField(this.GetDocument(1)); newItem.SetSingleFileField(this.GetDocument(3)); return(newItem); }
protected void TestUpdate_Click(object sender, EventArgs e) { FullItemDataRepository dataRepository = new FullItemDataRepository(); FullItem item = dataRepository.GetItemById(new Guid("42dec287-ae97-616c-accb-ff00009b0b8b")); item.ShortText = "new 22 ;) updated"; item.LongText = "uhaaaa"; item.SetChoicesSingle("1"); item.SetChoicesMultiple(new string[] { "2" }); item.YesNo = false; item.DateTime = new DateTime(2000, 1, 1); item.GuidField = new Guid("32200000-0000-0000-0000-000000000223"); item.ArrayOfGuids = new Guid[] { item.GuidField, item.GuidField, item.GuidField }; Address oldAddress = item.Address; oldAddress.City = "Kanzas"; item.Address = oldAddress; //////// item.ClearRelatedDynamicModuleMultiple(); item.AddRelatedDynamicModuleMultiple(this.GetRelatedItem(2)); item.SetRelatedDynamicModuleSingle(this.GetRelatedItem(0)); item.AddNewsRelatedDataMultiple(this.GetNewItem(2)); item.SetNewsRelatedDataSingle(this.GetNewItem(2)); item.SetFirstClassification(this.GetFirstTaxonItem(1).Id); item.ClearSecondClassification(); item.AddSecondClassification(this.GetSecondTaxonItem(0).Id, this.GetSecondTaxonItem(1).Id); item.ClearMultipleImageField(); item.AddMultipleImageField(this.GetImage(2)); item.AddMultipleImageField(this.GetImage(3)); item.SetSingleImageField(this.GetImage(1)); item.AddMultipleVideoField(this.GetVideo(2)); item.ClearSingleVideoField(); /////// dataRepository.Commit(); dataRepository.Publish(item); dataRepository.Commit(); }