Ejemplo n.º 1
0
        public ActionResult EditRegion(EditRegion ae)
        {
            if (ModelState.IsValid)
            {
                using (mmpEntities mP = new mmpEntities())
                {
                    #region Region Already exists
                    var isRegionExists = IsRegionExist(ae.region_name);
                    if (isRegionExists)
                    {
                        ModelState.AddModelError("RegionExists", "Region already exists");
                        return(View(ae));
                    }
                    #endregion

                    region region = new region()
                    {
                        region_id   = ae.region_id,
                        region_name = ae.region_name
                    };
                    mP.Entry(region).State = EntityState.Modified;
                    mP.SaveChanges();
                    return(Json(new { success = true, message = "Updated Successfully" }, JsonRequestBehavior.AllowGet));
                }
            }
            return(View());
        }
Ejemplo n.º 2
0
 public ActionResult EditRegion(int id = 0)
 {
     using (mmpEntities mP = new mmpEntities())
     {
         var        region = mP.regions.Where(x => x.region_id == id).FirstOrDefault <region>();
         EditRegion ae     = new EditRegion()
         {
             region_id   = region.region_id,
             region_name = region.region_name
         };
         return(View(ae));
     }
 }
Ejemplo n.º 3
0
        public static void SetMainControl(ERMTControl view)
        {
            ERMTUserControl currentUserControl = new ERMTUserControl {
                Name = "new"
            };

            switch (view)
            {
            case ERMTControl.About:
            {
                About about = new About();
                about.ShowDialog();
                break;
            }

            case ERMTControl.EditRegion:
            {
                EditRegion editRegion = new EditRegion();
                currentUserControl = editRegion;
                SetMainControl(editRegion);
                ApplicationPrincipalForm.LoadLeftButtons();
                break;
            }

            case ERMTControl.ElectoralCycle:
            {
                IndexUserControl indexUserControl = new IndexUserControl
                {
                    IndexContentType = IndexContentType.ElectoralCycle
                };
                currentUserControl = indexUserControl;
                SetMainControl(indexUserControl);
                ApplicationPrincipalForm.LoadLeftButtons("electoralcycle");
                indexUserControl.ShowHtml();
                break;
            }

            case ERMTControl.ElectoralCycleModifyPhase:
            {
                ElectoralCycleModifyPhase electoralCycleModifyPhase = new ElectoralCycleModifyPhase();
                currentUserControl = electoralCycleModifyPhase;
                SetMainControl(electoralCycleModifyPhase);
                ApplicationPrincipalForm.LoadLeftButtons();
                break;
            }

            case ERMTControl.FactorModify:
            {
                FactorModify modifyFactor = new FactorModify();
                currentUserControl = modifyFactor;
                SetMainControl(modifyFactor);
                ApplicationPrincipalForm.LoadLeftButtons();
                break;
            }

            case ERMTControl.FactorNew:
            {
                FactorNew newFactor = new FactorNew();
                currentUserControl = newFactor;
                SetMainControl(newFactor);
                ApplicationPrincipalForm.LoadLeftButtons();
                break;
            }

            case ERMTControl.FactorReorder:
            {
                FactorsReorder reorderFactors = new FactorsReorder();
                currentUserControl = reorderFactors;
                SetMainControl(reorderFactors);
                ApplicationPrincipalForm.LoadLeftButtons();
                break;
            }

            case ERMTControl.KnowledgeResources:
            {
                IndexUserControl indexUserControl = new IndexUserControl
                {
                    IndexContentType = IndexContentType.KnowledgeResources
                };
                currentUserControl = indexUserControl;
                SetMainControl(indexUserControl);
                ApplicationPrincipalForm.LoadLeftButtons("KnowledgeResources");
                indexUserControl.ShowHtml();
                break;
            }

            case ERMTControl.Login:
            {
                LoginUserControl loginUserControl = new LoginUserControl();
                currentUserControl = loginUserControl;
                SetMainControl(loginUserControl);
                break;
            }

            case ERMTControl.MarkerTypeCRUD:
            {
                MarkerTypeCRUD markerTypeControl = new MarkerTypeCRUD();
                currentUserControl = markerTypeControl;
                SetMainControl(markerTypeControl);
                ApplicationPrincipalForm.LoadLeftButtons();
                break;
            }

            case ERMTControl.ModelEdit:
            {
                ModelEdit modelEdit = new ModelEdit();
                currentUserControl = modelEdit;
                SetMainControl(modelEdit);
                ApplicationPrincipalForm.LoadLeftButtons();
                break;
            }

            case ERMTControl.ModelNew:
            {
                ModelNew modelNew = new ModelNew();
                currentUserControl = modelNew;
                SetMainControl(modelNew);
                ApplicationPrincipalForm.LoadLeftButtons();
                break;
            }

            case ERMTControl.ModelReorderFactors:
            {
                ModelReorderFactors modelReorderFactors = new ModelReorderFactors();
                currentUserControl = modelReorderFactors;
                SetMainControl(modelReorderFactors);
                ApplicationPrincipalForm.LoadLeftButtons();
                break;
            }

            case ERMTControl.RiskActionRegister:
            {
                RiskAndActionRegister riskActionRegister = new RiskAndActionRegister(true);
                currentUserControl = riskActionRegister;
                SetMainControl(riskActionRegister);
                ApplicationPrincipalForm.LoadLeftButtons("riskandaction");
                break;
            }

            case ERMTControl.RiskMapping:
            {
                //RiskMapping riskMapping = new RiskMapping();
                //currentUserControl = riskMapping;
                //SetMainControl(riskMapping);
                currentUserControl = ControlCache.RiskMappingInstance;
                SetMainControl(ControlCache.RiskMappingInstance);
                ApplicationPrincipalForm.LoadLeftButtons("map");
                break;
            }

            case ERMTControl.Start:
            {
                SetMainControl(ControlCache.StartInstance);
                currentUserControl = ControlCache.StartInstance;
                ApplicationPrincipalForm.LoadLeftButtons("Start");
                break;
            }

            case ERMTControl.TestUserControl:
            {
                TestUserControl testUserControl = new TestUserControl();
                SetMainControl(testUserControl);
                break;
            }

            case ERMTControl.UserModify:
            {
                UserModify userModify = new UserModify();
                currentUserControl = userModify;
                SetMainControl(userModify);
                ApplicationPrincipalForm.LoadLeftButtons();
                break;
            }

            case ERMTControl.UserNew:
            {
                UserNew userNew = new UserNew();
                currentUserControl = userNew;
                SetMainControl(userNew);
                ApplicationPrincipalForm.LoadLeftButtons();
                break;
            }

            case ERMTControl.UserResetPassword:
            {
                UserChangePassword ucp = new UserChangePassword();
                ucp.ShowDialog();

                break;
            }
            }
            if (currentUserControl.Name != "new")
            {
                currentUserControl.ShowTitle();
            }
        }