1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768 |
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Windows;
- using System.Windows.Controls;
- using System.Windows.Data;
- using System.Windows.Documents;
- using System.Windows.Input;
- using System.Windows.Media;
- using System.Windows.Media.Imaging;
- using System.Windows.Shapes;
- using System.Dynamic;
- using Aitex.Core.Account;
- namespace Aitex.Triton160.UI.Views
- {
- /// <summary>
- /// Interaction logic for AccountCreation.xaml
- /// </summary>
- public partial class AccountCreation : Window
- {
- public AccountCreation()
- {
- InitializeComponent();
- DataContext = _account;
- var roles = Triton160UiSystem.Instance.WCF.Account.GetAllRoles();
- foreach (var item in roles)
- {
- comboBoxGroup.Items.Add(item);
- }
- comboBoxGroup.SelectedItem = _account.Role;
- }
- Account _account = new Account();
- /// <summary>
- /// Save current configuration
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void button_Save_Click(object sender, RoutedEventArgs e)
- {
- Account account = DataContext as Account;
- if (string.IsNullOrEmpty((string)comboBoxGroup.SelectedValue))
- {
- MessageBox.Show("Please select role", "Account", MessageBoxButton.OK, MessageBoxImage.Warning);
- return;
- }
- account.Role = (string)comboBoxGroup.SelectedValue;
- var ret = Triton160UiSystem.Instance.WCF.Account.CreateAccount(account);
- if (ret.ActSucc)
- {
- DialogResult = true;
- Close();
- MessageBox.Show(string.Format("\" {0} \" created!", _account.AccountId), "Account", MessageBoxButton.OK, MessageBoxImage.Information);
- }
- else
- {
- MessageBox.Show(string.Format("\" {0} \" create failed,\r\n{1}", _account.AccountId, ret.Description), "Account", MessageBoxButton.OK, MessageBoxImage.Warning);
- }
- }
- }
- }
|