Beispiel #1
0
 public SettingModel ToModel(DataRow row)
 {
     SettingModel model = new SettingModel();
     model.Key = Convert.ToString(row["Key"]);
     model.Value = Convert.ToString(row["Value"]);
     return model;
 }
Beispiel #2
0
 private void Awake()
 {
     base.get_transform().localPositionY(UIHowToRecord.HidePos.y);
     this.model = new SettingModel();
     this.key2  = new KeyControl(0, 1, 0.4f, 0.1f);
     this.key2.setChangeValue(0f, 0f, 0f, 0f);
 }
Beispiel #3
0
        public virtual IActionResult SettingUpdate(SettingModel model)
        {
            if (!_permissionService.Authorize(StandardPermission.ManageSettings))
            {
                return(AccessDeniedView());
            }

            if (model.Name != null)
            {
                model.Name = model.Name.Trim();
            }

            if (model.Value != null)
            {
                model.Value = model.Value.Trim();
            }

            if (!ModelState.IsValid)
            {
                return(ErrorJson(ModelState.SerializeErrors()));
            }

            //try to get a setting with the specified id
            var setting = _settingService.GetSettingById(model.Id)
                          ?? throw new ArgumentException("No setting found with the specified id");

            if (!setting.Name.Equals(model.Name, StringComparison.InvariantCultureIgnoreCase))
            {
                //setting name has been changed
                _settingService.DeleteSetting(setting);
            }
            _settingService.SetSetting(model.Name, model.Value);

            return(new NullJsonResult());
        }
Beispiel #4
0
        public static SettingModel ToModel(this Setting entity, IMDocumentService documentService)
        {
            var img = new MDocument();

            if (!string.IsNullOrWhiteSpace(entity.FileId))
            {
                img = documentService.GetById(entity.FileId);
            }

            var modelVm = new SettingModel()
            {
                Id          = entity.Id,
                CODE        = entity.CODE,
                CreatedBy   = entity.CreatedBy,
                CreatedDate = entity.CreatedDate,
                FileId      = entity.FileId,
                HTMLContent = entity.HTMLContent,
                Published   = entity.Published,
                FileUrl     = img?.FileUrl,
                Show        = entity.Show,
                Type        = entity.Type
            };

            return(modelVm);
        }
Beispiel #5
0
        public static SettingModel LoadSettings()
        {
            SettingModel loadedObj = new SettingModel();

            try
            {
                // load from file using XmlSerializer
                XmlSerializer SerializerObj  = new XmlSerializer(typeof(SettingModel));
                FileStream    ReadFileStream = new FileStream(Configuration.GetPath("WebMediaPortal.xml"), FileMode.Open, FileAccess.Read, FileShare.Read);
                loadedObj = (SettingModel)SerializerObj.Deserialize(ReadFileStream);

                // cleanup
                ReadFileStream.Close();
                ReadFileStream.Dispose();
                return(loadedObj);
            }
            catch (Exception ex)
            {
                Log.Debug("Exception in LoadSettings", ex);
            }

            // set some default values
            loadedObj.MASUrl = "auto://127.0.0.1:4322";
            loadedObj.TASUrl = "auto://127.0.0.1:4322";
            return(loadedObj);
        }
