public ActionResult Preview(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            Walktrough     walktrough = db.Walktroughs.Find(id);
            BusinessProces business   = db.BusinessProcess.Find(id);

            List <RiskControlMatrix> rcmList = new List <RiskControlMatrix>();
            //List<RCMDetailRisk> rcmDetailList = new List<RCMDetailRisk>();
            List <RiskControlMatrix> rcms = db.RiskControlMatrixs.Where(p => p.WalktroughID.Equals(walktrough.WalktroughID)).ToList();

            foreach (var busProses in rcms)
            {
                rcmList.Add(busProses);
            }

            //List<RiskControlMatrix> rcmList = new List<RiskControlMatrix>();

            List <RCMDetailRiskControl>      rcmDetailControlList          = new List <RCMDetailRiskControl>();
            List <RCMDetailControlAuditStep> rcmDetailControlAuditStepList = new List <RCMDetailControlAuditStep>();
            List <RCMDetailRiskControlIssue> rcmDetailControlIssueList     = new List <RCMDetailRiskControlIssue>();

            //List<RiskControlMatrix> rcms = db.RiskControlMatrixs.Where(p => p.WalktroughID.Equals(walktrough.WalktroughID)).ToList();

            /*foreach (var descProses in rcms)
             * {
             *  rcmList.Add(descProses);
             *  List<RCMDetailRisk> rcmsss = db.RCMDetailRisks.Where(a => a.RiskControlMatrixID.Equals(descProses.RiskControlMatrixID)).ToList();
             *  foreach (var desc2 in rcmsss)
             *  {
             *      rcmDetailList.Add(desc2);
             *      List<RCMDetailRiskControl> rcmsssControl = db.RCMDetailRiskControls.Where(a => a.RCMDetailRiskID.Equals(desc2.RCMDetailRiskID)).ToList();
             *      foreach (var desc3 in rcmsssControl)
             *      {
             *          rcmDetailControlList.Add(desc3);
             *          List<RCMDetailControlAuditStep> rcmsssControlAudit = db.RCMDetailControlAuditSteps.Where(a => a.RCMDetailRiskControlID.Equals(desc3.RCMDetailRiskControlID)).ToList();
             *          foreach (var desc4 in rcmsssControlAudit)
             *          {
             *              rcmDetailControlAuditStepList.Add(desc4);
             *          }
             *          List<RCMDetailRiskControlIssue> rcmsssControlIssue = db.RCMDetailRiskControlIssue.Where(a => a.RCMDetailRiskControlID.Equals(desc3.RCMDetailRiskControlID)).ToList();
             *          foreach (var desc5 in rcmsssControlIssue)
             *          {
             *              rcmDetailControlIssueList.Add(desc5);
             *          }
             *      }
             *  }
             * }*/

            ViewBag.descControlIssue     = rcmDetailControlIssueList;
            ViewBag.descControlAuditStep = rcmDetailControlAuditStepList;
            ViewBag.descControlRisks     = rcmDetailControlList;
            ViewBag.descRisk             = rcmList;
            //ViewBag.descProses = rcmList;
            ViewBag.busProses            = rcmList;
            ViewBag.WordDocumentFilename = "RCM";
            return(View(walktrough));
        }
        public async Task <ActionResult> CreateBusiness(IEnumerable <HttpPostedFileBase> files, [Bind(Include = "BusinessProcesID,WalktroughID,DocumentNo,DocumentName,FolderName,BPMID")] BusinessProces businessProces)
        {
            if (ModelState.IsValid)
            {
                HttpServerUtilityBase server = Server;
                int i = 0;
                foreach (var file in files)
                {
                    if (file != null)
                    {
                        i = i + 1;
                        bool addFile = filesTransact.addFile(businessProces.DocumentNo, i, file, server);
                    }
                }
                string username = User.Identity.Name;

                db.BusinessProcess.Add(businessProces);
                await db.SaveChangesAsync();

                int wallid = Convert.ToInt32(businessProces.WalktroughID);

                BusinessProces bus = new BusinessProces();
                auditTransact.CreateAuditTrail("Create", wallid, "BusinessProcessDetail", bus, businessProces, username);

                TempData["message"] = "BPM detail successfully created!";
                return(RedirectToAction("CreateBusiness", new { id = businessProces.BPMID, walkid = businessProces.WalktroughID }));
                //return RedirectToAction("Create");
            }

            //ViewBag.WalktroughID = new SelectList(db.Walktroughs, "WalktroughID", "Remarks", businessProces.WalktroughID);
            return(View(businessProces));
        }
        // GET: Walktroughs/Details/5
        public ActionResult Details(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            Walktrough     walktrough = db.Walktroughs.Find(id);
            BusinessProces business   = db.BusinessProcess.Find(id);

            List <string>         newFilesName = new List <string>();
            List <string>         paths        = new List <string>();
            UrlHelper             url          = Url;
            HttpServerUtilityBase server       = Server;

            bool getFiles = filesTransact.getFiles(business.DocumentNo, out newFilesName, out paths, url, server);

            ViewBag.newFilesName = newFilesName;
            ViewBag.paths        = paths;

            ViewBag.WalktroughID = business.WalktroughID;
            ViewBag.BPMID        = business.BPMID;
            ViewBag.BusinessID   = business.BusinessProcesID;
            ViewBag.No           = business.DocumentNo;
            ViewBag.Name         = business.DocumentName;
            ViewBag.Mark         = business.Walktrough.Remarks;


            return(View(walktrough));
        }
