当前位置: 首页>>代码示例>>C#>>正文


C# ValidationResults.AddResult方法代码示例

本文整理汇总了C#中ValidationResults.AddResult方法的典型用法代码示例。如果您正苦于以下问题:C# ValidationResults.AddResult方法的具体用法?C# ValidationResults.AddResult怎么用?C# ValidationResults.AddResult使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在ValidationResults的用法示例。


在下文中一共展示了ValidationResults.AddResult方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: EntityValidation

 public void EntityValidation(ValidationResults results)
 {
     //--- Required
     if (bill_of_material_head_id == null)
     {
         ValidationResult result = new ValidationResult(string.Format(ErrorMessage.IsRequired, "Bill Of Material Head"), this, string.Empty, string.Empty, null);
         results.AddResult(result);
     }
     if (IsCheckedMaterial && material_id == null)
     {
         ValidationResult result = new ValidationResult(string.Format(ErrorMessage.IsRequired, "Material"), this, string.Empty, string.Empty, null);
         results.AddResult(result);
     }
     else if (!IsCheckedMaterial && bill_of_material_head_id_sub == null)
     {
         ValidationResult result = new ValidationResult(string.Format(ErrorMessage.IsRequired, "BOM"), this, string.Empty, string.Empty, null);
         results.AddResult(result);
     }
     if (amount == null)
     {
         ValidationResult result = new ValidationResult(string.Format(ErrorMessage.IsRequired, "Amount"), this, string.Empty, string.Empty, null);
         results.AddResult(result);
     }
     if (lost_factor == null)
     {
         ValidationResult result = new ValidationResult(string.Format(ErrorMessage.IsRequired, "Lost Factor"), this, string.Empty, string.Empty, null);
         results.AddResult(result);
     }
 }
开发者ID:hpbaotho,项目名称:pos-project-th,代码行数:29,代码来源:BillOfMaterialDetail.cs

示例2: EntityValidation

 public void EntityValidation(ValidationResults results)
 {
     //--- Required
     if (string.IsNullOrEmpty(employee_no))
     {
         ValidationResult result = new ValidationResult(string.Format(ErrorMessage.IsRequired, "Employee No"), this, string.Empty, string.Empty, null);
         results.AddResult(result);
     }
     if (string.IsNullOrEmpty(first_name))
     {
         ValidationResult result = new ValidationResult(string.Format(ErrorMessage.IsRequired, "First Name"), this, string.Empty, string.Empty, null);
         results.AddResult(result);
     }
     if (string.IsNullOrEmpty(last_name))
     {
         ValidationResult result = new ValidationResult(string.Format(ErrorMessage.IsRequired, "Last Name"), this, string.Empty, string.Empty, null);
         results.AddResult(result);
     }
     if (string.IsNullOrEmpty(user_name))
     {
         ValidationResult result = new ValidationResult(string.Format(ErrorMessage.IsRequired, "User Name"), this, string.Empty, string.Empty, null);
         results.AddResult(result);
     }
     if (string.IsNullOrEmpty(user_password))
     {
         ValidationResult result = new ValidationResult(string.Format(ErrorMessage.IsRequired, "Password"), this, string.Empty, string.Empty, null);
         results.AddResult(result);
     }
 }
开发者ID:hpbaotho,项目名称:pos-project-th,代码行数:29,代码来源:Employee.cs

示例3: EntityValidation

        public void EntityValidation(ValidationResults results)
        {
            //--- Required
            if (menu_id == null)
            {
                ValidationResult result = new ValidationResult(string.Format(ErrorMessage.IsRequired, "Menu"), this, string.Empty, string.Empty, null);
                results.AddResult(result);
            }
            if (bill_of_material_head_id == null)
            {
                ValidationResult result = new ValidationResult(string.Format(ErrorMessage.IsRequired, "Bill of Material Head"), this, string.Empty, string.Empty, null);
                results.AddResult(result);
            }
            if (quantity == null)
            {
                ValidationResult result = new ValidationResult(string.Format(ErrorMessage.IsRequired, "Quantity"), this, string.Empty, string.Empty, null);
                results.AddResult(result);
            }

            //---
            if (quantity <= 0)
            {
                ValidationResult result = new ValidationResult(string.Format(ErrorMessage.CompareValueMore, "Quantity", 0), this, string.Empty, string.Empty, null);
                results.AddResult(result);
            }
        }