Beispiel #6
0
 protected override void OnLoadStart()
 {
     settingModel         = Model.First <SettingModel>();
     holostarSettingModel = Model.First <HolostarSettingModel>();
     optionModel          = Model.First <MobileOptionModel>();
     StartCoroutine(LoadInitialData());
 }
        public ActionResult Index()
        {
            ViewBag.Caidathethong = "active";
            var model = new SettingModel();

            model.Box1               = _service.GetByName("Box1")?.configBody ?? null;
            model.Box2               = _service.GetByName("Box2")?.configBody ?? null;
            model.Box3               = _service.GetByName("Box3")?.configBody ?? null;
            model.GioiThieuTacPham   = _service.GetByName("GioiThieuTacPham")?.configBody ?? null;
            model.Footer             = _service.GetByName("Footer")?.configBody ?? null;
            model.MainMenu           = _service.GetByName("MainMenu")?.configBody ?? null;
            model.RightMenu          = _service.GetByName("RightMenu")?.configBody ?? null;
            model.RightMenu2         = _service.GetByName("RightMenu2")?.configBody ?? null;
            model.RightMenu3         = _service.GetByName("RightMenu3")?.configBody ?? null;
            model.RightMenu4         = _service.GetByName("RightMenu4")?.configBody ?? null;
            model.LienKetWebsite     = _service.GetByName("LienKetWebsite")?.configBody ?? null;
            model.Banner             = _service.GetByName("Banner")?.configBody ?? null;
            model.BoxRight3          = _service.GetByName("BoxRight3")?.configBody ?? null;
            model.BoxRight4          = _service.GetByName("BoxRight4")?.configBody ?? null;
            ViewBag.Box1             = _toolAdmin.CategorySelectList(null, null, 1);
            ViewBag.Box2             = _toolAdmin.CategorySelectList(null, null, 1);
            ViewBag.Box3             = _toolAdmin.CategorySelectList(null, null, 1);
            ViewBag.GioiThieuTacPham = _toolAdmin.SlideDropdown(_sildeService);
            ViewBag.BoxRight3        = _toolAdmin.SlideDropdown(_sildeService);
            ViewBag.MainMenu         = _toolAdmin.MenuDropdown(_menuService, 1);
            ViewBag.RightMenu        = _toolAdmin.MenuDropdown(_menuService, 1);
            ViewBag.RightMenu2       = _toolAdmin.MenuDropdown(_menuService, 1);
            ViewBag.RightMenu3       = _toolAdmin.MenuDropdown(_menuService, 1);
            ViewBag.RightMenu4       = _toolAdmin.MenuDropdown(_menuService, 1);
            ViewBag.LienKetWebsite   = _toolAdmin.MenuDropdown(_menuService, 1);
            return(View(model));
        }
Beispiel #8
0
        public ActionResult Edit(SettingModel model)
        {
            if (ModelState.IsValid)
            {
                var setting = settingService.GetById(model.Id);
                if (setting == null)
                {
                    this.NotifyError("Item not found.");
                    return(RedirectToAction("List"));
                }

                setting.Name        = model.Name;
                setting.Description = model.Description;
                setting.DataType    = model.DataType;
                setting.Value       = this.GetValue(model, model.DataType);

                var result = settingService.Save(setting);
                if (result)
                {
                    this.NotifySuccess("Successfully saved.");
                }
                else
                {
                    this.NotifyError("Item can not saved!");
                }

                return(RedirectToAction("Edit", new { id = model.Id }));
            }

            return(View(model));
        }
Beispiel #9
0
        public ActionResult Create(SettingModel model)
        {
            if (ModelState.IsValid)
            {
                var setting = new Setting
                {
                    Name        = model.Name,
                    DataType    = model.DataType,
                    Description = model.Description,
                    Value       = this.GetValue(model, model.DataType)
                };

                var result = settingService.Save(setting);
                if (result)
                {
                    this.NotifySuccess("Successfully saved.");
                }
                else
                {
                    this.NotifyError("Item can not saved!");
                }

                return(RedirectToAction("Edit", new { Id = setting.Id }));
            }

            return(View(model));
        }
Beispiel #10
0
 private void Awake()
 {
     this.key = new KeyControl(0, 0, 0.4f, 0.1f);
     base.get_transform().localPositionY(this.HidePos.y);
     this.model     = new SettingModel();
     this._now_mode = ScreenStatus.MODE_SOUBI_HENKOU;
 }
Beispiel #11
0
        /// <summary>
        /// Initialize <see cref="SettingModel"/> via app.config
        /// </summary>
        public void InitializeSettingConfig()
        {
            // No config file exist, return
            if (!Directory.Exists(settingConfigPath) || !File.Exists(settingConfigFullName))
            {
                return;
            }
            // Read config
            string configInJson = string.Empty;

            using (StreamReader configReader = new StreamReader(settingConfigFullName))
            {
                configInJson = configReader.ReadToEnd();
            }
            // Init
            SerializableSettingModel settingModel = null;

            try
            {
                settingModel = JsonConvert.DeserializeObject <SerializableSettingModel>(configInJson);
            }
            catch
            {
                // Log
            }
            SettingModel.Update(settingModel);
        }
