예제 #1
0
        public async Task <ActionResult> Basic()
        {
            string userRole     = UsersRoles;
            bool   isSuperAdmin = userRole.ToLowerInvariant().Contains("super admin");

            ViewBag.IsSuperAdmin  = isSuperAdmin;
            ViewBag.IsBasicActive = true;


            List <string> lstBasicKeys = new List <string>
            {
                SettingKeys.AdminEmail
            };

            string json = Newtonsoft.Json.JsonConvert.SerializeObject(lstBasicKeys);

            Dictionary <string, Settings> settings = new Dictionary <string, Settings>();
            SettingManager settingController       = new SettingManager();
            string         settingValue            = await settingController.GetAdminSettings(json);

            await LoadOauth();

            if (!string.IsNullOrEmpty(settingValue))
            {
                settings = Deserialize(settingValue);
            }

            List <SettingSection> lstSections = new List <SettingSection>();

            SettingSection settingSection2 = new SettingSection
            {
                SectionName  = "Emails",
                SettingItems = new List <SettingItem>
                {
                    new SettingItem {
                        SettingKey   = SettingKeys.AdminEmail,
                        SettingLabel = "Admin Email",
                        IsCacheable  = settings[SettingKeys.AdminEmail].IsCacheable,
                        SettingValue = settings[SettingKeys.AdminEmail].Value,
                        InputType    = SettingInputType.TextBox
                    }
                }
            };

            lstSections.Add(settingSection2);


            return(await CommonSetting(lstSections));
        }
