Exemplo n.º 1
0
        public async Task <bool> Update(SettingsDTO dto)
        {
            var settings = _context.Settings.AsTracking().FirstOrDefault(x => x.Id == dto.Id);

            settings?.Update(dto.ThemeName);
            return(await _context.SaveChangesAsync() > 0);
        }
        public List <SettingsDTO> getApplicanttypes(string contacttype, long loanid, string ConnectionString)
        {
            lstApplicantypes = new List <SettingsDTO>();
            string strquery = string.Empty;

            try
            {
                if (loanid > 0)
                {
                    strquery = "select distinct applicanttype from tblmstloanconfiguration where loanid=" + loanid + " and upper(contacttype)='" + contacttype.ToUpper() + "' order by applicanttype;";
                }
                else
                {
                    strquery = "select distinct applicanttype from tblmstapplicantcongiguration where upper(contacttype)='" + contacttype.ToUpper() + "' and statusid=" + Convert.ToInt32(Status.Active) + "  order by applicanttype";
                }

                using (NpgsqlDataReader dr = NPGSqlHelper.ExecuteReader(ConnectionString, CommandType.Text, strquery))
                {
                    while (dr.Read())
                    {
                        SettingsDTO objapplicantypes = new SettingsDTO();
                        objapplicantypes.pApplicanttype = dr["applicanttype"].ToString();
                        objapplicantypes.id             = dr["applicanttype"].ToString();
                        objapplicantypes.text           = dr["applicanttype"].ToString();
                        lstApplicantypes.Add(objapplicantypes);
                    }
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
            return(lstApplicantypes);
        }
Exemplo n.º 3
0
        protected override void OnLoad(EventArgs e)
        {
            base.OnLoad(e);
            string Template = ModuleContext.Settings["template"] as string;

            if (!Page.IsPostBack)
            {
                InitForm(Template);
            }
            else
            {
                if (Request.QueryString["result"] == "submit")
                {
                    /*
                     * int id = int.Parse(Request.QueryString["result"]);
                     * OpenFormController ctrl =new OpenFormController();
                     * var content = ctrl.GetContent(id, ModuleId);
                     */
                    string json = hfOpenForm.Value;
                    phForm.Visible   = false;
                    phResult.Visible = true;
                    string  formData = "";
                    dynamic data     = OpenFormUtils.GenerateFormData(json, out formData);

                    string      jsonSettings = Settings["data"] as string;
                    SettingsDTO settings     = JsonConvert.DeserializeObject <SettingsDTO>(jsonSettings);
                    if (settings != null && settings.Settings != null)
                    {
                        HandlebarsEngine hbs = new HandlebarsEngine();
                        lMessage.Text  = hbs.Execute(settings.Settings.Message, data);
                        lTracking.Text = settings.Settings.Tracking;
                    }
                }
            }
        }
        public async Task <IHttpActionResult> PostSettings(SettingsDTO settings)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            var userId = User.Identity.GetUserId();

            if (string.IsNullOrEmpty(settings.ProfileId))
            {
                settings.ProfileId = userId;
            }
            if (settings.ProfileId != userId)
            {
                return(Unauthorized());
            }

            var setts = AutoMapper.Mapper.Map <Settings>(settings);

            db.Settings.Add(setts);
            await db.SaveChangesAsync();

            return(CreatedAtRoute("DefaultApi", new { id = setts.Id },
                                  AutoMapper.Mapper.Map <SettingsDTO>(setts)));
        }
Exemplo n.º 5
0
        public async Task <SettingsDTO> Edit(SettingsDTO dto)
        {
            var settings = dto.MapTo <Settings>();
            await settingsRepository.Edit(settings, Session);

            return(settings.MapTo <SettingsDTO>());
        }
Exemplo n.º 6
0
        public Task UpdateGameSettings(SettingsDTO settings)
        {
            int    gameId    = GetGameId();
            string groupName = "game-" + gameId;

            if (!Enum.TryParse(settings.difficulty, out Difficulty difficulty))
            {
                throw new ArgumentException("Difficulty has an invalid value");
            }

            if (settings.cardSpeed <= 0)
            {
                throw new ArgumentException("Card speed must be a positive value");
            }

            if (settings.roundsToWin <= 0)
            {
                throw new ArgumentException("Rounds to win must be a positive value");
            }

            var cardSpeed = TimeSpan.FromSeconds(settings.cardSpeed);

            var game    = _gameService.UpdateSettings(gameId, difficulty, cardSpeed, settings.roundsToWin);
            var gameDto = new GameDTO(game);

            return(Clients.Group(groupName).SendAsync("refreshGame", gameDto));
        }
Exemplo n.º 7
0
 public int Save(SettingsDTO req)
 {
     try
     {
         var data = db.uTaxSettings.Where(x => x.StatusCode == EMPConstants.Active).FirstOrDefault();
         if (data != null)
         {
             data.AccountCreation = req.IsAccountCreation;
             data.LastUpdatedBy   = req.UserId;
             data.LastUpdatedDate = DateTime.Now;
         }
         else
         {
             uTaxSetting _setg = new uTaxSetting();
             _setg.AccountCreation = req.IsAccountCreation;
             _setg.CreatedBy       = req.UserId;
             _setg.CreatedDate     = DateTime.Now;
             _setg.StatusCode      = EMPConstants.Active;
             db.uTaxSettings.Add(_setg);
         }
         db.SaveChanges();
         return(1);
     }
     catch (Exception ex)
     {
         return(0);
     }
 }
        public List <SettingsDTO> getContacttypes(int loanid, string ConnectionString)
        {
            string strquery = string.Empty;

            lstContacttypes = new List <SettingsDTO>();
            try
            {
                if (loanid > 0)
                {
                    strquery = "select distinct contacttype from tblmstloanconfiguration where loanid=" + loanid + " and  statusid=" + Convert.ToInt32(Status.Active) + " order by contacttype desc;";
                }
                else
                {
                    strquery = "select distinct contacttype from TBLMSTAPPLICANTCONGIGURATION order by contacttype desc;";
                }

                using (NpgsqlDataReader dr = NPGSqlHelper.ExecuteReader(ConnectionString, CommandType.Text, strquery))
                {
                    while (dr.Read())
                    {
                        SettingsDTO objContacttypes = new SettingsDTO();
                        objContacttypes.pContacttype = dr["contacttype"].ToString();
                        objContacttypes.id           = dr["contacttype"].ToString();
                        objContacttypes.text         = dr["contacttype"].ToString();
                        lstContacttypes.Add(objContacttypes);
                    }
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
            return(lstContacttypes);
        }
Exemplo n.º 9
0
 /// <summary>
 /// Populates the form with data.
 /// </summary>
 /// <param name="modifierKeyChoices">
 /// The available modifier keys.
 /// </param>
 /// <param name="currentModifierKey">
 /// The current modifier key.
 /// </param>
 /// <param name="currentKey">
 /// The current key.
 /// </param>
 public void Populate(SettingsDTO settingsDTO)
 {
     voiceBindingsGridView.Rows.Clear();
     voiceBindingsGridView.Columns.Clear();
     voiceBindingsGridView.Columns.AddRange(
         new DataGridViewTextBoxColumn {
         HeaderText   = "Key 1",
         FillWeight   = 15,
         AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill
     },
         new DataGridViewTextBoxColumn {
         HeaderText   = "Key 2",
         FillWeight   = 15,
         AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill
     },
         new DataGridViewTextBoxColumn {
         HeaderText   = "Voice",
         FillWeight   = 70,
         AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill
     }
         );
     modifierKeyDropdown.Text = settingsDTO.Hotkey.ModifierKey;
     keyBox.Text = settingsDTO.Hotkey.Key;
     sayLanguageWhenVoiceChangesCheckbox.Checked = settingsDTO.ShouldSayChangedLanguage;
     foreach (VoiceBindingDTO voiceBindingDTO in settingsDTO.VoiceBindings)
     {
         voiceBindingsGridView.Rows.Add(
             voiceBindingDTO.ModifierKey,
             voiceBindingDTO.Key,
             voiceBindingDTO.Voice
             );
     }
 }
Exemplo n.º 10
0
        public async Task <ActionResult> Index(SettingsDTO model)
        {
            if (!ModelState.IsValid)
            {
                return(View(model));
            }

            bool firstCall = true;

            JObject response;


            response = await ApiCall.CallApi("api/Admin/SetSettings", User, isMultipart : false, GetRequest : false, model : model);

            if (firstCall && Convert.ToString(response).Contains("UnAuthorized"))
            {
                firstCall = false;
            }
            else if (Convert.ToString(response).Contains("UnAuthorized"))
            {
                return(new HttpStatusCodeResult(HttpStatusCode.InternalServerError, "UnAuthorized Error"));
            }

            if (response is Error)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.InternalServerError, (response as Error).ErrorMessage));
            }
            else
            {
                model.SetSharedData(User);
                TempData["SuccessMessage"] = "Settings updated successfully.";
                return(Json(new { success = true, responseText = "Success" }, JsonRequestBehavior.AllowGet));
            }
        }