Beispiel #12
0
 public static void SaveSettingToDatabase(SettingModel setting)
 {
     using (IDbConnection cnn = new SQLiteConnection(GlobalConfig.ConnectionString()))
     {
         cnn.Execute("INSERT INTO Setting (Name,IsBackup, BackupRate,IsLimit,LimitRate,IsSmartLink,SmartLinkRate,IsSaveComment,Comment,IsXoaIPA,IsCheckApp) values (@Name,@IsBackup, @BackupRate,@IsLimit,@LimitRate,@IsSmartLink,@SmartLinkRate,@IsSaveComment,@Comment,@IsXoaIPA,@IsCheckApp)", setting);
     }
 }
        public SettingWindowViewModel(WindowService windowService, SettingModel model) : base(windowService, model)
        {
            this.model = model;

            #region Event Initialize
            GetSvFilePathBtClick    = new DelegateCommand(GetSvFilePathBt_Click);
            GetConfFilePathBtClick  = new DelegateCommand(GetConfFilePathBt_Click);
            GetAdminFilePathBtClick = new DelegateCommand(GetAdminFilePathBt_Click);

            KeyEditBtClick = new DelegateCommand(KeyEditBt_Click);

            GetBackupDirBtClick = new DelegateCommand(GetBackupDirBt_Click);

            SaveBtClick = new DelegateCommand(SaveBt_Click);
            #endregion

            #region Property Initialize
            ExeFilePathText    = model.ToReactivePropertyAsSynchronized(m => m.ExeFilePath);
            ConfigFilePathText = model.ToReactivePropertyAsSynchronized(m => m.ConfigFilePath);
            AdminFilePathText  = model.ToReactivePropertyAsSynchronized(m => m.AdminFilePath);

            IsLogGetterChecked = model.ToReactivePropertyAsSynchronized(m => m.IsLogGetter);
            ConsoleLengthText  = model.ToReactivePropertyAsSynchronized(m => m.ConsoleLengthText);

            IsBetaModeChecked   = model.ToReactivePropertyAsSynchronized(m => m.IsBetaMode);
            IsAutoUpdateChecked = model.ToReactivePropertyAsSynchronized(m => m.IsAutoUpdate);
            BackupDirPath       = model.ToReactivePropertyAsSynchronized(m => m.BackupDirPath);
            #endregion
        }
Beispiel #14
0
        public Settings(MainViewModel viewModel)
        {
            this.viewModel = viewModel;
            InitializeComponent();

            DataContext = new SettingModel(viewModel.Gallifrey.Settings);
        }
Beispiel #15
0
        private async void InitSetting()
        {
            //init setting
            appPassword = await App.Database.GetSettingByNameAsync(Common.SettingNames.AppPassword);

            isLock = await App.Database.GetSettingByNameAsync(Common.SettingNames.IsLock);

            if (appPassword == null && isLock == null)
            {
                //create empty
                var appPasswordObj = new SettingModel
                {
                    Name  = Common.SettingNames.AppPassword,
                    Value = ""
                };
                await App.Database.SaveSettingAsync(appPasswordObj);

                var isLockObj = new SettingModel
                {
                    Name  = Common.SettingNames.IsLock,
                    Value = "No"
                };
                await App.Database.SaveSettingAsync(isLockObj);
            }
        }
Beispiel #16
0
        public void Download(MarketModel model, SettingModel settings)
        {
            if (model == null)
            {
                throw new ArgumentNullException(nameof(model));
            }
            if (settings == null)
            {
                throw new ArgumentNullException(nameof(settings));
            }

            Config.Set("data-directory", settings.DataFolder);
            switch (model.Access)
            {
            case MarketModel.AccessType.Demo:
                Config.Set("fxcm-terminal", "Demo");
                break;

            case MarketModel.AccessType.Real:
                Config.Set("fxcm-terminal", "Real");
                break;
            }

            Config.Set("fxcm-user-name", model.Login);
            Config.Set("fxcm-password", model.Password);

            IList <string> symbols    = model.Symbols.Select(m => m.Name).ToList();
            string         resolution = model.Resolution.Equals(Resolution.Tick) ? "all" : model.Resolution.ToString();

            FxcmVolumeDownloadProgram.FxcmVolumeDownload(symbols, resolution, model.LastDate, model.LastDate);
        }