예제 #2
0
        public async Task <ActionResult> Advanced()
        {
            string userRole     = UsersRoles;
            bool   isSuperAdmin = userRole.ToLowerInvariant().Contains("super admin");

            ViewBag.IsSuperAdmin  = isSuperAdmin;
            ViewBag.IsBasicActive = false;

            List <string> lstAdvancedKeys = new List <string>
            {
                SettingKeys.OptimizeAssets,

                SettingKeys.SMTPServer,
                SettingKeys.SMTPUserName,
                SettingKeys.SMTPPassword,
                SettingKeys.SMTPSSlEnabled,

                SettingKeys.ClientID,
                SettingKeys.ClientSecretKey,

                SettingKeys.EncryptionKey,
                SettingKeys.GUID,
                SettingKeys.ServerCookieExpiration,


                SettingKeys.IdentityUrl,
                SettingKeys.LoggerApiGatewayUrl,
                SettingKeys.APKBuilderHostURL,
                SettingKeys.OnlineStore,
                SettingKeys.DigiSphereApi
            };



            string json = Newtonsoft.Json.JsonConvert.SerializeObject(lstAdvancedKeys);

            Dictionary <string, Settings> settings = new Dictionary <string, Settings>();
            SettingManager settingController       = new SettingManager();
            string         settingValue            = await settingController.GetAdminSettings(json);

            if (!string.IsNullOrEmpty(settingValue))
            {
                settings = Deserialize(settingValue);
            }

            List <SettingSection> lstSections = new List <SettingSection>();

            //SettingSection settingSection1 = new SettingSection
            //{
            //    SectionName = "FTP",
            //    SettingItems = new List<SettingItem>
            //    {
            //        new SettingItem{
            //            SettingKey=SettingKeys.FtpServer,
            //            SettingLabel="Server",
            //            IsCacheable=settings[SettingKeys.FtpServer].IsCacheable,
            //            SettingValue=settings[SettingKeys.FtpServer].Value,
            //            InputType=SettingInputType.TextBox
            //        },
            //        new SettingItem
            //        {
            //            SettingKey=SettingKeys.FtpPort,
            //            SettingLabel="Port",
            //            IsCacheable=settings[SettingKeys.FtpPort].IsCacheable,
            //            SettingValue=settings[SettingKeys.FtpPort].Value,
            //            InputType=SettingInputType.TextBox
            //        },
            //         new SettingItem{
            //            SettingKey=SettingKeys.FtpUserName,
            //            SettingLabel="Username",
            //            IsCacheable=settings[SettingKeys.FtpUserName].IsCacheable,
            //            SettingValue=settings[SettingKeys.FtpUserName].Value,
            //            InputType=SettingInputType.TextBox
            //        },
            //        new SettingItem
            //        {
            //            SettingKey=SettingKeys.FtpPassword,
            //            SettingLabel="Password",
            //            IsCacheable=settings[SettingKeys.FtpPassword].IsCacheable,
            //            SettingValue=settings[SettingKeys.FtpPassword].Value,
            //            InputType=SettingInputType.TextBox
            //        }
            //    }

            //};
            //lstSections.Add(settingSection1);

            SettingSection settingSection1 = new SettingSection
            {
                SectionName  = "Optimize Assets",
                SettingItems = new List <SettingItem>
                {
                    new SettingItem {
                        SettingKey   = SettingKeys.OptimizeAssets,
                        SettingLabel = "Optimize Assets",
                        IsCacheable  = settings[SettingKeys.OptimizeAssets].IsCacheable,
                        SettingValue = settings[SettingKeys.OptimizeAssets].Value,
                        InputType    = SettingInputType.CheckBox
                    }
                }
            };

            lstSections.Add(settingSection1);
            SettingSection settingSection2 = new SettingSection
            {
                SectionName   = "SMTP",
                CustomButtons = @"<div class='sfButtonwrapper'>
                                    <button type='button' class='btn primary btnSaveSettings'>Save</button>
								    <button type='button' class='btn primary' id='btnSaveAndTestSMTP'>Save & Test</button>
                                </div>
                                ",
                SettingItems  = new List <SettingItem>
                {
                    new SettingItem {
                        SettingKey   = SettingKeys.SMTPServer,
                        SettingLabel = "Server",
                        IsCacheable  = settings[SettingKeys.SMTPServer].IsCacheable,
                        SettingValue = settings[SettingKeys.SMTPServer].Value,
                        InputType    = SettingInputType.TextBox
                    },
                    new SettingItem {
                        SettingKey   = SettingKeys.SMTPUserName,
                        SettingLabel = "Username",
                        IsCacheable  = settings[SettingKeys.SMTPUserName].IsCacheable,
                        SettingValue = settings[SettingKeys.SMTPUserName].Value,
                        InputType    = SettingInputType.TextBox
                    },
                    new SettingItem
                    {
                        SettingKey   = SettingKeys.SMTPPassword,
                        SettingLabel = "Password",
                        IsCacheable  = settings[SettingKeys.SMTPPassword].IsCacheable,
                        SettingValue = settings[SettingKeys.SMTPPassword].Value,
                        InputType    = SettingInputType.TextBox
                    },
                    new SettingItem
                    {
                        SettingKey   = SettingKeys.SMTPSSlEnabled,
                        SettingLabel = "Is SSL Enabled?",
                        IsCacheable  = settings[SettingKeys.SMTPSSlEnabled].IsCacheable,
                        SettingValue = settings[SettingKeys.SMTPSSlEnabled].Value,
                        InputType    = SettingInputType.CheckBox
                    }
                }
            };

            lstSections.Add(settingSection2);


            SettingSection settingSection3 = new SettingSection
            {
                SectionName  = "Client",
                SettingItems = new List <SettingItem>
                {
                    new SettingItem {
                        SettingKey   = SettingKeys.ClientID,
                        SettingLabel = "ClientID",
                        IsCacheable  = settings[SettingKeys.ClientID].IsCacheable,
                        SettingValue = settings[SettingKeys.ClientID].Value,
                        InputType    = SettingInputType.TextBox
                    },
                    new SettingItem
                    {
                        SettingKey   = SettingKeys.ClientSecretKey,
                        SettingLabel = "Client Secret Key",
                        IsCacheable  = settings[SettingKeys.ClientSecretKey].IsCacheable,
                        SettingValue = settings[SettingKeys.ClientSecretKey].Value,
                        InputType    = SettingInputType.TextBox
                    }
                }
            };

            lstSections.Add(settingSection3);

            SettingSection settingSection4 = new SettingSection
            {
                SectionName  = "Security",
                SettingItems = new List <SettingItem>
                {
                    new SettingItem {
                        SettingKey   = SettingKeys.EncryptionKey,
                        SettingLabel = "Encryption Key",
                        IsCacheable  = settings[SettingKeys.EncryptionKey].IsCacheable,
                        SettingValue = settings[SettingKeys.EncryptionKey].Value,
                        InputType    = SettingInputType.TextBox
                    },
                    new SettingItem
                    {
                        SettingKey   = SettingKeys.GUID,
                        SettingLabel = "GUID",
                        IsCacheable  = settings[SettingKeys.GUID].IsCacheable,
                        SettingValue = settings[SettingKeys.GUID].Value,
                        InputType    = SettingInputType.TextBox
                    }
                    ,
                    new SettingItem
                    {
                        SettingKey   = SettingKeys.ServerCookieExpiration,
                        SettingLabel = "Server Cookie Expiration",
                        IsCacheable  = settings[SettingKeys.ServerCookieExpiration].IsCacheable,
                        SettingValue = settings[SettingKeys.ServerCookieExpiration].Value,
                        InputType    = SettingInputType.TextBox
                    }
                }
            };

            lstSections.Add(settingSection4);

            SettingSection settingSection5 = new SettingSection
            {
                SectionName  = "API",
                SettingItems = new List <SettingItem>
                {
                    new SettingItem {
                        SettingKey   = SettingKeys.IdentityUrl,
                        SettingLabel = "Identity URL",
                        IsCacheable  = settings[SettingKeys.IdentityUrl].IsCacheable,
                        SettingValue = settings[SettingKeys.IdentityUrl].Value,
                        InputType    = SettingInputType.TextBox
                    },
                    new SettingItem
                    {
                        SettingKey   = SettingKeys.LoggerApiGatewayUrl,
                        SettingLabel = "Logger Gateway URL",
                        IsCacheable  = settings[SettingKeys.LoggerApiGatewayUrl].IsCacheable,
                        SettingValue = settings[SettingKeys.LoggerApiGatewayUrl].Value,
                        InputType    = SettingInputType.TextBox
                    }
                    ,
                    new SettingItem
                    {
                        SettingKey   = SettingKeys.APKBuilderHostURL,
                        SettingLabel = "APK Builder Host URL",
                        IsCacheable  = settings[SettingKeys.APKBuilderHostURL].IsCacheable,
                        SettingValue = settings[SettingKeys.APKBuilderHostURL].Value,
                        InputType    = SettingInputType.TextBox
                    }
                    ,
                    new SettingItem
                    {
                        SettingKey   = SettingKeys.OnlineStore,
                        SettingLabel = "Online Store",
                        IsCacheable  = settings[SettingKeys.OnlineStore].IsCacheable,
                        SettingValue = settings[SettingKeys.OnlineStore].Value,
                        InputType    = SettingInputType.TextBox
                    }
                    ,
                    new SettingItem
                    {
                        SettingKey   = SettingKeys.DigiSphereApi,
                        SettingLabel = "Digi Sphere API",
                        IsCacheable  = settings[SettingKeys.DigiSphereApi].IsCacheable,
                        SettingValue = settings[SettingKeys.DigiSphereApi].Value,
                        InputType    = SettingInputType.TextBox
                    }
                }
            };

            lstSections.Add(settingSection5);

            return(await CommonSetting(lstSections));
        }