public ActionResult Edit(int id, FormCollection form)
        {
            var claimPartSvc = new ClaimPartLogic(Ticket);
            var partSvc = new PartLogic(Ticket);
            var partTypeSvc = new PartTypeLogic(Ticket);

            var partId = StringUtility.ToInt(form["partId"]);
            var partTypeId = StringUtility.ToInt(form["partTypeId"]);

            var partObj = partSvc.GetById(partId);
            var partTypeObj = partTypeSvc.GetById(partTypeId);

            var obj = claimPartSvc.GetById(id);
            if (partObj != null)
            {
                obj.Part.Id = partObj.Id;
                obj.Part.Code = partObj.Code;
                obj.Part.Name = partObj.Name;
            }
            if (partTypeObj != null)
            {
                obj.PartType.Id = partTypeObj.Id;
                obj.PartType.Code = partTypeObj.Code;
                obj.PartType.Name = partTypeObj.Name;
            }
            obj.ReferenceNumber = form["referenceNumber"];
            obj.PurchaseDate = StringUtility.ToDateTime(form["purchaseDate"]);
            obj.Quantity = StringUtility.ToDecimal(form["quantity"]);

            claimPartSvc.Save(obj);

            return RedirectToAction("Display", "WarrantyClaim", new { id = obj.ClaimId });
        }
Esempio n. 2
0
        public ActionResult GetPart(string code)
        {
            var partSvc = new PartLogic(Ticket);
            var ajaxObj = partSvc.GetAjax(code);

            return Json(ajaxObj, JsonRequestBehavior.AllowGet);
        }
Esempio n. 3
0
        public ActionResult Part(SearchRequest request)
        {
            ViewData["code"] = request.Code;
            ViewData["name"] = request.Name;
            ViewData["limit"] = request.Limit;

            var partSvc = new PartLogic(Ticket);
            var results = partSvc.Search(request);

            ViewData.Model = results;
            ViewData.Add("resultsCount", results.Count);

            return View();
        }