示例#4
0
        public async Task <ActionResult> DeleteConfirmed(int id)
        {
            BusinessProces businessProces = await db.BusinessProcess.FindAsync(id);

            db.BusinessProcess.Remove(businessProces);
            await db.SaveChangesAsync();

            return(RedirectToAction("Index"));
        }
示例#5
0
        public async Task <ActionResult> Edit([Bind(Include = "BusinessProcesID,BPMID,DocumentNo,DocumentName,FolderName")] BusinessProces businessProces)
        {
            if (ModelState.IsValid)
            {
                db.Entry(businessProces).State = EntityState.Modified;
                await db.SaveChangesAsync();

                return(RedirectToAction("Index"));
            }
            //ViewBag.WalktroughID = new SelectList(db.Walktroughs, "WalktroughID", "Remarks", businessProces.WalktroughID);
            return(View(businessProces));
        }
        public async Task <ActionResult> EditBusiness(IEnumerable <HttpPostedFileBase> files, [Bind(Include = "BusinessProcesID,WalktroughID,DocumentNo,DocumentName,FolderName,BPMID")] BusinessProces businessProces)
        {
            if (ModelState.IsValid)
            {
                int i = 0;
                HttpServerUtilityBase server       = Server;
                List <string>         newFilesName = new List <string>();
                List <string>         paths        = new List <string>();
                UrlHelper             url          = Url;
                List <string>         keepImages   = new List <string>();
                //object imagesTemp = Session["Images"];
                var sessionImages = Session["Images"];
                if (sessionImages != null)
                {
                    Array arrKeepImages = (Array)sessionImages;
                    foreach (var arrKeepImage in arrKeepImages)
                    {
                        keepImages.Add(arrKeepImage.ToString());
                    }
                    bool          getFiles     = filesTransact.getFiles(businessProces.DocumentNo, out newFilesName, out paths, url, server);
                    List <string> deletedFiles = paths.Except(keepImages).ToList();
                    bool          deleteFiles  = filesTransact.deleteFiles(deletedFiles, server);

                    i = filesTransact.getLastNumberOfFiles(businessProces.DocumentNo, server);
                }
                foreach (var file in files)
                {
                    if (file != null)
                    {
                        i = i + 1;
                        bool addFile = filesTransact.addFile(businessProces.DocumentNo, i, file, server);
                    }
                }
                Session.Remove("Images");

                string username = User.Identity.Name;
                db.Configuration.ProxyCreationEnabled = false;
                BusinessProces oldData = db.BusinessProcess.AsNoTracking().Where(p => p.BusinessProcesID.Equals(businessProces.BusinessProcesID)).FirstOrDefault();
                auditTransact.CreateAuditTrail("Update", Convert.ToInt32(businessProces.WalktroughID), "BusinessProcessDetail", oldData, businessProces, username);
                db.Entry(businessProces).State = EntityState.Modified;
                await db.SaveChangesAsync();

                db.SaveChanges();

                TempData["message"] = "BPM detail successfully updated!";
                return(RedirectToAction("CreateBusiness", new { id = businessProces.BPMID, walkid = businessProces.WalktroughID }));
            }

            return(View(businessProces));
        }
