public BaseResultType Validate(DefaultParamOfCRUDOperation <Core.Data.Domain.House> item) { BaseResultType baseResultType = new BaseResultType() { Status = ResultStatus.Success }; if (item.Item.CountOfEntrance == null) { //WarningQuestion question = new WarningQuestion() //{ // Id = "1", // Message = "Отсутствует количество подъездов" //}; //baseResultType.AddWarring(question); if (!item.IsSendAndAnswerQuestion("Отсутствует количество подъездов.Продолжить?", ResultQuestionType.NO, baseResultType)) { baseResultType.AddError(" Отмена"); } } if (item.Item.CountOfFloor == null) { WarningQuestion question = new WarningQuestion() { Id = "1", Message = "Отсутствует количество этажей" }; baseResultType.AddWarring(question); } return(baseResultType); }
public BaseResultType Validate(DefaultParamOfCRUDOperation <ObjectMappingForTest> item) { BaseResultType baseResultType = new BaseResultType() { Status = ResultStatus.Success }; if (String.IsNullOrWhiteSpace(item.Item.StrValue)) { WarningQuestion question = new WarningQuestion() { Id = "1", Message = "Отсутствует строка" }; baseResultType.AddWarring(question); } return(baseResultType); }
public BaseResultType Validate(DefaultParamOfCRUDOperation <ObjectMappingForTest> item) { BaseResultType baseResultType = new BaseResultType() { Status = ResultStatus.Success }; if (String.IsNullOrWhiteSpace(item.Item.StrValue)) { if (!item.IsSendAndAnswerQuestion("Продолжить?", ResultQuestionType.NO, baseResultType)) { baseResultType.AddError("Ошибка"); } } if (item.Item.IntValue2 == 22) { baseResultType.AddWarring(new WarningQuestion() { Message = "Уведомления" }); } return(baseResultType); }
public void MergeQuestionTest() { BaseResultType withQuestion = new BaseResultType(); withQuestion.AddWarring(new WarningQuestion()); BaseResultType withoutQuestion = new BaseResultType(); withQuestion.Merge(withoutQuestion); Assert.IsNotNull(withQuestion.Question); Assert.AreEqual(1, withQuestion.Question.Count); withoutQuestion.Merge(withoutQuestion); Assert.IsNotNull(withQuestion.Question); Assert.AreEqual(1, withQuestion.Question.Count); //Мерж с пустыми списками вопросов withQuestion = new BaseResultType(); withoutQuestion = new BaseResultType(); withoutQuestion.Merge(withoutQuestion); Assert.IsNotNull(withoutQuestion.Question); Assert.AreEqual(0, withoutQuestion.Question.Count); }