예제 #1
0
        public ActionResult Home()
        {
            var uName = Session["PM"].ToString();

            var queryU  = from a in db.tbUserCredentials where a.username.Contains(uName) select a.userID;
            var cUserID = queryU.FirstOrDefault();

            var query = from a in db.tbPMs where a.userID.Equals(cUserID) select a.pmID;
            var qpmID = query.FirstOrDefault();

            var queryM = from a in db.tbProjects where a.pmID.Equals(qpmID) select a.projID;
            var prID   = queryM.FirstOrDefault();

            projViewModel model = new projViewModel();

            model.tbProjects = db.tbProjects.Where(i => i.pmID == qpmID).ToList();
            model.tbModules  = db.tbModules.Where(i => i.projID == prID).ToList();
            model.tbUser     = db.tbUsers.Where(i => i.userID == cUserID).FirstOrDefault();
            model.tbPM       = db.tbPMs.Where(i => i.pmID == qpmID).FirstOrDefault();



            TempData["fName"] = model.tbUser.firstName;
            TempData["lName"] = model.tbUser.lastName;

            TempData["page"] = "Home";
            return(View(model));
        }
예제 #2
0
        public ActionResult editMod(int id, int wrID)
        {
            int           modID = Convert.ToInt32(id);
            projViewModel model = new projViewModel();

            model.tbModule   = db.tbModules.Find(modID);
            ViewBag.wrID     = wrID;
            TempData["page"] = "Submission";
            return(View(model));
        }
예제 #3
0
        public ActionResult initiateProj(projViewModel model)
        {
            try{
                if (HttpContext.Request.Files.AllKeys.Any())
                {
                    // Get the uploaded image from the Files collection
                    var httpPostedFile = HttpContext.Request.Files[0];

                    if (httpPostedFile != null)
                    {
                        // Validate the uploaded image(optional)

                        // Get the complete file path
                        var fileSavePath = Path.Combine(Server.MapPath("~/App_Data/ProjectFiles"), model.file.FileName + model.tbPM.pmID);

                        // Save the uploaded file to "UploadedFiles" folder
                        httpPostedFile.SaveAs(fileSavePath);
                        model.tbProject.fileName = model.file.FileName + model.tbPM.pmID;
                    }
                }
            }
            catch { model.tbProject.fileName = ""; }

            var uName = Session["PM"].ToString();

            var queryU  = from a in db.tbUserCredentials where a.username.Contains(uName) select a.userID;
            var cUserID = queryU.FirstOrDefault();

            var query = from a in db.tbPMs where a.userID.Equals(cUserID) select a.pmID;
            var qpmID = query.FirstOrDefault();

            model.tbProject.pmID     = Convert.ToInt16(qpmID);
            model.tbProject.moduleNo = "0";
            model.tbProject.postDate = DateTime.Today.ToString("dd-MM-yyyy");

            model.tbProject.status = "Open";
            db.tbProjects.Add(model.tbProject);
            TempData["noOfMod"] = model.tbProject.moduleNo;

            TempData["fName"] = ViewBag.fname;
            TempData["lName"] = ViewBag.lname;

            db.SaveChanges();
            int    id   = model.tbProject.projID;
            string sPID = Convert.ToString(id);

            TempData["projID"]  = id;
            TempData["message"] = "Project Created Succesfully !";

            // return RedirectToAction("project", "PM", new { id = sPID });
            TempData["page"] = "initiateProj";
            return(View());
            //Failed to initiate project
        }
예제 #4
0
        public ActionResult Submission(string id)
        {
            int            pID   = Convert.ToInt16(id);
            tbProjWorkroom wroom = db.tbProjWorkrooms.Find(pID);
            projViewModel  model = new projViewModel();

            model.tbProject  = wroom.tbAwardedProj.tbProject;
            ViewBag.wroomID  = pID;
            TempData["page"] = "Submission";
            return(View(model));
        }
예제 #5
0
        public ActionResult project(string id)
        {
            int prjID = Convert.ToInt16(id);

            ViewBag.prjID = prjID;
            projViewModel model = new projViewModel();

            model.tbProject  = db.tbProjects.Where(i => i.projID == prjID).FirstOrDefault();
            TempData["page"] = "projects";
            return(View(model));
        }
예제 #6
0
        public ActionResult projects()
        {
            var uName = Session["PM"].ToString();

            var user = db.tbUserCredentials.Where(u => u.username.Equals(uName)).FirstOrDefault();
            var pm   = user.tbUser.tbPMs.FirstOrDefault();

            projViewModel model = new projViewModel();

            model.tbProjects = db.tbProjects.Where(i => i.pmID == pm.pmID).OrderByDescending(x => x.postDate).ToList();
            TempData["page"] = "projects";
            return(View(model));
        }
예제 #7
0
        public ActionResult modulesBreak(string id)
        {
            //ViewBag.no = Request.QueryString["no"];
            //ViewBag.projID = pr;
            //ViewBag.projID = Convert.ToInt16(id);
            int wrID = Convert.ToInt16(id);

            ViewBag.wrID = wrID;

            projViewModel  model = new projViewModel();
            tbProjWorkroom wroom = db.tbProjWorkrooms.Find(wrID);

            model.tbProject  = wroom.tbAwardedProj.tbProject;
            TempData["page"] = "modulesBreak";
            return(View(model));
        }
