Exemplo n.º 1
0
        public ActionResult Create([Bind(Include = "HseqRecordID,AlfrescoNoderef,Title,Description,RecordType,EnteredBy,ReportedBy,HseqCaseFileID,JobNumber,DrawingNumber,status,DateCreated,DateLastUpdated,CreatedBy,LastUpdatedBy,CoordinatorID")] Car car)
        {
            if (ModelState.IsValid)
            {
                string       caseNo;
                HseqCaseFile hseqCaseFile;
                car.CreatedBy = _RecordService.GetCurrentUser().FullName;
                car           = (Car)_RecordService.CreateCaseFile(car, out caseNo, out hseqCaseFile, db);

                db.HseqRecords.Add(car);
                db.SaveChanges();

                //create the folder in Alfresco and return the alfresconoderef
                //Dummy for now

                //int alfresconoderef = caseNo;
                //hseqCaseFile.AlfrescoNoderef = caseNo;

                //car.AlfrescoNoderef = caseNo;

                db.SaveChanges();

                return(RedirectToAction("Index"));
            }

            ViewBag.HseqCaseFileID = new SelectList(db.HseqCaseFiles, "HseqCaseFileID", "HseqCaseFileID", car.HseqCaseFileID);
            ViewBag.CoordinatorID  = new SelectList(db.HseqUsers, "HseqUserID", "FullName");
            return(View(car));
        }
Exemplo n.º 2
0
        public ActionResult Create([Bind(Include = "HseqRecordID,AlfrescoNoderef,Title,Description,RecordType,EnteredBy,ReportedBy,MainRecordId,HseqCaseFileID,Category,FisSource,FisCodeID,DateCreated,DateLastUpdated,CreatedBy,LastUpdatedBy,CoordinatorID")] Fis fis)
        {
            if (ModelState.IsValid)
            {
                string       caseNo;
                HseqCaseFile hseqCaseFile;
                fis.CreatedBy = _RecordService.GetCurrentUser().FullName;
                fis           = (Fis)_RecordService.CreateCaseFile(fis, out caseNo, out hseqCaseFile, db);

                db.FisRecords.Add(fis);
                db.SaveChanges();

                //create the folder in Alfresco and return the alfresconoderef
                //Dummy for now

                //int alfresconoderef = caseNo;
                //hseqCaseFile.AlfrescoNoderef = caseNo;

                //fis.AlfrescoNoderef = caseNo;

                db.SaveChanges();

                return(RedirectToAction("Index"));
            }

            //ViewBag.BusinessAreaID = new SelectList(db.BusinessAreas, "BusinessAreaID", "Name", fis.BusinessAreaID);
            ViewBag.CodeCategoryList = new SelectList(getCodeCategoryList(), "Id", "Column1", fis.FisCodeID);
            ViewBag.HseqCaseFileID   = new SelectList(db.HseqCaseFiles, "HseqCaseFileID", "HseqCaseFileID", fis.HseqCaseFileID);
            ViewBag.CoordinatorID    = new SelectList(db.HseqUsers, "HseqUserID", "FullName");

            return(View(fis));
        }
        public ActionResult NcrGridViewNew(NcrCreateViewModel ncrVM)
        {
            if (ModelState.IsValid)
            {
                try
                {
                    if (ncrVM != null)
                    {
                        HseqCaseFile hseqCaseFile;
                        Ncr          ncr = new Ncr();
                        Mapper.Map(ncrVM, ncr);

                        ncr = (Ncr)_RecordService.CreateCaseFile(ncr, out hseqCaseFile, db);

                        db.HseqRecords.Add(ncr);
                        db.SaveChanges();

                        //create the folder in Alfresco and return the alfresconoderef
                        //Dummy for now

                        //int alfresconoderef = caseNo;
                        //hseqCaseFile.AlfrescoNoderef = caseNo;

                        //car.AlfrescoNoderef = caseNo;
                    }
                }
                catch (Exception e)
                {
                    ViewData["EditError"] = e.Message;
                    return(PartialView("_NcrNewView", ncrVM));
                }
            }
            else
            {
                var errors = ModelState.Values.SelectMany(v => v.Errors);
                Console.WriteLine(errors);
                ViewData["EditError"] = "Please, correct all errors.";
                return(PartialView("_NcrNewView", ncrVM));
            }
            return(PartialView("_MainContentCallbackPanel"));
        }
Exemplo n.º 4
0
        public ActionResult Create(NcrVM ncrVM)
        {
            if (ModelState.IsValid)
            {
                Ncr ncr = ncrVM.Ncr;

                string       caseNo;
                HseqCaseFile hseqCaseFile;
                ncr.CreatedBy = _RecordService.GetCurrentUser().FullName;
                ncr           = (Ncr)_RecordService.CreateCaseFile(ncr, out caseNo, out hseqCaseFile, db);

                db.NcrRecords.Add(ncrVM.Ncr);
                db.SaveChanges();

                //create the folder in Alfresco and return the alfresconoderef
                //Dummy for now

                //int alfresconoderef = caseNo;
                //hseqCaseFile.AlfrescoNoderef = caseNo;

                //ncr.AlfrescoNoderef = caseNo;

                //Create Approvals
                if (ncrVM.ProposedDisposition)
                {
                    HseqApprovalRequest hseqApprovalRequest = ncrVM.HseqApprovalRequest;
                    HseqApprovalRequest approvalRequest     = _DelegatableService.AddHseqApprovalRequest(ncr, hseqApprovalRequest, db);

                    Ncr ncr2 = db.NcrRecords.Find(ncr.HseqRecordID);
                    ncr2.Delegatables.Add(approvalRequest);
                    db.SaveChanges();
                }

                return(RedirectToAction("Index"));
            }
            else
            {
                var errors = ModelState.Values.SelectMany(v => v.Errors);
                Console.WriteLine(errors);
            }

            ncrVM.DetectedInAreas  = db.BusinessAreas;
            ncrVM.ResponsibleAreas = db.BusinessAreas;
            ncrVM.DiscrepancyTypes = db.DiscrepancyTypes;
            ncrVM.Coordinators     = db.HseqUsers;
            ncrVM.DispositionTypes = db.DispositionTypes;
            ncrVM.ApprovalOwners   = db.HseqUsers;

            return(View(ncrVM));
        }