コード例 #1
0
        public static bool Validate(this DepartmentBo department, ILocalizedMessageProvider localizedMessageProvider, out PackagingSlipGenerationResponse response)
        {
            response = null;

            if (department == null)
            {
                response = new PackagingSlipGenerationResponse
                {
                    ErrorMessage = localizedMessageProvider.GetDepartmentNotProvidedMessage,
                    PackagingSlipGenerationResponseType = PackagingSlipGenerationResponseType.Failure
                };

                return(false);
            }

            if (department.DepartmentType != DepartmentType.Royality)
            {
                response = new PackagingSlipGenerationResponse
                {
                    ErrorMessage = localizedMessageProvider.GetDepartmentNotRoyalityMessage,
                    PackagingSlipGenerationResponseType = PackagingSlipGenerationResponseType.Failure
                };

                return(false);
            }

            return(true);
        }
コード例 #2
0
        public PackagingSlipGenerationResponse GenerateDuplicateSlip(DepartmentBo department)
        {
            PackagingSlipGenerationResponse packagingSlipGenerationResponse;

            if (!department.Validate(this.localizedMessageProvider, out packagingSlipGenerationResponse))
            {
                return(packagingSlipGenerationResponse);
            }

            return(new PackagingSlipGenerationResponse
            {
                PackagingSlipGenerationResponseType = PackagingSlipGenerationResponseType.Success,
                PackagingSlip = new PackagingSlipBo
                {
                    Id = Guid.NewGuid(),
                    Number = packagingSlipNumberGenerator.Generate()
                }
            });
        }
コード例 #3
0
 public DepartmentController()
 {
     departmentBo = new DepartmentBo(ModelState);
 }
コード例 #4
0
ファイル: CourseController.cs プロジェクト: esschuller/Teste1
 private void PopulateDepartmentsDropDownList(object selectedDepartment = null)
 {
     DepartmentBo departmentBo = new DepartmentBo(ModelState);
     var departmentsQuery = departmentBo.Get(orderBy: q => q.OrderBy(d => d.Name));
     ViewBag.DepartmentID = new SelectList(departmentsQuery, "DepartmentID", "Name", selectedDepartment);
 }