Exemplo n.º 11
0
        /// <summary>
        /// Apply the settings selected in the options form and hide it.
        /// </summary>
        /// <param name="modifierKeyText">
        /// The modifier part of the hotkey.
        /// </param>
        /// <param name="keyText">
        /// The key part of the hotkey.
        /// </param>
        public void Apply(SettingsDTO settingsDTO)
        {
            Enum.TryParse(settingsDTO.Hotkey.ModifierKey, out ModifierKey modifierKey);
            Enum.TryParse(settingsDTO.Hotkey.Key, out Keys key);
            Hotkey hotkey = new Hotkey(modifierKey, key);
            List <VoiceBindingEntity> voiceBindingEntities = new List <VoiceBindingEntity>();

            foreach (VoiceBindingDTO voiceBindingDTO in settingsDTO.VoiceBindings)
            {
                Enum.TryParse(voiceBindingDTO.ModifierKey, out ModifierKey bindingModifierKey);
                Enum.TryParse(voiceBindingDTO.Key, out Keys biningKey);
                string             bindingVoice       = voiceBindingDTO.Voice;
                Hotkey             bindingHotkey      = new Hotkey(bindingModifierKey, biningKey);
                VoiceBindingEntity voiceBindingEntity = new VoiceBindingEntity(bindingHotkey, bindingVoice);
                voiceBindingEntities.Add(voiceBindingEntity);
            }

            SettingsFile settingsFile = TTSEngine.GetSettings();

            settingsFile.Hotkey = hotkey;
            settingsFile.ShouldSayChangedLanguage = settingsDTO.ShouldSayChangedLanguage;
            settingsFile.VoiceBindings            = voiceBindingEntities;
            TTSEngine.UpdateSettings(settingsFile);
            view.Dispose();
        }
        public HttpResponseMessage Update(SettingsDTO newSettings)
        {
            var oldSettings = ModuleSettings.GetSettings(ActiveModule);

            oldSettings.MySetting = newSettings.MySetting;
            oldSettings.SaveSettings();
            return(Request.CreateResponse(HttpStatusCode.OK, oldSettings));
        }
