static void Main() { Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); Store.CreateDatabase(); SettingRepository settingRepository = new SettingRepository(); Store.settings = settingRepository.GetAll(); string isProtected = Store.settings.Where(s => s.Key == Store.SETTING_IS_PROTECTED).Single().Value; if (isProtected == "True") { Store.userName = Store.settings.Where(s => s.Key == Store.SETTING_USER_NAME).Single().Value; Store.password = Store.settings.Where(s => s.Key == Store.SETTING_PASSWORD).Single().Value; Application.Run(new LoginUI()); } else { Application.Run(new MainUI()); } }
public static SelectList GetSelectList_Setting(object sValue, string Code, string NullOrNameEmpty) { var selectListItems = new List <SelectListItem>(); SettingRepository settingRepository = new SettingRepository(new Domain.ErpDbContext()); if (NullOrNameEmpty != null) { SelectListItem itemEmpty = new SelectListItem(); itemEmpty.Text = NullOrNameEmpty; itemEmpty.Value = null; selectListItems.Add(itemEmpty); } try { var q = settingRepository.GetAll().Where(x => x.Code == Code).OrderBy(item => item.Id); foreach (var i in q) { SelectListItem item = new SelectListItem(); item.Text = i.Note; item.Value = i.Key.ToString(); selectListItems.Add(item); } } catch { } var selectList = new SelectList(selectListItems, "Value", "Text", sValue); return(selectList); }
public IActionResult Get() { IEnumerable <Setting> returnedSettings = settingRepository.GetAll(); if (returnedSettings != null) { return(new OkObjectResult(returnedSettings)); } else { return(new NotFoundResult()); } }
public ActionResult TopAddressPartial() { return(View(settingRepo.GetAll())); }
private void SettingUI_Load(object sender, EventArgs e) { cboStatus.Items.Add("Single"); cboStatus.Items.Add("Menikah"); cboStatus.Items.Add("Menikah (1 Anak)"); cboStatus.Items.Add("Menikah (2 Anak atau lebih)"); FillAccount(); List <Setting> settings = settingRepository.GetAll(); //Profile txtName.Text = settings.Where(s => s.Key == "NAME").Single().Value; txtEmail.Text = settings.Where(s => s.Key == "EMAIL").Single().Value; cboStatus.Text = settings.Where(s => s.Key == "STATUS").Single().Value; string sex = settings.Where(s => s.Key == "SEX").Single().Value; if (sex == "Male") { optMale.Checked = true; } else { optFemale.Checked = true; } //Linked Account string savingAccount = settings.Where(s => s.Key == "SAVING_ACCOUNT").Single().Value; string emergencyFundAccount = settings.Where(s => s.Key == "EMERGENCY_ACCOUNT").Single().Value; string investmentAccount = settings.Where(s => s.Key == "INVESTMENT_ACCOUNT").Single().Value; if (savingAccount != "") { cboSaving.Text = accountRepository.GetById(new Guid(savingAccount)).Name; } if (emergencyFundAccount != "") { cboEmergenyFund.Text = accountRepository.GetById(new Guid(emergencyFundAccount)).Name; } if (investmentAccount != "") { cboInvestment.Text = accountRepository.GetById(new Guid(investmentAccount)).Name; } //Password string isProtected = settings.Where(s => s.Key == "IS_PROTECTED").Single().Value; if (isProtected == "True") { chkPasswordProtected.Checked = true; txtUserName.Enabled = true; txtPassword.Enabled = true; } else { chkPasswordProtected.Checked = false; txtUserName.Enabled = false; txtPassword.Enabled = false; } txtAverageExpense.Text = settings.Where(s => s.Key == "AVERAGE_EXPENSE").Single().Value; txtUserName.Text = settings.Where(s => s.Key == "USER_NAME").Single().Value; txtPassword.Text = settings.Where(s => s.Key == "PASSWORD").Single().Value; }
public List <SettingDto> GetAll() { return(MapperHelper <Setting, SettingDto> .ConvertToDtos(_repository.GetAll())); }