开发者ID:hpbaotho,项目名称:pos-project-th,代码行数:26,代码来源:MenuMapping.cs

示例4: ValidateCourseCanOnlyBeChoosenASingleTime

        /// <summary>
        /// Un curs poate fi ales cel mult o data de catre un student.
        /// </summary>
        /// <param name="student"></param>
        /// <param name="results"></param>
        internal void ValidateCourseCanOnlyBeChoosenASingleTime(Student student, ValidationResults results)
        {
            if (student.Courses.Where(c => c.CourseId != 0).GroupBy(c => c.CourseId).Any(g => g.Count() > 1))
            {
                results.AddResult(new ValidationResult
                    (
                    "The there are duplicate courses (same id) in the list of courses chosen by the student", results, "ValidationMethod", "error", null)
                    );
                return;
            }

            if (student.Courses.Where(c => c.CourseId != 0).GroupBy(c => new { c.Name, c.Description }).Any(g => g.Count() > 1))
            {
                results.AddResult(new ValidationResult
                   (
                   "The there are duplicate courses (same name & description) in the list of courses chosen by the student", results, "ValidationMethod", "error", null)
                   );
                return;
            }

            if (student.Courses.Where(c => c.CourseId != 0).GroupBy(c => c.Name).Any(g => g.Count() > 1))
            {
                 results.AddResult(new ValidationResult
                    (
                    "The there are duplicate courses in the list of courses (same name) chosen by the student", results, "ValidationMethod", "error", null)
                    );
            }
        }
开发者ID:mnemonicflow,项目名称:EnterpriseSchoolSystem,代码行数:33,代码来源:StudentMetadata.cs

示例5: ValidationResultsWithMultipleFailureResultsIsFail

        public void ValidationResultsWithMultipleFailureResultsIsFail()
        {
            ValidationResults validationResults = new ValidationResults();

            validationResults.AddResult(new ValidationResult("message1", null, null, null, null));
            validationResults.AddResult(new ValidationResult("message2", null, null, null, null));

            Assert.IsFalse(validationResults.IsValid);
        }
开发者ID:jmeckley,项目名称:Enterprise-Library-5.0,代码行数:9,代码来源:ValidationResultsFixture.cs

示例6: ReturnsActualResultsCount

		public void ReturnsActualResultsCount()
		{
			ValidationResults validationResults = new ValidationResults();
			Assert.AreEqual(0, validationResults.Count);
			validationResults.AddResult(new ValidationResult("message1", null, null, null, null));
			Assert.AreEqual(1, validationResults.Count);
			validationResults.AddResult(new ValidationResult("message2", null, null, null, null));
			Assert.AreEqual(2, validationResults.Count);
		}
开发者ID:jmeckley,项目名称:Enterprise-Library-5.0,代码行数:9,代码来源:ValidationResultsFixture.cs

示例7: EntityValidation

 public void EntityValidation(ValidationResults results)
 {
     //--- Required
     if (string.IsNullOrEmpty(bill_of_material_group_code))
     {
         ValidationResult result = new ValidationResult(string.Format(ErrorMessage.IsRequired, "Bill Of Material Group Code"), this, string.Empty, string.Empty, null);
         results.AddResult(result);
     }
     if (string.IsNullOrEmpty(bill_of_material_group_name))
     {
         ValidationResult result = new ValidationResult(string.Format(ErrorMessage.IsRequired, "Bill Of Material Group Name"), this, string.Empty, string.Empty, null);
         results.AddResult(result);
     }
 }
开发者ID:hpbaotho,项目名称:pos-project-th,代码行数:14,代码来源:BillOfMaterialGroup.cs

示例8: CanEnumerateThroughNonGenericEnumeratorInterface

        public void CanEnumerateThroughNonGenericEnumeratorInterface()
        {
            ValidationResults validationResults = new ValidationResults();
            validationResults.AddResult(new ValidationResult("message1", null, null, null, null));
            validationResults.AddResult(new ValidationResult("message2", null, null, null, null));

            IEnumerator enumerator = (validationResults as IEnumerable).GetEnumerator();

            Assert.IsTrue(enumerator.MoveNext());
            Assert.AreEqual("message1", ((ValidationResult)enumerator.Current).Message);
            Assert.IsTrue(enumerator.MoveNext());
            Assert.AreEqual("message2", ((ValidationResult)enumerator.Current).Message);
            Assert.IsFalse(enumerator.MoveNext());
        }
