예제 #1
0
        public ActionResult Delete()
        {
            try {
                sc.CheckSecurity(AppRoles.Admin, Session[SessionName.UserName.ToString()].ToString());
            }
            catch
            {
                return(RedirectToAction("Login", "Home"));
            }

            ViewBag.ShowPrice         = "none";
            ViewBag.ShowLineItemPrice = "none";

            MNGroupProject mnGrpPrj = new MNGroupProject();

            Int32  PGID          = Convert.ToInt32(Request.QueryString["PGID"].ToString());
            string ProjectNumber = Request.QueryString["item.Code"].ToString();
            string MNPGID        = Request.QueryString["rec.MNPGID"].ToString();

            mnGrpPrj.PGID      = PGID;
            mnGrpPrj.ProjectID = ProjectNumber;
            ViewBag.GetFocus   = "chk" + PGID.ToString() + ProjectNumber;

            Int32 result = 0;

            result = prjGroupRepository.Delete(MNPGID);

            VMGroupProject mvGrpPrj = new VMGroupProject();
            Int32          iPGID    = Convert.ToInt32(PGID);

            mvGrpPrj = vmGrpProjRepository.GetByPGID(iPGID);

            return(View(nameof(Index), mvGrpPrj));
        }
        public ActionResult DeleteAll()
        {
            try
            {
                sc.CheckSecurity(AppRoles.Admin, Session[SessionName.UserName.ToString()].ToString());
            }
            catch
            {
                return(RedirectToAction("Login", "Home"));
            }

            ViewBag.ShowPrice         = "none";
            ViewBag.ShowLineItemPrice = "none";

            MNGroupProject mnGrpPrj = new MNGroupProject();

            Int32 PGID = Convert.ToInt32(Request.QueryString["PGID"].ToString());

            Int32 result = 0;

            VMGroupProject mvGrpPrj = new VMGroupProject();

            try
            {
                cmsMethods.RemoveAllPermissions(PGID.ToString());
            }
            catch { }
            result = prjGroupRepository.Delete(PGID);

            mvGrpPrj = vmGrpProjRepository.GetByPGID(PGID);

            return(View(nameof(Index), mvGrpPrj));
        }
예제 #3
0
        public static string InsertMNGroupProject(MNGroupProject grpProject)
        {
            StringBuilder sb = new StringBuilder();

            sb.Append("INSERT INTO WOW.MNGRPPRJ(PGID, PROJ#, CRBY, UPBY) ");
            sb.Append("VALUES(" + grpProject.PGID + ", ");
            sb.Append("'" + grpProject.ProjectID + "', ");
            sb.Append("'" + grpProject.CreatedBy + "', ");
            sb.Append("'" + grpProject.UpdatedBy + "')");

            return(sb.ToString());
        }
