private async void UserControl_Loaded(object sender, RoutedEventArgs e)
        {//load
            try
            {
                HelpClass.StartAwait(grid_main);

                #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

                if (!MainWindow.userLogin.type.Equals("ag"))
                {
                    dpnl_country.Visibility = Visibility.Visible;
                    bdr_country.Visibility  = Visibility.Collapsed;
                    await FillCombo.fillCountriesNames(cb_countries);

                    bdr_agent.Visibility = Visibility.Collapsed;
                }
                else
                {
                    dpnl_country.Visibility = Visibility.Collapsed;
                    bdr_country.Visibility  = Visibility.Visible;
                    tb_country.Text         = await HelpClass.getCountry(MainWindow.userLogin.countryId.Value);

                    dpnl_agent.Visibility = Visibility.Collapsed;
                    bdr_agent.Visibility  = Visibility.Visible;
                    tb_agent.Text         = MainWindow.userLogin.accountName;

                    var typelist = new[] {
                        new { Text  = MainWindow.userLogin.name + " " + MainWindow.userLogin.lastName,
                              Value = MainWindow.userLogin.userId }
                    };
                    cb_agents.DisplayMemberPath = "Text";
                    cb_agents.SelectedValuePath = "Value";
                    cb_agents.ItemsSource       = typelist;
                    cb_agents.SelectedIndex     = 0;
                }

                await Search();

                HelpClass.EndAwait(grid_main);
            }
            catch (Exception ex)
            {
                HelpClass.EndAwait(grid_main);
                HelpClass.ExceptionMessage(ex, this);
            }
        }
Пример #2
0
        private async void UserControl_Loaded(object sender, RoutedEventArgs e)
        {//load
            try
            {
                HelpClass.StartAwait(grid_main);
                requiredControlList = new List <string> {
                    "name", "lastName", "accountName", "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

                if ((MainWindow.userLogin.type.Equals("ad")) || (MainWindow.userLogin.type.Equals("us")))
                {
                    btn_packages.Visibility = Visibility.Visible; btn_customers.Visibility = Visibility.Visible;
                }
                else
                {
                    btn_packages.Visibility = Visibility.Collapsed; btn_customers.Visibility = Visibility.Collapsed;
                }

                await FillCombo.fillCountries(cb_areaMobile);

                await FillCombo.fillCountries(cb_areaPhone);

                await FillCombo.fillCountries(cb_areaFax);

                await FillCombo.fillCountriesNames(cb_country);

                FillCombo.fillAgentLevel(cb_agentLevel);

                Keyboard.Focus(tb_code);

                await Search();

                Clear();

                HelpClass.EndAwait(grid_main);
            }
            catch (Exception ex)
            {
                HelpClass.EndAwait(grid_main);
                HelpClass.ExceptionMessage(ex, this);
            }
        }
Пример #3
0
        private async void Window_Loaded(object sender, RoutedEventArgs e)
        {//load
            try
            {
                HelpClass.StartAwait(grid_main);
                requiredControlList = new List <string> {
                    "country", "month", "price"
                };

                #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.fillCountriesNames(cb_country);

                await FillCombo.fillCountriesNames(cb_country_);

                FillCombo.fillPackageMonth(cb_month);

                await Search();

                Clear();

                HelpClass.EndAwait(grid_main);
            }
            catch (Exception ex)
            {
                HelpClass.EndAwait(grid_main);
                HelpClass.ExceptionMessage(ex, this);
            }
        }
Пример #4
0
        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);
            }
        }