示例#7
0
        // GET: BusinessProces/Details/5
        public async Task <ActionResult> Details(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            BusinessProces businessProces = await db.BusinessProcess.FindAsync(id);

            if (businessProces == null)
            {
                return(HttpNotFound());
            }
            return(View(businessProces));
        }
        public async Task <ActionResult> DeleteConfirmed(int id)
        {
            db.Configuration.ProxyCreationEnabled = false;
            string         username = User.Identity.Name;
            BusinessProces business = await db.BusinessProcess.FindAsync(id);

            BusinessProces emp = new BusinessProces();

            db.BusinessProcess.Remove(business);
            await db.SaveChangesAsync();

            auditTransact.CreateAuditTrail("Delete", Convert.ToInt32(business.WalktroughID), "BusinessProcesDetail", business, emp, username);
            TempData["message"] = "BPM detail successfully deleted!";
            return(RedirectToAction("Index"));
        }
示例#9
0
        // GET: BusinessProces/Edit/5
        public async Task <ActionResult> Edit(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            BusinessProces businessProces = await db.BusinessProcess.FindAsync(id);

            if (businessProces == null)
            {
                return(HttpNotFound());
            }
            //ViewBag.WalktroughID = new SelectList(db.Walktroughs, "WalktroughID", "Remarks", businessProces.WalktroughID);
            return(View(businessProces));
        }
        public ActionResult CreateBusiness(int?id, int?walkid)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            Walktrough     walktrough = db.Walktroughs.Find(walkid);
            BusinessProces business   = db.BusinessProcess.Find(id);
            BPM            bpm        = db.BPMs.Find(id);

            //ViewBag.Name = db.BusinessProcess.Find(id);
            if (walktrough == null)
            {
                return(HttpNotFound());
            }

            //ViewBag.BusinessProcesID = business.BusinessProcesID;
            ViewBag.WalktroughID = walktrough.WalktroughID;
            ViewBag.ActivityID   = walktrough.ActivityID;
            ViewBag.BPMID        = bpm.BPMID;
            ViewBag.PrelimID     = walktrough.PreliminaryID;
            ViewBag.BPMStatus    = bpm.Status;
            ViewBag.WalktroughID = bpm.WalktroughID;
            ViewBag.Name         = bpm.Name;

            walktrough.BusinessProces = (from b in db.BusinessProcess
                                         where b.BPMID == id
                                         select b).ToList();

            walktrough.BPM = (from b in db.BPMs
                              where b.BPMID == id
                              select b).ToList();

            string message = TempData["message"] as string;

            if (!string.IsNullOrEmpty(message))
            {
                ViewBag.message = message;
            }

            return(View(walktrough));

            //return View(walktrough);
        }
        // GET: Walktroughs/Delete/5
        public ActionResult Delete(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            Walktrough     walktrough = db.Walktroughs.Find(id);
            BusinessProces business   = db.BusinessProcess.Find(id);

            ViewBag.WalktroughID = business.WalktroughID;
            ViewBag.BPMID        = business.BPMID;
            ViewBag.BusinessID   = business.BusinessProcesID;
            ViewBag.No           = business.DocumentNo;
            ViewBag.Name         = business.DocumentName;
            ViewBag.Mark         = business.Walktrough.Remarks;


            return(View(walktrough));
        }
        public ActionResult EditBusiness(int?id, int?walkid)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            Walktrough     walktrough = db.Walktroughs.Find(walkid);
            BusinessProces business   = db.BusinessProcess.Find(id);
            BPM            bpm        = db.BPMs.Find(id);

            if (walktrough == null)
            {
                return(HttpNotFound());
            }
            List <string>         newFilesName = new List <string>();
            List <string>         paths        = new List <string>();
            UrlHelper             url          = Url;
            HttpServerUtilityBase server       = Server;

            var getFiles = filesTransact.getFiles(business.DocumentNo, out newFilesName, out paths, url, server);

            ViewBag.newFilesName = newFilesName;
            ViewBag.paths        = paths;

            ViewBag.WalktroughID     = business.WalktroughID;
            ViewBag.BPMID            = business.BPMID;
            ViewBag.BusinessProcesID = business.BusinessProcesID;
            ViewBag.DocumentNo       = business.DocumentNo;
            ViewBag.DocumentName     = business.DocumentName;
            ViewBag.FolderName       = business.FolderName;

            walktrough.BusinessProces = (from b in db.BusinessProcess
                                         where b.BPMID == id
                                         select b).ToList();

            return(View(walktrough));
        }