Beispiel #17
0
        public virtual IActionResult SettingAdd(SettingModel model)
        {
            if (!_permissionService.Authorize(StandardPermissionProvider.ManageSettings))
            {
                return(AccessDeniedView());
            }

            if (model.Name != null)
            {
                model.Name = model.Name.Trim();
            }

            if (model.Value != null)
            {
                model.Value = model.Value.Trim();
            }

            if (!ModelState.IsValid)
            {
                return(Json(new DataSourceResult {
                    Errors = ModelState.SerializeErrors()
                }));
            }

            _settingService.SetSetting(model.Name, model.Value);

            //activity log
            _userActivityService.InsertActivity("AddNewSetting",
                                                string.Format(_localizationService.GetResource("ActivityLog.AddNewSetting"), model.Name),
                                                _settingService.GetSetting(model.Name));

            return(new NullJsonResult());
        }
Beispiel #18
0
        public async Task Save(SettingModel model)
        {
            using (var tran = await BlogContext.Database.BeginTransactionAsync())
            {
                var settings = await BlogContext.Settings.ToListAsync();

                BlogContext.RemoveRange(settings);
                await BlogContext.SaveChangesAsync();

                var entityList = model
                                 .Settings
                                 .Where(w => w.Value != null)
                                 .Select(t => new Setting
                {
                    Key   = t.Key,
                    Value = t.Value
                });
                BlogContext.AddRange(entityList);

                await BlogContext.SaveChangesAsync();

                tran.Commit();

                RemoveCache();
            }
        }
Beispiel #19
0
 public static void SetSoundSettings(SettingModel setting)
 {
     SingletonMonoBehaviour <SoundManager> .Instance.soundVolume.BGM   = (float)setting.VolumeBGM / 100f;
     SingletonMonoBehaviour <SoundManager> .Instance.soundVolume.SE    = (float)setting.VolumeSE / 100f;
     SingletonMonoBehaviour <SoundManager> .Instance.soundVolume.Voice = (float)setting.VolumeVoice / 100f;
     SingletonMonoBehaviour <SoundManager> .Instance.soundVolume.Mute  = false;
 }
        public ActionResult Index()
        {
            Setting      setting      = settingRepo.SelectById1();
            SettingModel settingmodel = new SettingModel()
            {
                SettingId          = setting.SettingId,
                BasketLimitKeeps   = setting.BasketLimitKeeps,
                OrderEmailAddress  = setting.OrderEmailAddress,
                ContactMailAddress = setting.ContactMailAddress,
                Address            = setting.Address,
                PostCode           = setting.PostCode,
                CompanyName        = setting.CompanyName,
                GSM           = setting.GSM,
                Phone         = setting.Phone,
                Phone2        = setting.Phone2,
                Fax           = setting.Fax,
                Map           = setting.Map,
                CompanyNumber = setting.CompanyNumber,
                Slogan        = setting.Slogan,
                Facebook      = setting.Facebook,
                Twitter       = setting.Twitter,
                Instagram     = setting.Instagram,
                Linkedin      = setting.Linkedin,
                Google        = setting.Google
            };

            return(View(settingmodel));
        }
