Exemplo n.º 1
0
        public ActionResult ApprovedRequest(TLRequest tlrequest)
        {
            if (ModelState.IsValid)
            {
                int id     = Convert.ToInt32(Session["ID"]);
                var writer = db.users.Where(model => model.Id == id).FirstOrDefault();
                //approve.Cust_id = writer.Id;
                //approve.project_id = request.Project_ID;
                //approve.ProjectMang_id = request.PM_ID;

                //db.ApprovedProjects.Add(approve);

                // db.SaveChanges();

                Con = new SqlConnection(@"Data source=DESKTOP-OJT395D;initial catalog=projectMSys;integrated security=True;multipleactiveresultsets=True;application name=EntityFramework");
                Con.Open();

                UpdateStatment = new SqlCommand("Update TLRequests set R_Status = '" + 1 + "' Where  Project_ID = '" + tlrequest.Project_ID + "' ", Con);
                UpdateStatment.ExecuteNonQuery();

                return(RedirectToAction("Allrequest"));
            }

            return(View());
        }
Exemplo n.º 2
0
        public ActionResult AcceptDeleterequest(int Id)
        {
            try
            {
                tlrequest = db.TLRequests.Find(Id);

                db.TLRequests.Remove(tlrequest);

                ViewBag.Error = "RequestDeleted";

                db.SaveChanges();

                return(RedirectToAction("Allrequest"));
            }

            catch
            {
                return(View());
            }
        }
Exemplo n.º 3
0
        public ActionResult SendRequestTL(TLRequest tLrequest, ApprovedProject approve, user user)
        {
            if (ModelState.IsValid)
            {
                int id     = Convert.ToInt32(Session["ID"]);
                var writer = db.users.Where(model => model.user_Type == 4).FirstOrDefault();
                tLrequest.TL_ID      = writer.Id;
                tLrequest.Project_ID = approve.project_id;
                tLrequest.R_Status   = 0;
                db.TLRequests.Add(tLrequest);
                db.SaveChanges();
                return(RedirectToAction("TeamLeader"));
            }
            var PrjList =
                from prj in db.ApprovedProjects
                join Pr in db.projects on prj.project_id equals Pr.PostID
                select new { Project_ID = prj.project_id, Project_name = Pr.Title }; //produces flat sequence

            ViewBag.Projects = new SelectList(PrjList, "Project_ID", "Project_name", approve.project_id);
            return(View());
        }
Exemplo n.º 4
0
        public ActionResult SubmitProject(JDRequest jdreq, TLRequest tlrequest, user user)
        {
            if (ModelState.IsValid)
            {
                int id     = Convert.ToInt32(Session["ID"]);
                var writer = db.users.Where(model => model.user_Type == 5).FirstOrDefault();
                jdreq.User_ID   = writer.Id;
                jdreq.proj_ID   = tlrequest.Project_ID;
                jdreq.Rj_status = 0;
                db.JDRequests.Add(jdreq);
                db.SaveChanges();
                return(RedirectToAction("JDMembers"));
            }
            var PrjList =
                from prj in db.TLRequests
                join Pr in db.projects on prj.Project_ID equals Pr.PostID
                select new { Project_ID = prj.Project_ID, Project_name = Pr.Title }; //produces flat sequence

            ViewBag.Projects = new SelectList(PrjList, "Project_ID", "Project_name", tlrequest.Project_ID);
            return(View());
        }
Exemplo n.º 5
0
        // GET: TeamLeader/Deleterequest
        public ActionResult Deleterequest(int id)
        {
            if (id != 0)
            {
                if ((Convert.ToInt32(Session["usertype"]) == 4))
                {
                    tlrequest = db.TLRequests.Find(id);

                    if (tlrequest == null)
                    {
                        return(HttpNotFound());
                    }
                    return(View(tlrequest));
                }
                else
                {
                    return(RedirectToAction("../Home/Index"));
                }
            }
            else
            {
                return(RedirectToAction("../Home/Index"));
            }
        }