Admin.xaml.cs
上传用户:jxqhsy
上传日期:2020-12-31
资源大小:1793k
文件大小:5k
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Net;
- using System.Windows;
- using System.Windows.Controls;
- using System.Windows.Documents;
- using System.Windows.Input;
- using System.Windows.Media;
- using System.Windows.Media.Animation;
- using System.Windows.Shapes;
- using System.Xml;
- using System.IO;
- namespace SFGS
- {
- public partial class Admin : UserControl
- {
- private List<Customer> theSurveyList = new List<Customer>();
- public Admin()
- {
- InitializeComponent();
- UpdateDataGrid();
- }
- private void UpdateDataGrid()
- {
- WebServiceProxy.UserManageSoapClient userManageSoapClient = new SFGS.WebServiceProxy.UserManageSoapClient();
- userManageSoapClient.ReadAllSurveyAsync();
- userManageSoapClient.ReadAllSurveyCompleted += new EventHandler<SFGS.WebServiceProxy.ReadAllSurveyCompletedEventArgs>(userMgrSoapClient_ReadAllSurveyCompleted);
- }
- private void userMgrSoapClient_ReadAllSurveyCompleted(object sender, SFGS.WebServiceProxy.ReadAllSurveyCompletedEventArgs e)
- {
- if (!e.Result.Equals(""))
- {
- this.theSurveyList = Global.getList(e.Result);
- this.dataGrid4.ItemsSource = this.theSurveyList;
- foreach (Customer customer in this.theSurveyList)
- {
- this.theDisplayedSurvey.Items.Add(customer.Name);
- }
- UpdateComboBox();
- return;
- }
- }
- private void UpdateComboBox()
- {
- WebServiceProxy.UserManageSoapClient userManageSoapClient = new SFGS.WebServiceProxy.UserManageSoapClient();
- userManageSoapClient.ReadCurrentSurveyAsync();
- userManageSoapClient.ReadCurrentSurveyCompleted += new EventHandler<SFGS.WebServiceProxy.ReadCurrentSurveyCompletedEventArgs>(userMgrSoapClient_ReadCurrentSurveyCompleted);
- }
- private void userMgrSoapClient_ReadCurrentSurveyCompleted(object sender, SFGS.WebServiceProxy.ReadCurrentSurveyCompletedEventArgs e)
- {
- if (!e.Result.Equals(""))
- {
- for (int i = 0; i < this.theDisplayedSurvey.Items.Count;i++ )
- {
- string surveyName=this.theDisplayedSurvey.Items[i].ToString();
- if (surveyName==e.Result)
- {
- this.theDisplayedSurvey.SelectedIndex = i;
- }
- }
- }
- }
- private void btnSaveDisSurvey_Click(object sender, RoutedEventArgs e)
- {
- WebServiceProxy.UserManageSoapClient userManageSoapClient = new SFGS.WebServiceProxy.UserManageSoapClient();
- userManageSoapClient.WriteCurrentSurveyAsync(this.theDisplayedSurvey.SelectedItem.ToString());
- userManageSoapClient.WriteCurrentSurveyCompleted += new EventHandler<SFGS.WebServiceProxy.WriteCurrentSurveyCompletedEventArgs>(userMgrSoapClient_WriteCurrentSurveyCompleted);
- }
- //保存当前调查
- private void userMgrSoapClient_WriteCurrentSurveyCompleted(object sender,SFGS.WebServiceProxy.WriteCurrentSurveyCompletedEventArgs e)
- {
- if (e.Result==false)
- {
- this.theMessage.Text = "Operation Failed!";
- }
- else
- {
- this.theMessage.Text = "Operation succeed!";
- }
- }
- //登出
- private void logout_Click(object sender, RoutedEventArgs e)
- {
- Login login = new Login();
- login.Width = 960;
- login.Height = 700;
- Global.IsLogin = false;
- (Parent as Canvas).Children.Add(login);
- (Parent as Canvas).Children.Remove(this);
- }
- //新建调查
- private void addNewSurvey_Click(object sender, RoutedEventArgs e)
- {
- //AddSurvery survey = new AddSurvery();
- //survey.Width = 960;
- //survey.Height = 700;
- //(Parent as Canvas).Children.Add(survey);
- //(Parent as Canvas).Children.Remove(this);
- }
- private void Result_Click(object sender, RoutedEventArgs e)
- {
- //System.Windows.Browser.HtmlPage.Window.Alert((sender as HyperlinkButton).Tag.ToString());
- // TODO: 在此添加调result的页面
- }
- private void Question_Click(object sender, RoutedEventArgs e)
- {
- // TODO: 在此添加调Question的页面
- }
- private void Edit_Click(object sender, RoutedEventArgs e)
- {
- // TODO: 在此添加调Edit的页面
- }
- private void Delete_Click(object sender, RoutedEventArgs e)
- {
- // TODO: 在此添加调Delete的页面
- }
- private void theNew_Click(object sender, RoutedEventArgs e)
- {
- // TODO: 在此添加调新建的页面
- }
- }
- }