开发者ID:jmeckley,项目名称:Enterprise-Library-5.0,代码行数:14,代码来源:ValidationResultsFixture.cs

示例9: EntityValidation

 public void EntityValidation(ValidationResults results)
 {
     //--- Required
     if (string.IsNullOrEmpty(menu_code))
     {
         ValidationResult result = new ValidationResult(string.Format(ErrorMessage.IsRequired, "Menu Code"), this, string.Empty, string.Empty, null);
         results.AddResult(result);
     }
     if (string.IsNullOrEmpty(menu_name))
     {
         ValidationResult result = new ValidationResult(string.Format(ErrorMessage.IsRequired, "Menu Name"), this, string.Empty, string.Empty, null);
         results.AddResult(result);
     }
 }
开发者ID:hpbaotho,项目名称:pos-project-th,代码行数:14,代码来源:Menu.cs

示例10: CanGetTextualRepresentationForExceptionWithMultipleValidationResults

        public void CanGetTextualRepresentationForExceptionWithMultipleValidationResults()
        {
            var results = new ValidationResults();
            results.AddResult(new ValidationResult("message1", null, null, null, null));
            results.AddResult(new ValidationResult("message2", null, "the key", null, null));
            results.AddResult(new ValidationResult("message3", null, null, null, null));
            var exception = new ArgumentValidationException(results, "param");
            var toString = exception.ToString();

            Assert.IsNotNull(toString);
            Assert.IsTrue(toString.Contains("message1"));
            Assert.IsTrue(toString.Contains("message2"));
            Assert.IsTrue(toString.Contains("message3"));
        }
开发者ID:Brar,项目名称:entlib,代码行数:14,代码来源:ArgumentValidationExceptionFixture.cs

示例11: EntityValidation

 public void EntityValidation(ValidationResults results)
 {
     //--- Required
     if (string.IsNullOrEmpty(material_code))
     {
         ValidationResult result = new ValidationResult(string.Format(ErrorMessage.IsRequired, "Material Code"), this, string.Empty, string.Empty, null);
         results.AddResult(result);
     }
     if (string.IsNullOrEmpty(material_name))
     {
         ValidationResult result = new ValidationResult(string.Format(ErrorMessage.IsRequired, "Material Name"), this, string.Empty, string.Empty, null);
         results.AddResult(result);
     }
     if (uom_id_receive == 0)
     {
         ValidationResult result = new ValidationResult(string.Format(ErrorMessage.IsRequired, "UOM Receive"), this, string.Empty, string.Empty, null);
         results.AddResult(result);
     }
     if (uom_id_count == 0)
     {
         ValidationResult result = new ValidationResult(string.Format(ErrorMessage.IsRequired, "UOM Count"), this, string.Empty, string.Empty, null);
         results.AddResult(result);
     }
     if (uom_id_use == 0)
     {
         ValidationResult result = new ValidationResult(string.Format(ErrorMessage.IsRequired, "UOM Use"), this, string.Empty, string.Empty, null);
         results.AddResult(result);
     }
     if (max_stock == 0)
     {
         ValidationResult result = new ValidationResult(string.Format(ErrorMessage.IsRequired, "Maximum Stock"), this, string.Empty, string.Empty, null);
         results.AddResult(result);
     }
     if (min_stock == 0)
     {
         ValidationResult result = new ValidationResult(string.Format(ErrorMessage.IsRequired, "Minimum Stock"), this, string.Empty, string.Empty, null);
         results.AddResult(result);
     }
     if (shelf_life == 0)
     {
         ValidationResult result = new ValidationResult(string.Format(ErrorMessage.IsRequired, "Shelf Life"), this, string.Empty, string.Empty, null);
         results.AddResult(result);
     }
     if (material_cost == 0)
     {
         ValidationResult result = new ValidationResult(string.Format(ErrorMessage.IsRequired, "Material Cost"), this, string.Empty, string.Empty, null);
         results.AddResult(result);
     }
     if (acceptable_variance == 0)
     {
         ValidationResult result = new ValidationResult(string.Format(ErrorMessage.IsRequired, "Acceptable Variance"), this, string.Empty, string.Empty, null);
         results.AddResult(result);
     }
     if (material_group_id == 0)
     {
         ValidationResult result = new ValidationResult(string.Format(ErrorMessage.IsRequired, "Material Group"), this, string.Empty, string.Empty, null);
         results.AddResult(result);
     }
 }
