public static async Task <SetValues> getDefaultPrintCount() { List <SettingCls> settingsCls = await setModel.GetAll(); List <SetValues> settingsValues = await valueModel.GetAll(); set = settingsCls.Where(s => s.name == "Allow_print_inv_count").FirstOrDefault <SettingCls>(); printCountId = set.settingId; printCount = settingsValues.Where(i => i.settingId == printCountId).FirstOrDefault(); return(printCount); }
private async Task <string> getUserLanguage(int userId) { SettingCls setModel = new SettingCls(); SettingCls set = new SettingCls(); SetValues valueModel = new SetValues(); List <SetValues> languages = new List <SetValues>(); UserSetValues usValueModel = new UserSetValues(); var lanSettings = await setModel.GetAll(); set = lanSettings.Where(l => l.name == "language").FirstOrDefault <SettingCls>(); var lanValues = await valueModel.GetAll(); if (lanValues.Count > 0) { languages = lanValues.Where(vl => vl.settingId == set.settingId).ToList <SetValues>(); usValues = await usValueModel.GetAll(); if (usValues.Count > 0) { var curUserValues = usValues.Where(c => c.userId == userId); if (curUserValues.Count() > 0) { foreach (var l in curUserValues) { if (languages.Any(c => c.valId == l.valId)) { usLanguage = l; } } var lan = await valueModel.GetByID(usLanguage.valId.Value); return(lan.value); } else { return("en"); } } else { return("en"); } } else { return("en"); } }
private async void Window_Loaded(object sender, RoutedEventArgs e) {//load try { if (sender != null) { HelpClass.StartAwait(grid_main); } requiredControlList = new List <string> { "name", "address", "email", "mobile" }; await fillCountries(); await fillCity(); List <SettingCls> settingsCls = await setModel.GetAll(); List <SetValues> settingsValues = await valueModel.GetAll(); #region get settings Ids //get company name id set = settingsCls.Where(s => s.name == "com_name").FirstOrDefault <SettingCls>(); nameId = set.settingId; setVName = settingsValues.Where(i => i.settingId == nameId).FirstOrDefault(); //get company address id set = settingsCls.Where(s => s.name == "com_address").FirstOrDefault <SettingCls>(); addressId = set.settingId; setVAddress = settingsValues.Where(i => i.settingId == addressId).FirstOrDefault(); //get company email id set = settingsCls.Where(s => s.name == "com_email").FirstOrDefault <SettingCls>(); emailId = set.settingId; setVEmail = settingsValues.Where(i => i.settingId == emailId).FirstOrDefault(); //get company mobile id set = settingsCls.Where(s => s.name == "com_mobile").FirstOrDefault <SettingCls>(); mobileId = set.settingId; setVMobile = settingsValues.Where(i => i.settingId == mobileId).FirstOrDefault(); //get company phone id set = settingsCls.Where(s => s.name == "com_phone").FirstOrDefault <SettingCls>(); phoneId = set.settingId; setVPhone = settingsValues.Where(i => i.settingId == phoneId).FirstOrDefault(); //get company fax id set = settingsCls.Where(s => s.name == "com_fax").FirstOrDefault <SettingCls>(); faxId = set.settingId; setVFax = settingsValues.Where(i => i.settingId == faxId).FirstOrDefault(); //get company logo id set = settingsCls.Where(s => s.name == "com_logo").FirstOrDefault <SettingCls>(); logoId = set.settingId; setVLogo = settingsValues.Where(i => i.settingId == logoId).FirstOrDefault(); #endregion if (!isFirstTime) { #region translate if (MainWindow.lang.Equals("en")) { //MainWindow.resourcemanager = new ResourceManager("POS.en_file", Assembly.GetExecutingAssembly()); grid_main.FlowDirection = FlowDirection.LeftToRight; } else { //MainWindow.resourcemanager = new ResourceManager("POS.ar_file", Assembly.GetExecutingAssembly()); grid_main.FlowDirection = FlowDirection.RightToLeft; } translate(); #endregion #region get values //get company name tb_name.Text = setVName.value; //get company address tb_address.Text = setVAddress.value; //get company email tb_email.Text = setVEmail.value; //get company mobile HelpClass.getMobile(setVMobile.value, cb_areaMobile, tb_mobile); //get company phone HelpClass.getPhone(setVPhone.value, cb_areaPhone, cb_areaPhoneLocal, tb_phone); //get company fax HelpClass.getPhone(setVFax.value, cb_areaFax, cb_areaFaxLocal, tb_fax); //get company logo await getImg(); #endregion } if (sender != null) { HelpClass.EndAwait(grid_main); } } catch (Exception ex) { if (sender != null) { HelpClass.EndAwait(grid_main); } HelpClass.ExceptionMessage(ex, this); } }
private async void Dg_setValues_SelectionChanged(object sender, SelectionChangedEventArgs e) { try { if (sender != null) { HelpClass.StartAwait(grid_main); } if (dg_setValues.SelectedIndex != -1) { if (dg_setValues.SelectedIndex != -1) { sett = dg_setValues.SelectedItem as SettingCls; setValuessQuery = await setValuesModel.GetBySetName(sett.name); //List<SettingCls> settLst = await setModel.GetAll(); //SettingCls setting = settLst.Where(s => s.settingId == sett.settingId).FirstOrDefault(); //setValuessQuery = await setValuesModel.GetBySetName(setting.name); tb_title.Text = setValuessQuery.Where(x => x.notes == "title").FirstOrDefault() is null ? "" : setValuessQuery.Where(x => x.notes == "title").FirstOrDefault().value.ToString(); tb_text1.Text = setValuessQuery.Where(x => x.notes == "text1").FirstOrDefault() is null ? "" : setValuessQuery.Where(x => x.notes == "text1").FirstOrDefault().value.ToString(); tb_text2.Text = setValuessQuery.Where(x => x.notes == "text2").FirstOrDefault() is null ? "" : setValuessQuery.Where(x => x.notes == "text2").FirstOrDefault().value.ToString(); tb_link1text.Text = setValuessQuery.Where(x => x.notes == "link1text").FirstOrDefault() is null ? "" : setValuessQuery.Where(x => x.notes == "link1text").FirstOrDefault().value.ToString(); tb_link2text.Text = setValuessQuery.Where(x => x.notes == "link2text").FirstOrDefault() is null ? "" : setValuessQuery.Where(x => x.notes == "link2text").FirstOrDefault().value.ToString(); tb_link3text.Text = setValuessQuery.Where(x => x.notes == "link3text").FirstOrDefault() is null ? "" : setValuessQuery.Where(x => x.notes == "link3text").FirstOrDefault().value.ToString(); tb_link1url.Text = setValuessQuery.Where(x => x.notes == "link1url").FirstOrDefault() is null ? "" : setValuessQuery.Where(x => x.notes == "link1url").FirstOrDefault().value.ToString(); tb_link2url.Text = setValuessQuery.Where(x => x.notes == "link2url").FirstOrDefault() is null ? "" : setValuessQuery.Where(x => x.notes == "link2url").FirstOrDefault().value.ToString(); tb_link3url.Text = setValuessQuery.Where(x => x.notes == "link3url").FirstOrDefault() is null ? "" : setValuessQuery.Where(x => x.notes == "link3url").FirstOrDefault().value.ToString(); this.DataContext = setValues; } } if (setValues != null) { //btn_addRange.IsEnabled = true; } if (sender != null) { HelpClass.EndAwait(grid_main); } } catch (Exception ex) { if (sender != null) { HelpClass.EndAwait(grid_main); } HelpClass.ExceptionMessage(ex, this); } }
private async void Window_Loaded(object sender, RoutedEventArgs e) {//load try { if (sender != null) { SectionData.StartAwait(grid_main); } #region translate if (winLogIn.lang.Equals("en")) { winLogIn.resourcemanager = new ResourceManager("POS.en_file", Assembly.GetExecutingAssembly()); grid_main.FlowDirection = FlowDirection.LeftToRight; } else { winLogIn.resourcemanager = new ResourceManager("POS.ar_file", Assembly.GetExecutingAssembly()); grid_main.FlowDirection = FlowDirection.RightToLeft; } translate(); #endregion valuesLst = await setValuesModel.GetBySetvalNote("tax"); settingsLst = await settingModel.GetAll(); //get settingIds setInvoiceBool = settingsLst.Where(v => v.name == "invoiceTax_bool").FirstOrDefault(); setInvoice = settingsLst.Where(v => v.name == "invoiceTax_decimal").FirstOrDefault(); setItemBool = settingsLst.Where(v => v.name == "itemsTax_bool").FirstOrDefault(); setItem = settingsLst.Where(v => v.name == "itemsTax_decimal").FirstOrDefault(); setVInvoiceBool = valuesLst.Where(v => v.settingId == setInvoiceBool.settingId).FirstOrDefault(); setVInvoice = valuesLst.Where(v => v.settingId == setInvoice.settingId).FirstOrDefault(); setVItemBool = valuesLst.Where(v => v.settingId == setItemBool.settingId).FirstOrDefault(); setVItem = valuesLst.Where(v => v.settingId == setItem.settingId).FirstOrDefault(); if (setVInvoiceBool != null) { tgl_invoiceTax.IsChecked = Convert.ToBoolean(setVInvoiceBool.value); } else { tgl_invoiceTax.IsChecked = false; } if (setVInvoice != null) { decimal d = decimal.Parse(setVInvoice.value); tb_invoiceTax.Text = SectionData.PercentageDecTostring(d); } else { tb_invoiceTax.Text = ""; } if (setVItemBool != null) { tgl_itemsTax.IsChecked = Convert.ToBoolean(setVItemBool.value); } else { tgl_itemsTax.IsChecked = false; } if (setVItem != null) { decimal d = decimal.Parse(setVItem.value); tb_itemsTax.Text = SectionData.PercentageDecTostring(d); } else { tb_itemsTax.Text = ""; } if (sender != null) { SectionData.EndAwait(grid_main); } } catch (Exception ex) { if (sender != null) { SectionData.EndAwait(grid_main); } SectionData.ExceptionMessage(ex, this); } }