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); }
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() } }); }
public DepartmentController() { departmentBo = new DepartmentBo(ModelState); }
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); }