开发者ID:hpbaotho,项目名称:pos-project-th,代码行数:59,代码来源:Material.cs

示例12: Validate

        public void Validate(ValidationResults results)
        {
            if (string.IsNullOrEmpty(this.control_code) && this.control_parent_id == null)
            {
                ValidationResult result = new ValidationResult(ErrorMessage.ScreenCodeIsRequire, this, string.Empty, string.Empty, null);
                results.AddResult(result);
            }

            List<DuplicateItemDTO> listDuplicateItemDTO = ServiceProvider.ScreenConfigService.IsDuplication(this);
            if (listDuplicateItemDTO.Where(item => item.isDuplicate == true).FirstOrDefault() != null)
            {
                ValidationResult result = new ValidationResult(string.Format(ErrorMessage.IsDuplicate, "Screen Code"), this, string.Empty, string.Empty, null);
                results.AddResult(result);
            }
        }
开发者ID:hpbaotho,项目名称:pos-project-th,代码行数:15,代码来源:ScreenConfig.cs

示例13: ControlValidationMappingsFailureTest

        public void ControlValidationMappingsFailureTest()
        {
            IBugzillaPageView viewMock = MockRepository.StrictMock<IBugzillaPageView>();

            Expect.Call(viewMock.Model).PropertyBehavior();
            viewMock.ValidationRequested += null;
            LastCall.IgnoreArguments();
            viewMock.ControlValidationTriggered += null;
            LastCall.IgnoreArguments();
            IEventRaiser raiser = LastCall.GetEventRaiser();
            Expect.Call(FacadeMock.GetSourceList()).Return(new string[0]);
            Expect.Call(viewMock.SourceList).PropertyBehavior().Return(new string[0]);
            Expect.Call(FacadeMock.GetProjectWrapperList()).Return(null);
            Expect.Call(viewMock.VersionOneProjects).PropertyBehavior();
            Expect.Call(FacadeMock.GetVersionOnePriorities()).Return(null);
            Expect.Call(viewMock.VersionOnePriorities).PropertyBehavior();
            viewMock.DataBind();
            ValidationResults results = new ValidationResults();
            ValidationResult generalResult = new ValidationResult(string.Empty, new BugzillaProjectMapping(), null, null, null);
            results.AddResult(generalResult);
            Expect.Call(FacadeMock.ValidateEntity(viewMock.Model)).IgnoreArguments().Return(results);
            viewMock.SetGeneralTabValid(true);
            viewMock.SetMappingTabValid(false);

            MockRepository.ReplayAll();

            BugzillaController controller = CreateController();
            controller.RegisterView(viewMock);
            controller.PrepareView();
            raiser.Raise(viewMock, EventArgs.Empty);

            MockRepository.VerifyAll();
        }
开发者ID:marcinczekaj,项目名称:v1-jira-integration,代码行数:33,代码来源:BugzillaPageControllerTester.cs

示例14: DoValidateSubmit

 public void DoValidateSubmit(ValidationResults results)
 {
     if (this.Modes.Count == 0)
         results.AddResult(new ValidationResult("At least one ground transportation mode is required.",
             typeof(Ground),
             "", "", null));
 }
开发者ID:RonFields72,项目名称:TravelAndTraining,代码行数:7,代码来源:Ground.cs

示例15: Validate

        public void Validate(ValidationResults results)
        {
            string msg = string.Empty;

            if (!DateDue.HasValue)
            {
                if (OnOrder > 0)
                {
                    msg = "Must provide a delivery due date for stock on back order.";
                    results.AddResult(new ValidationResult(msg, this, "ProductSelfValidation", "", null));
                }
            }
            else
            {
                if (OnOrder == 0)
                {
                    msg = "Can specify delivery due date only when stock is on back order.";
                    results.AddResult(new ValidationResult(msg, this, "ProductSelfValidation", "", null));
                }
            }

            if (InStock + OnOrder > 100)
            {
                msg = "Total inventory (in stock and on order) cannot exceed 100 items.";
                results.AddResult(new ValidationResult(msg, this, "ProductSelfValidation", "", null));
            }
        }
开发者ID:HondaBey,项目名称:EnterpriseLibrary6,代码行数:27,代码来源:AttributedProduct.cs


注:本文中的ValidationResults.AddResult方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。