private async void Dg_user_SelectionChanged(object sender, SelectionChangedEventArgs e) {//selection try { HelpClass.StartAwait(grid_main); if (dg_user.SelectedIndex != -1) { user = dg_user.SelectedItem as Users; this.DataContext = user; if (user != null) { btn_packages.IsEnabled = true; btn_customers.IsEnabled = true; tb_code.Text = user.code; cb_country.SelectedValue = user.countryId; this.DataContext = user; await getImg(); #region delete if (user.canDelete) { btn_delete.Content = MainWindow.resourcemanager.GetString("trDelete"); } else { if (user.isActive == 0) { btn_delete.Content = MainWindow.resourcemanager.GetString("trActive"); } else { btn_delete.Content = MainWindow.resourcemanager.GetString("trInActive"); } } #endregion HelpClass.getMobile(user.mobile, cb_areaMobile, tb_mobile); HelpClass.getPhone(user.phone, cb_areaPhone, cb_areaPhoneLocal, tb_phone); HelpClass.getPhone(user.fax, cb_areaFax, cb_areaFaxLocal, tb_fax); } } HelpClass.clearValidate(requiredControlList, this); p_error_email.Visibility = Visibility.Collapsed; HelpClass.EndAwait(grid_main); } catch (Exception ex) { HelpClass.EndAwait(grid_main); HelpClass.ExceptionMessage(ex, this); } }
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 Window_Loaded(object sender, RoutedEventArgs e) {//load try { HelpClass.StartAwait(grid_main); requiredControlList = new List <string> { "custname", "lastName", "mobile", "country" }; #region translate if (MainWindow.lang.Equals("en")) { MainWindow.resourcemanager = new ResourceManager("AdministratorApp.en_file", Assembly.GetExecutingAssembly()); grid_main.FlowDirection = FlowDirection.LeftToRight; } else { MainWindow.resourcemanager = new ResourceManager("AdministratorApp.ar_file", Assembly.GetExecutingAssembly()); grid_main.FlowDirection = FlowDirection.RightToLeft; } translate(); #endregion await FillCombo.fillCountries(cb_areaMobile); await FillCombo.fillCountries(cb_areaPhone); await FillCombo.fillCountries(cb_areaFax); await FillCombo.fillCountriesNames(cb_country); FillCombo.fillAgentLevel(cb_custlevel); customer = await customerModel.GetByID(customerID); if (customer != null) { this.DataContext = customer; tb_custCode.Text = customer.custCode; cb_country.SelectedValue = customer.countryId; this.DataContext = customer; await getImg(); HelpClass.getMobile(customer.mobile, cb_areaMobile, tb_mobile); HelpClass.getPhone(customer.phone, cb_areaPhone, cb_areaPhoneLocal, tb_phone); HelpClass.getPhone(customer.fax, cb_areaFax, cb_areaFaxLocal, tb_fax); } else { Clear(); } HelpClass.EndAwait(grid_main); } catch (Exception ex) { HelpClass.EndAwait(grid_main); HelpClass.ExceptionMessage(ex, this); } }