예제 #8
0
        public ActionResult editMod(int id, int wrID, projViewModel model)
        {
            tbModule module = db.tbModules.Find(id);

            module.description   = model.tbModule.description;
            module.closeDate     = model.tbModule.closeDate;
            module.devSkillLevel = model.tbModule.devSkillLevel;
            module.devType       = model.tbModule.devType;
            module.category      = model.tbModule.category;
            module.budget        = model.tbModule.budget;
            module.skillReq      = model.tbModule.skillReq;
            if (model.file != null)
            {
                foreach (HttpPostedFileBase file in model.files)
                {
                    if (file == null)
                    {
                        continue;
                    }
                    else
                    {
                        if (HttpContext.Request.Files.AllKeys.Any())
                        {
                            var httpPostedFile = HttpContext.Request.Files[0];

                            if (httpPostedFile != null)
                            {
                                var fileSavePath = Path.Combine(Server.MapPath("~/App_Data/ModuleFiles"), file.FileName);
                                httpPostedFile.SaveAs(fileSavePath);
                                module.filename = file.FileName;
                            }
                        }
                    }
                }
            }

            db.SaveChanges();

            return(RedirectToAction("Submission", "RequirementEngineer", new { id = wrID }));
        }
예제 #9
0
        public ActionResult Submission(string id)
        {
            string mess;

            try
            {
                mess = TempData["message"].ToString();
                TempData["message"] = mess;
            }
            catch
            {
                mess = "";
            }
            ViewBag.wrID = id;
            int            wrID  = Convert.ToInt16(id);
            tbProjWorkroom wroom = db.tbProjWorkrooms.Find(wrID);
            projViewModel  model = new projViewModel();

            model.tbProject = wroom.tbAwardedProj.tbProject;

            TempData["page"] = "Submission";
            return(View(model));
        }
예제 #10
0
        public ActionResult modulesBreak(projViewModel model, string count, string prj)
        {
            int no;
            int fileNo;

            try
            {
                no     = model.tbModules.Count;
                fileNo = model.files.Count;
            }
            catch
            {
                no = 1;
            }
            int projID = Convert.ToInt16(prj);

            foreach (HttpPostedFileBase file in model.files)
            {
                if (HttpContext.Request.Files.AllKeys.Any())
                {
                    // Get the uploaded image from the Files collection
                    var httpPostedFile = HttpContext.Request.Files[0];

                    if (httpPostedFile != null)
                    {
                        // Validate the uploaded image(optional)

                        // Get the complete file path
                        var fileSavePath = Path.Combine(Server.MapPath("~/App_Data/ModuleFiles"), model.file.FileName);

                        // Save the uploaded file to "UploadedFiles" folder
                        httpPostedFile.SaveAs(fileSavePath);
                    }
                }
            }


            for (int i = 0; i < no; i++)
            {
                model.tbModules[i].projID   = Convert.ToInt16(projID);
                model.tbModules[i].filename = model.files[i].FileName;
                db.tbModules.Add(model.tbModules[i]);
                db.SaveChanges();
            }



            var queryM = from mod in db.tbModules where mod.projID == projID select mod;
            int noMod  = 0;

            foreach (tbModule module in queryM)
            {
                noMod++;
            }

            var query = from proj in db.tbProjects where proj.projID == projID select proj;

            foreach (tbProject project in query)
            {
                project.moduleNo = Convert.ToString(noMod);
            }
            db.SaveChanges();

            return(RedirectToAction("project", "PM", new { id = prj }));
        }
예제 #11
0
        public ActionResult submitModules(projViewModel model, string count, string prj, string wr)
        {
            int no;
            int fileNo;

            try
            {
                no     = model.tbModules.Count;
                fileNo = model.files.Count;
            }
            catch
            {
                no = 1;
            }
            int projID = Convert.ToInt16(prj);

            if (model.files.Count > 0)
            {
                foreach (HttpPostedFileBase file in model.files)
                {
                    if (file == null)
                    {
                        continue;
                    }
                    else
                    {
                        if (HttpContext.Request.Files.AllKeys.Any())
                        {
                            var httpPostedFile = HttpContext.Request.Files[0];

                            if (httpPostedFile != null)
                            {
                                var fileSavePath = Path.Combine(Server.MapPath("~/App_Data/ModuleFiles"), file.FileName);
                                httpPostedFile.SaveAs(fileSavePath);
                            }
                        }
                    }
                }
            }


            for (int i = 0; i < no; i++)
            {
                model.tbModules[i].projID = Convert.ToInt16(projID);
                if (model.files.Count > 0)
                {
                    if (model.files[i] != null)
                    {
                        model.tbModules[i].filename = model.files[i].FileName;
                    }
                    else
                    {
                        model.tbModules[i].filename = "N/A";
                    }
                }

                model.tbModules[i].status = "Analysis";
                db.tbModules.Add(model.tbModules[i]);
                db.SaveChanges();
            }



            var queryM = from mod in db.tbModules where mod.projID == projID select mod;
            int noMod  = 0;

            foreach (tbModule module in queryM)
            {
                noMod++;
            }

            var query = from proj in db.tbProjects where proj.projID == projID select proj;

            foreach (tbProject project in query)
            {
                project.moduleNo = Convert.ToString(noMod);
            }

            db.SaveChanges();

            TempData["prjID"] = projID;
            return(RedirectToAction("modulesBreak", "RequirementEngineer", new { id = wr }));
        }