Пример #1
0
        public ActionResult List()
        {
            CustomerClaim claim  = new CustomerClaim();
            var           result = claim.GetClaims();

            return(View(result));
        }
Пример #2
0
        public ActionResult AddClaims(Claim claim)
        {
            if (ModelState.IsValid)
            {
                CustomerClaim cusomerclaim = new CustomerClaim();
                if (claim.ClaimedDate > (DateTime.Now.Date))
                {
                    ViewData["Error"] = "Claim cannot be in future date";
                    return(View("ModalPopup"));
                }
                cusomerclaim.SaveClaims(claim);
                return(RedirectToAction("List", "Home"));
            }
            else
            {
                StringBuilder sb = new StringBuilder();
                sb.Append("You have a bunch of errors:");

                foreach (ModelState modelState in ModelState.Values)
                {
                    foreach (ModelError error in modelState.Errors)
                    {
                        sb.Append(error + "\n");
                    }
                }
                ViewData["Error"] = sb.ToString();
                return(RedirectToAction("List", "Home"));
            }
        }
Пример #3
0
        public async Task TestAddUpdatDelete()
        {
            AddressBook customerAddressBook = null;
            AddressBook employeeAddressBook = null;

            CustomerClaimModule CustomerClaimMod = new CustomerClaimModule();
            Udc udc = await CustomerClaimMod.Udc.Query().GetEntityById(39);

            Customer customer = await CustomerClaimMod.Customer.Query().GetEntityById(2);

            if (customer != null)
            {
                customerAddressBook = await CustomerClaimMod.AddressBook.Query().GetEntityById(customer.AddressId);
            }
            Employee employee = await CustomerClaimMod.Employee.Query().GetEntityById(3);

            if (employee != null)
            {
                employeeAddressBook = await CustomerClaimMod.AddressBook.Query().GetEntityById(employee.AddressId);
            }
            Udc groupUdc = await CustomerClaimMod.Udc.Query().GetEntityById(37);

            CustomerClaimView view = new CustomerClaimView()
            {
                ClassificationXrefId = udc.XrefId,
                Classification       = udc.Value,
                CustomerId           = customer.CustomerId,
                CustomerName         = customerAddressBook?.Name,
                Configuration        = "Javascript Dashboard",
                Note          = "larger images",
                EmployeeId    = employee?.EmployeeId ?? 0,
                EmployeeName  = employeeAddressBook?.Name,
                GroupIdXrefId = groupUdc.XrefId,
                GroupId       = groupUdc.Value,
                CreatedDate   = DateTime.Parse("11/16/2019")
            };
            NextNumber nnNextNumber = await CustomerClaimMod.CustomerClaim.Query().GetNextNumber();

            view.CustomerClaimNumber = nnNextNumber.NextNumberValue;

            CustomerClaim customerClaim = await CustomerClaimMod.CustomerClaim.Query().MapToEntity(view);

            CustomerClaimMod.CustomerClaim.AddCustomerClaim(customerClaim).Apply();

            CustomerClaim newCustomerClaim = await CustomerClaimMod.CustomerClaim.Query().GetEntityByNumber(view.CustomerClaimNumber);

            Assert.NotNull(newCustomerClaim);

            newCustomerClaim.Note = "larger image update";

            CustomerClaimMod.CustomerClaim.UpdateCustomerClaim(newCustomerClaim).Apply();

            CustomerClaimView updateView = await CustomerClaimMod.CustomerClaim.Query().GetViewById(newCustomerClaim.ClaimId);

            Assert.Same(updateView.Note, "large image update");
            CustomerClaimMod.CustomerClaim.DeleteCustomerClaim(newCustomerClaim).Apply();
            CustomerClaim lookupCustomerClaim = await CustomerClaimMod.CustomerClaim.Query().GetEntityById(view.ClaimId);

            Assert.Null(lookupCustomerClaim);
        }
Пример #4
0
        public async Task <IActionResult> DeleteCustomerClaim([FromBody] CustomerClaimView view)
        {
            CustomerClaimModule invMod        = new CustomerClaimModule();
            CustomerClaim       customerClaim = await invMod.CustomerClaim.Query().MapToEntity(view);

            invMod.CustomerClaim.DeleteCustomerClaim(customerClaim).Apply();

            return(Ok(view));
        }
Пример #5
0
 public CustomerClaimView(CustomerClaim customerClaim)
 {
     this.ClaimId        = customerClaim.ClaimId;
     this.Classification = customerClaim.UDC.Value;
     this.CustomerId     = customerClaim.CustomerId;
     this.CustomerName   = customerClaim.Customer.AddressBook.Name;
     this.Configuration  = customerClaim.Configuration;
     this.Note           = customerClaim.Note;
     this.EmployeeName   = customerClaim.Employee.AddressBook.Name;
     this.GroupId        = customerClaim.UDC1.Value;
     this.ProcessedDate  = customerClaim.ProcessedDate;
     this.CreatedDate    = customerClaim.CreatedDate;
 }
Пример #6
0
        public async Task <IActionResult> UpdateCustomerClaim([FromBody] CustomerClaimView view)
        {
            CustomerClaimModule invMod = new CustomerClaimModule();

            CustomerClaim customerClaim = await invMod.CustomerClaim.Query().MapToEntity(view);


            invMod.CustomerClaim.UpdateCustomerClaim(customerClaim).Apply();

            CustomerClaimView retView = await invMod.CustomerClaim.Query().GetViewById(customerClaim.ClaimId);


            return(Ok(retView));
        }
Пример #7
0
        public async Task <IActionResult> AddCustomerClaim([FromBody] CustomerClaimView view)
        {
            CustomerClaimModule invMod = new CustomerClaimModule();

            NextNumber nnCustomerClaim = await invMod.CustomerClaim.Query().GetNextNumber();

            view.CustomerClaimNumber = nnCustomerClaim.NextNumberValue;

            CustomerClaim customerClaim = await invMod.CustomerClaim.Query().MapToEntity(view);

            invMod.CustomerClaim.AddCustomerClaim(customerClaim).Apply();

            CustomerClaimView newView = await invMod.CustomerClaim.Query().GetViewByNumber(view.CustomerClaimNumber);


            return(Ok(newView));
        }
Пример #8
0
 public IFluentCustomerClaim DeleteCustomerClaim(CustomerClaim deleteObject)
 {
     unitOfWork.customerClaimRepository.DeleteObject(deleteObject);
     this.processStatus = CreateProcessStatus.Delete;
     return(this as IFluentCustomerClaim);
 }
Пример #9
0
 public IFluentCustomerClaim AddCustomerClaim(CustomerClaim newObject)
 {
     unitOfWork.customerClaimRepository.AddObject(newObject);
     this.processStatus = CreateProcessStatus.Insert;
     return(this as IFluentCustomerClaim);
 }