コード例 #1
0
        public IActionResult GetConfig()
        {
            var model = new Models.ConfigModel();

            model.ApplicationName = "DNX MVC6 TypeScript Angular2 example";
            model.Version = "1.0";

            return Json(model);
        }
コード例 #2
0
        public IActionResult GetConfig()
        {
            var model = new Models.ConfigModel();

            model.ApplicationName = "DNX MVC6 TypeScript Angular2 example";
            model.Version         = "1.0";

            return(Json(model));
        }
コード例 #3
0
        /// ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
        public ActionResult Edit(string message, string msgType)
        {
            AdminUser user = null;
            try
            {
                ViewBag.Title = "Edit Configuration";
                ViewBag.Message = message;
                ViewBag.Msgtype = msgType;
                user = (PortalAPI.Models.AdminUser)Session["AdminUserSession"];
                if (user != null)
                {
                    var portId = RouteData.Values["portalId"];
                    var portalId = Convert.ToInt32(portId);
                    
                    var configOption = 0;
                    Int32.TryParse((string)RouteData.Values["id"], out configOption);       // 0 default value if conversion fails
                   
                    var cid = Session["ClientId"];
                    int clientid = Convert.ToInt32(cid.ToString());
                    ViewBag.UserName = _adminManager.GetUserName(user.UserId, clientid);
                    string path = Request.RawUrl.ToString();

                    string CONFIG_PATH = Path.Combine(this.DataConfigPath, clientid + "\\" + portalId + "\\Configuration");
                    string LANG_PATH = Path.Combine(this.DataConfigPath, clientid + "\\" + portalId + "\\Languages");
                    string CSS_PATH = Path.Combine(this.DataConfigPath, clientid + "\\" + portalId + "\\Styles");
                    string JS_PATH = Path.Combine(this.DataConfigPath, clientid + "\\" + portalId + "\\Scripts");

                    var portalName = _adminManager.GetPortalName(portalId, clientid);
                    var langId = _adminManager.GetPortalLangId(clientid,portalId);

                    var lang= CreateLangDictionary();
                    var langFile = lang[langId]+".xml";
                    var css = CreateCSSDictionary();
                   
                    ConfigModel cnfgmodel = new Models.ConfigModel();
                    BreadcrumbViewModel BreadcrumbViewModel = new BreadcrumbViewModel();
                    BreadcrumbViewModel.NavigationList = new List<SelectListItem>();
                    BreadcrumbViewModel.NavigationList.Add(new SelectListItem() { Text = "Portal Administration", Value = "Admin", Selected = false });
                    if (configOption != 0)
                    { 
                        BreadcrumbViewModel.NavigationList.Add(new SelectListItem() { Text = portalName, Value = "Admin/Edit/" + clientid + "/" + portalId, Selected = false }); 
                    }
                    switch (configOption)
                    {
                        case 1:
                            BreadcrumbViewModel.NavigationList.Add(new SelectListItem() { Text = "Configuration", Value = "Admin", Selected = true });
                            cnfgmodel.XmlContent = _adminManager.ReadXMLFile(CONFIG_PATH + "\\portal-config.xml");
                            break;
                        case 2:
                            BreadcrumbViewModel.NavigationList.Add(new SelectListItem() { Text = "Language", Value = "Admin", Selected = true });
                            cnfgmodel.XmlContent = _adminManager.ReadXMLFile(LANG_PATH + "\\" + langFile);
                            ViewBag.lang = langFile;
                            break;
                        case 3:
                            int csId = Convert.ToInt32(Request.QueryString["cssId"]);                            
                            BreadcrumbViewModel.NavigationList.Add(new SelectListItem() { Text = "CSS", Value = "Admin", Selected = true });
                            if(csId !=0)
                            {
                                var cssFile = css[csId];
                                cnfgmodel.TextContent = _adminManager.ReadTextFile(CSS_PATH + "\\" + cssFile);
                            }
                            break;
                        case 4:
                            BreadcrumbViewModel.NavigationList.Add(new SelectListItem() { Text = "Images", Value = "Admin", Selected = true });
                            break;
                        case 5:
                            BreadcrumbViewModel.NavigationList.Add(new SelectListItem() { Text = "Script", Value = "Admin", Selected = true });
                            cnfgmodel.TextContent = _adminManager.ReadTextFile(JS_PATH+ "\\portal.js");
                            break;
                        default:
                            BreadcrumbViewModel.NavigationList.Add(new SelectListItem() { Text = portalName, Value = "Admin/Edit/" + clientid + "/" + portalId, Selected = true }); 
                            break;
                    }

                    cnfgmodel.PortalId = portalId;
                    cnfgmodel.LangId = langId;
                    cnfgmodel.RequestPath = path;
                    cnfgmodel.ConfigType = configOption;
                    cnfgmodel.BreadcrumbViewModel = BreadcrumbViewModel;
                    cnfgmodel.CssFiles = css;                    
                    cnfgmodel.ModifiedFilesModel = _adminManager.ReadConfigDetail(clientid, portalId, configOption);
                    return View(cnfgmodel);
                }
                return RedirectToAction("Index", "Admin");
            }
            catch (Exception ex)
            {
                KBCustomException kbCustExp = KBCustomException.ProcessException(ex, KBOp.LoadContent, KBErrorHandler.GetMethodName(), GeneralResources.AdminBreadcrumbEditError,
                    new KBExceptionData("message", message), new KBExceptionData("msgType", msgType), new KBExceptionData("user.UserId", (user != null) ? user.UserId : -1));
                throw kbCustExp;
            }
        }