Exemplo n.º 13
0
        public async Task <SettingsDTO> Edit(SettingsDTO dto)
        {
            var settings = this._mapper.Map <Settings>(dto);

            await this.settingsRepository.Edit(settings, Session);

            return(this._mapper.Map <SettingsDTO>(settings));
        }
Exemplo n.º 14
0
        /// <summary>
        /// Populates the options form with the current settings and opens it.
        /// </summary>
        public void Open()
        {
            SettingsDTO settingsDTO = GetSettingsDTO();

            string[] modKeyOptions = Enum.GetNames(typeof(ModifierKey));
            view = new SettingsView(this, settingsDTO, modKeyOptions);
            view.Show();
        }
Exemplo n.º 15
0
 /// <summary>
 /// Initializes form.
 /// </summary>
 public SettingsView(SettingsController controller, SettingsDTO settingsDTO, string[] modifierKeyOptions)
 {
     InitializeComponent();
     keyBox.BackColor = Color.White;
     modifierKeyDropdown.DataSource = modifierKeyOptions;
     this.controller = controller;
     Populate(settingsDTO);
 }
Exemplo n.º 16
0
 private void SettingsListener_Received(object sender, SettingsDTO e)
 {
     foreach (var pathWatcher in _pathWatchers)
     {
         pathWatcher.WaitInterval = e.Timeout;
         pathWatcher.BarcodeManager.EndOfDocument = e.EndOfDocument;
     }
 }
 public static Settings ToModel(SettingsDTO settingsDTO)
 {
     return(new Settings()
     {
         DeletingPeriod = settingsDTO.DeletingPeriod,
         WebApiConnection = settingsDTO.WebApiConnection,
         AdminContacts = settingsDTO.AdminContacts,
     });
 }
Exemplo n.º 18
0
        /// <summary>
        /// Creates the necessary custom data members
        /// </summary>
        private void CreateSettingsDto()
        {
            SettingsDTO = new SettingsDTO(ref _shortDisplayTime, ref _shortIntervalTime,
                                          ref _longDisplayTime, ref _longIntervalTime,
                                          ref _lockLengthTimeExtent, ref _postponeLength,
                                          ref _postponeAmount, ref _notificationLength);

            SettingsDTO.UserInactivityTimer.Elapsed += UserInactivityTimer_Elapsed;
        }