Beispiel #21
0
        public StrategyViewModel(ITreeViewModel parent, StrategyModel model, MarketsModel markets, SettingModel settings)
        {
            _parent   = parent;
            Model     = model ?? throw new ArgumentNullException(nameof(model));
            _markets  = markets;
            _settings = settings;

            StartCommand                = new RelayCommand(() => DoStartCommand(), () => !IsBusy && !Active);
            StopCommand                 = new RelayCommand(() => DoStopCommand(), () => !IsBusy && Active);
            CloneCommand                = new RelayCommand(() => DoCloneStrategy(), () => !IsBusy);
            CloneAlgorithmCommand       = new RelayCommand(() => DoCloneAlgorithm(), () => !IsBusy && !string.IsNullOrEmpty(Model.AlgorithmLocation));
            ExportCommand               = new RelayCommand(() => DoExportStrategy(), () => !IsBusy);
            DeleteCommand               = new RelayCommand(() => DoDeleteStrategy(), () => !IsBusy);
            DeleteAllTracksCommand      = new RelayCommand(() => DoDeleteTracks(null), () => !IsBusy);
            DeleteSelectedTracksCommand = new RelayCommand <IList>(m => DoDeleteTracks(m), m => !IsBusy);
            UseParametersCommand        = new RelayCommand <IList>(m => DoUseParameters(m), m => !IsBusy);
            AddSymbolCommand            = new RelayCommand(() => DoAddSymbol(), () => !IsBusy);
            DeleteSymbolsCommand        = new RelayCommand <IList>(m => DoDeleteSymbols(m), m => !IsBusy && SelectedSymbol != null);
            ImportSymbolsCommand        = new RelayCommand(() => DoImportSymbols(), () => !IsBusy);
            ExportSymbolsCommand        = new RelayCommand <IList>(m => DoExportSymbols(m), trm => !IsBusy && SelectedSymbol != null);
            TrackDoubleClickCommand     = new RelayCommand <TrackViewModel>(m => DoSelectItem(m), m => !IsBusy);
            MoveUpSymbolsCommand        = new RelayCommand <IList>(m => OnMoveUpSymbols(m), m => !IsBusy && SelectedSymbol != null);
            MoveDownSymbolsCommand      = new RelayCommand <IList>(m => OnMoveDownSymbols(m), m => !IsBusy && SelectedSymbol != null);
            SortSymbolsCommand          = new RelayCommand(() => Symbols.Sort(), () => !IsBusy);
            MoveStrategyCommand         = new RelayCommand <ITreeViewModel>(m => OnMoveStrategy(m), m => !IsBusy);
            DropDownOpenedCommand       = new RelayCommand(() => DoDropDownOpenedCommand(), () => !IsBusy);

            Model.NameChanged          += StrategyNameChanged;
            Model.AlgorithmNameChanged += AlgorithmNameChanged;
            DataFromModel();

            Model.EndDate = DateTime.Now;
            Debug.Assert(IsUiThread(), "Not UI thread!");
        }
        public ActionResult Index(SettingModel settingmodel)
        {
            Setting setting = new Setting()
            {
                SettingId          = settingmodel.SettingId,
                OrderEmailAddress  = settingmodel.OrderEmailAddress,
                ContactMailAddress = settingmodel.ContactMailAddress,
                Address            = settingmodel.Address,
                PostCode           = settingmodel.PostCode,
                CompanyName        = settingmodel.CompanyName,
                GSM           = settingmodel.GSM,
                Phone         = settingmodel.Phone,
                Phone2        = settingmodel.Phone2,
                Fax           = settingmodel.Fax,
                Map           = settingmodel.Map,
                CompanyNumber = settingmodel.CompanyNumber,
                Slogan        = settingmodel.Slogan,
                Facebook      = settingmodel.Facebook,
                Twitter       = settingmodel.Twitter,
                Instagram     = settingmodel.Instagram,
                Linkedin      = settingmodel.Linkedin,
                Google        = settingmodel.Google
            };

            settingRepo.Update(setting);
            return(RedirectToAction("Index"));
        }
Beispiel #23
0
 public static void initialize()
 {
     _materialModel = new MaterialModel();
     _userInfoModel = new UserInfoModel();
     _settingModel  = new SettingModel();
     _materialModel.Update();
 }
Beispiel #24
0
 protected override void OnLoadStart()
 {
     mobileOptionModel    = Model.First <MobileOptionModel>();
     holostarSettingModel = Model.First <HolostarSettingModel>();
     settingModel         = Model.First <SettingModel>();
     SetLoadComplete();
 }