예제 #4
0
        public ActionResult CreateList(int page)
        {
            try {
                sc.CheckSecurity(AppRoles.Admin, Session[SessionName.UserName.ToString()].ToString());
            }
            catch
            {
                return(RedirectToAction("Login", "Home"));
            }

            ViewBag.ShowPrice         = "none";
            ViewBag.ShowLineItemPrice = "none";

            MNGroupProject mnGrpPrj = new MNGroupProject();

            Int32  PGID          = Convert.ToInt32(Request.QueryString["PGID"].ToString());
            string ProjectNumber = Request.QueryString["item.Code"].ToString();

            mnGrpPrj.PGID      = PGID;
            mnGrpPrj.ProjectID = ProjectNumber;

            ViewBag.GetFocus = "chk" + PGID.ToString() + ProjectNumber;

            Int32 result = 0;

            result = prjGroupRepository.Insert(mnGrpPrj);

            VMGroupProject mvGrpPrj = new VMGroupProject();
            Int32          iPGID    = Convert.ToInt32(PGID);

            mvGrpPrj             = vmGrpProjRepository.GetByPGID(iPGID);
            mvGrpPrj.ProjectList = mvGrpPrj.ProjectList.Skip((page - 1) * PageSize).Take(PageSize).ToList();

            mvGrpPrj.PagingInfo = new PagingInfo {
                CurrentPage = page, ItemsPerPage = 10, TotalItems = mvGrpPrj.ProjectList.Count
            };


            return(View(nameof(List), mvGrpPrj));
        }
        public ActionResult Delete()
        {
            try
            {
                sc.CheckSecurity(AppRoles.Admin, Session[SessionName.UserName.ToString()].ToString());
            }
            catch
            {
                return(RedirectToAction("Login", "Home"));
            }

            ViewBag.ShowPrice         = "none";
            ViewBag.ShowLineItemPrice = "none";

            MNGroupProject mnGrpPrj = new MNGroupProject();

            Int32  PGID          = Convert.ToInt32(Request.QueryString["PGID"].ToString());
            string ProjectNumber = Request.QueryString["item.Code"].ToString();
            string Status        = Request.QueryString["item.StatusDesc"].ToString().ToUpper();

            string MNPGID = Request.QueryString["rec.MNPGID"].ToString();

            Int32 result = 0;

            mnGrpPrj.PGID      = PGID;
            mnGrpPrj.ProjectID = ProjectNumber;

            cmsMethods.RemoveSinglePermissionByProject(PGID.ToString(), ProjectNumber);
            result = prjGroupRepository.Delete(MNPGID);

            VMGroupProject mvGrpPrj = new VMGroupProject();
            Int32          iPGID    = Convert.ToInt32(PGID);


            mvGrpPrj = vmGrpProjRepository.GetByPGIDAndStatus(iPGID, Status);

            return(View(nameof(Index), mvGrpPrj));
        }
        public ActionResult Create()
        {
            try
            {
                sc.CheckSecurity(AppRoles.Admin, Session[SessionName.UserName.ToString()].ToString());
            }
            catch
            {
                return(RedirectToAction("Login", "Home"));
            }

            ViewBag.ShowPrice         = "none";
            ViewBag.ShowLineItemPrice = "none";

            MNGroupProject mnGrpPrj = new MNGroupProject();
            VMGroupProject mvGrpPrj = new VMGroupProject();

            Int32  PGID          = Convert.ToInt32(Request.QueryString["PGID"].ToString());
            string ProjectNumber = Request.QueryString["SelectedProject"].ToString();
            string Status        = Request.QueryString["ProjectStatusText"].ToString().ToUpper();
            Int32  result        = 0;


            if (!(ProjectNumber.Equals("ALL")))
            {
                mnGrpPrj.PGID      = PGID;
                mnGrpPrj.ProjectID = ProjectNumber;


                result = prjGroupRepository.Insert(mnGrpPrj);
                cmsMethods.AddSinglePermissionByProject(PGID.ToString(), ProjectNumber);



                if (Status.ToUpper().Equals("ALL"))
                {
                    mvGrpPrj = vmGrpProjRepository.GetByPGID(PGID);
                }
                else
                {
                    mvGrpPrj = vmGrpProjRepository.GetByPGIDAndStatus(PGID, Status);
                }
            }
            else
            {
                if (Status.ToUpper().Equals("ALL"))
                {
                    mvGrpPrj = vmGrpProjRepository.GetByPGID(PGID);
                }
                else
                {
                    mvGrpPrj = vmGrpProjRepository.GetByPGIDAndStatus(PGID, Status);
                }

                foreach (Project prj in mvGrpPrj.ProjectNotInGroupList)
                {
                    MNGroupProject mnWorkingObject = new MNGroupProject();
                    mnWorkingObject.PGID      = PGID;
                    mnWorkingObject.ProjectID = prj.Code;
                    result = prjGroupRepository.Insert(mnWorkingObject);
                }
                cmsMethods.AddAllPermissions(PGID.ToString());


                if (Status.ToUpper().Equals("ALL"))
                {
                    mvGrpPrj = vmGrpProjRepository.GetByPGID(PGID);
                }
                else
                {
                    mvGrpPrj = vmGrpProjRepository.GetByPGIDAndStatus(PGID, Status);
                }
            }


            return(View(nameof(Index), mvGrpPrj));
        }