Exemplo n.º 19
0
        public async Task <Settings> CreateSettings(SettingsDTO dto)
        {
            var settings = _mapper.Map <SettingsDTO, Settings>(dto, new Settings(dto.Name));
            await _context.TbSettings.AddAsync(settings);

            await _context.SaveChangesAsync();

            return(settings);
        }
Exemplo n.º 20
0
        public async Task UpdateSettings(SettingsDTO dto)
        {
            var setting = this.GetSettingsForID(dto.ID);

            setting = _mapper.Map(dto, setting);

            _context.TbSettings.Add(setting).State = EntityState.Modified;
            await _context.SaveChangesAsync();
        }
Exemplo n.º 21
0
        public PartialViewResult GetSettings()
        {
            var settings = new SettingsDTO()
            {
                TimeZones = TimeZoneInfo.GetSystemTimeZones()
            };

            return(PartialView("_Settings", settings));
        }
Exemplo n.º 22
0
        public void Populate()
        {
            if (view == null || view.IsDisposed)
            {
                throw new NullReferenceException("Cant populate a disposed view");
            }
            SettingsDTO settingsDTO = GetSettingsDTO();

            view.Populate(settingsDTO);
        }
Exemplo n.º 23
0
        public async Task <SettingsDTO> GetSystemSettings()
        {
            SettingsDTO settings = new SettingsDTO
            {
                RequestSettings  = await _apiClient.RequestSettingsSdk.GetSettings(),
                JobOrderSettings = await _apiClient.JobOrderSettingsSdk.GetSettings()
            };

            return(settings);
        }
Exemplo n.º 24
0
        public IHttpActionResult PostSettings(SettingsDTO _Dto)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            int result = _settingsservice.Save(_Dto);

            return(Ok(result));
        }
Exemplo n.º 25
0
 public ActionResult Put(string phoneId, [FromBody] SettingsDTO settings)
 {
     try
     {
         settingsService.StoreSettings(phoneId, settings);
         return(Ok());
     }
     catch (Exception e)
     {
         return(BadRequest(e));
     }
 }
Exemplo n.º 26
0
        public static SettingsDTO ToDTO(Settings entity)
        {
            var dto = new SettingsDTO();

            dto.AppNotifications = entity.AppNotifications;
            dto.AppTheme         = entity.AppTheme;
            dto.AutoUpdate       = entity.AutoUpdate;
            dto.GamblingBlock    = entity.GamblingBlock;
            dto.Name             = entity.Name;
            dto.Id = entity.Id;
            return(dto);
        }
Exemplo n.º 27
0
        public static Settings ToEntity(SettingsDTO dto)
        {
            var entity = new Settings();

            entity.AppNotifications = dto.AppNotifications;
            entity.AppTheme         = dto.AppTheme;
            entity.AutoUpdate       = dto.AutoUpdate;
            entity.GamblingBlock    = dto.GamblingBlock;
            entity.Name             = dto.Name;

            return(entity);
        }
Exemplo n.º 28
0
        public static string Serialize()
        {
            var data = new SettingsDTO();

            data.workSpacePath     = Settings.WorkSpacePath.Value;
            data.maxBlock          = EditData.MaxBlock.Value;
            data.noteInputKeyCodes = Settings.NoteInputKeyCodes.Value
                                     .Take(EditData.MaxBlock.Value)
                                     .Select(keyCode => (int)keyCode)
                                     .ToList();

            return(JsonUtility.ToJson(data));
        }
Exemplo n.º 29
0
        public async Task <IActionResult> Put([FromRoute] int id, [FromBody] SettingsDTO settingsDTO)
        {
            var setting = await settingService.UpdateSettingsAsync(id, settingsDTO);

            if (setting == null)
            {
                return(NotFound());
            }
            else
            {
                return(Ok(setting));
            }
        }
        public async Task <IHttpActionResult> GetSettings(string key)
        {
            var         userId   = User.Identity.GetUserId();
            SettingsDTO settings = AutoMapper.Mapper.Map <SettingsDTO>(await db.Settings
                                                                       .Where(s => s.ProfileId == userId && s.Key == key)
                                                                       .FirstOrDefaultAsync());

            if (settings == null)
            {
                return(NotFound());
            }
            return(Ok(settings));
        }