Beispiel #25
0
        public ActionResult Upload(SettingModel Model)
        {
            if (ModelState.IsValid)
            {
                foreach (SettingItem data in Model.Details)
                {
                    try
                    {
                        data.CreatedDate  = DateTime.Now;
                        data.CreatedBy    = CurrentUser.USERNAME;;
                        data.ModifiedDate = null;

                        var dto = Mapper.Map <SettingDto>(data);
                        _settingBLL.Save(dto, CurrentUser);
                        AddMessageInfo(Constans.SubmitMessage.Saved, Enums.MessageInfoType.Success);
                    }
                    catch (Exception exception)
                    {
                        AddMessageInfo(exception.Message, Enums.MessageInfoType.Error);
                        return(View(Model));
                    }
                }
            }
            return(RedirectToAction("Index", "MstSetting"));
        }
Beispiel #26
0
        public virtual IActionResult SettingAdd(SettingModel model)
        {
            if (!_permissionService.Authorize(StandardPermission.ManageSettings))
            {
                return(AccessDeniedView());
            }

            if (model.Name != null)
            {
                model.Name = model.Name.Trim();
            }

            if (model.Value != null)
            {
                model.Value = model.Value.Trim();
            }

            if (!ModelState.IsValid)
            {
                return(ErrorJson(ModelState.SerializeErrors()));
            }

            _settingService.SetSetting(model.Name, model.Value);


            return(Json(new { Result = true }));
        }
Beispiel #27
0
        private void SetSettingModelValue(Setting setting, SettingModel model)
        {
            SettingDataType type = (SettingDataType)Enum.Parse(typeof(SettingDataType), setting.DataType, true);

            switch (type)
            {
            case SettingDataType.String:
                model.StringValue = Convert.ToString(setting.Value);
                break;

            case SettingDataType.Number:
                model.NumberValue = Convert.ToInt32(setting.Value);
                break;

            case SettingDataType.Boolean:
                model.BooleanValue = Convert.ToBoolean(setting.Value);
                break;

            case SettingDataType.Date:
                model.DateValue = Convert.ToDateTime(setting.Value);
                break;

            case SettingDataType.Picture:
                model.PictureValue = Convert.ToInt32(setting.Value);
                break;

            default:
                break;
            }
        }
Beispiel #28
0
        public SettingsViewModel(SettingModel settingModel, Action close)
        {
            AddImageCommand = new RelayCommand((obj) =>
            {
                var dialog = new OpenFileDialog
                {
                    Filter          = "Image Files(*.BMP; *.JPG; *.GIF) | *.BMP; *.JPG; *.GIF | All files(*.*) | *.*",
                    CheckFileExists = true,
                    Multiselect     = true
                };
                if (dialog.ShowDialog() == true)
                {
                    foreach (var name in dialog.FileNames)
                    {
                        ImagesPath.Add(name);
                    }
                }
            });

            SubmitCommand = new RelayCommand((obj) =>
            {
                settingModel.IsTime     = IsTime;
                settingModel.IsMouse    = IsMouse;
                settingModel.IsViewPort = IsViewPort;
                settingModel.ImagesPath = ImagesPath;
                close();
            });
        }
Beispiel #29
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        public ActionResult Edit(int?id)
        {
            if (!id.HasValue)
            {
                return(RedirectToAction("List"));
            }

            var setting = settingService.GetById(id.Value);

            if (setting == null)
            {
                this.NotifyError("Item not found.");
                return(RedirectToAction("List"));
            }

            var model = new SettingModel
            {
                Id          = setting.Id,
                Name        = setting.Name,
                DataType    = setting.DataType,
                Description = setting.Description
            };

            this.SetSettingModelValue(setting, model);

            return(View(model));
        }
Beispiel #30
0
        public virtual bool Register(SettingModel settings)
        {
            // Get name of virtual class
            string name = GetType().Name.ToLowerInvariant();

            // Make sure provider is registered
            if (Market.Encode(name) == null)
            {
                // be sure to add a reference to the unknown market, otherwise we won't be able to decode it coming out
                int code = 0;
                while (Market.Decode(code) != null)
                {
                    code++;
                }

                Market.Add(name, code);
            }

            // Make sure Market Hours Database exist
            string folder = Path.Combine(settings.DataFolder, "market-hours");

            Directory.CreateDirectory(folder);
            string path = Path.Combine(folder, "market-hours-database.json");

            if (!File.Exists(path))
            {
                var    emptyExchangeHours = new Dictionary <SecurityDatabaseKey, MarketHoursDatabase.Entry>();
                string jsonString         = JsonConvert.SerializeObject(new MarketHoursDatabase(emptyExchangeHours));
                File.WriteAllText(path, jsonString);
            }

            return(true);
        }
        public ActionResult SetEng()
        {
            ViewBag.Caidathethong = "active";
            var model = new SettingModel();

            model.Box1en               = _service.GetByName("Box1en")?.configBody ?? null;
            model.Box2en               = _service.GetByName("Box2en")?.configBody ?? null;
            model.Box3en               = _service.GetByName("Box3en")?.configBody ?? null;
            model.GioiThieuTacPhamen   = _service.GetByName("GioiThieuTacPhamen")?.configBody ?? null;
            model.Footeren             = _service.GetByName("Footeren")?.configBody ?? null;
            model.MainMenuen           = _service.GetByName("MainMenuen")?.configBody ?? null;
            model.RightMenuen          = _service.GetByName("RightMenuen")?.configBody ?? null;
            model.RightMenu2en         = _service.GetByName("RightMenu2en")?.configBody ?? null;
            model.RightMenu3en         = _service.GetByName("RightMenu3en")?.configBody ?? null;
            model.RightMenu4en         = _service.GetByName("RightMenu4en")?.configBody ?? null;
            model.LienKetWebsiteen     = _service.GetByName("LienKetWebsiteen")?.configBody ?? null;
            model.Banneren             = _service.GetByName("Banneren")?.configBody ?? null;
            model.BoxRight3en          = _service.GetByName("BoxRight3en")?.configBody ?? null;
            model.BoxRight4en          = _service.GetByName("BoxRight4en")?.configBody ?? null;
            ViewBag.Box1en             = _toolAdmin.CategorySelectList(null, null, 2);
            ViewBag.Box2en             = _toolAdmin.CategorySelectList(null, null, 2);
            ViewBag.Box3en             = _toolAdmin.CategorySelectList(null, null, 2);
            ViewBag.GioiThieuTacPhamen = _toolAdmin.SlideDropdown(_sildeService);
            ViewBag.BoxRight3en        = _toolAdmin.SlideDropdown(_sildeService);
            ViewBag.MainMenuen         = _toolAdmin.MenuDropdown(_menuService, 2);
            ViewBag.RightMenuen        = _toolAdmin.MenuDropdown(_menuService, 2);
            ViewBag.RightMenu2en       = _toolAdmin.MenuDropdown(_menuService, 2);
            ViewBag.RightMenu3en       = _toolAdmin.MenuDropdown(_menuService, 2);
            ViewBag.RightMenu4en       = _toolAdmin.MenuDropdown(_menuService, 2);
            ViewBag.LienKetWebsiteen   = _toolAdmin.MenuDropdown(_menuService, 2);
            return(View(model));
        }
        public ActionResult Index()
        {
            var model = new SettingModel();

            var setting = _settingService.Find((int)SettingType.SiteSetting);
            if (setting != null)
                model = SerializationUtility.DeserializeFromXml<SettingModel>(setting.Values);

            model = model ?? new SettingModel();

            return View(model);
        }
Beispiel #33
0
        /// <summary>
        /// 更新一条记录
        /// </summary>
        /// <param name="model">T_GuideTypes类的对象</param>
        /// <returns>更新是否成功</returns>
        public bool Update(SettingModel model)
        {
            SQLiteParameter[] parameters ={
                                              new SQLiteParameter("@Key")
                                              , new SQLiteParameter("@Value")
                                          };
            parameters[0].Value = model.Key;
            parameters[1].Value = model.Value;

            int count = SQLiteHelper.ExecuteNonQuery("UPDATE Settings SET Value=@Value WHERE Key=@Key", parameters);
            return count > 0;
        }
        public string EditSetting(SettingModel model, FormCollection frm)
        {
            if (ModelState.IsValid)
            {
                var entity = _settingService.Find(model.Id);
                if (entity != null)
               {
                    // clear cache
                    HgtCache.Remove(ConstantKeys.CacheSettingKey);

                    entity.Values = SerializationUtility.SerializeAsXml(model);
                    _settingService.Update(entity);
                    _unitOfWork.SaveChanges();

                    return JsonConvert.SerializeObject(new { ResultStatus.Success, Message = "Data were saved successfully!" });
                }
                return JsonConvert.SerializeObject(new { ResultStatus.Fail, Message = "Data were saved unsuccessfully!" });
            }
            return JsonConvert.SerializeObject(new { ResultStatus.Fail, Message = "Data were saved unsuccessfully!" });
        }
Beispiel #35
0
 public ActionResult Setting()
 {
     SettingModel settingModel = new SettingModel();
     BaseModel userModel = new UserModel();
     int returnCode = _userBl.SelectDataByID(base.UserId, out userModel);
     if (userModel != null)
     {
         settingModel.SoundEffect = ((UserModel)userModel).SoundEffect == CommonData.Status.Enable ? true : false;
         settingModel.VocaPerLearn = ((UserModel)userModel).VocaPerLearn;
         settingModel.VocaPerReview = ((UserModel)userModel).VocaPerReview;
     }
     return View("Setting", settingModel);
 }
Beispiel #36
0
 private void SaveSettingFile()
 {
     //string[] setting = new string[2];
     //setting[1] = txtSearch.Text;
     //setting[0] = txtInterval.Text;
     //File.WriteAllLines(sSettingFile, setting);
     if (setting == null)
         setting = new SettingModel();
     setting.Interval = txtInterval.Text;
     setting.SearchText = txtSearch.Text;
     setting.AutoBuy = checkBuy.Checked;
     setting.Products = txtProducts.Lines;
     setting.BuyerName = txtName.Text;
     setting.BuyAmount = txtAmount.Text;
     setting.Url = txtUrl.Text;
     setting.BuyLimit =Convert.ToInt32( txtLimit.Text);
     SerializeHelper.Save(setting, sSettingFile);
 }
Beispiel #37
0
        private void Form1_Load(object sender, EventArgs e)
        {
            timer1.Tick += timer1_Tick;
            webBrowser1.WBDocHostShowUIShowMessage += webBrowser1_WBDocHostShowUIShowMessage;

            if (File.Exists(sSettingFile))
            {
                //var sSearch = GetSettings();
                //txtSearch.Text = sSearch[1];
                //txtInterval.Text = sSearch[0];
                setting = SerializeHelper.Load<SettingModel>( sSettingFile);
                txtInterval.Text = setting.Interval;
                txtSearch.Text = setting.SearchText;
                checkBuy.Checked = setting.AutoBuy;
                txtProducts.Lines = setting.Products;
                txtName.Text = setting.BuyerName;
                txtAmount.Text = setting.BuyAmount;
                txtUrl.Text = setting.Url;
            }
        }
Beispiel #38
0
 public SettingViewModel()
 {
     _settingModel = new SettingModel();
 }
Beispiel #39
0
 public void Setup(SettingModel setting)
 {
     _connectionString = string.Format("Server={0};Database={1};Uid={2};Pwd={3};", setting.Database.Host, setting.Database.Name, setting.Database.Username, setting.Database.Password);
     SessionFactory = BuildConfig().BuildSessionFactory();
 }
Beispiel #40
0
        public ActionResult Setting(SettingModel setting)
        {
            if (ModelState.IsValid)
            {
                int returnCode = this._userBl.UpdateSetting(base.UserId, setting);
                if (returnCode == CommonData.ReturnCode.Succeed)
                {
                    Session[CommonKey.VocaPerLearn] = setting.VocaPerLearn.ToString();
                    Session[CommonKey.VocaPerReview] = setting.VocaPerReview.ToString();
                    Session[CommonKey.SoundEffect] = setting.SoundEffect ? CommonData.Status.Enable : CommonData.Status.Disable;

                    TempData["Message"] = "Lưu cấu hình thành công!";
                }
                else
                {
                    TempData["Message"] = "Có lỗi xảy ra: " + returnCode;
                }
            }

            return View(setting);
        }