コード例 #1
0
 private void Button_Click_1(object sender, RoutedEventArgs e)
 {
     if (textbox1.Text != string.Empty && textbox2.Text != string.Empty && password1.Text != string.Empty &&
         password2.Text != string.Empty)
     {
         if (password1.Text.Equals(password2.Text))
         {
             Label l       = new Label(textbox1.Text, textbox2.Text, password1.Text, MainWindow.label.Money);
             int   result1 = ytj.ChangeLabel(l);
             if (result1 == 1)
             {
                 MessageBox.Show("修改成功!", "congratulations", MessageBoxButton.OK, MessageBoxImage.Information);
             }
             else if (result1 == 0)
             {
                 MessageBox.Show("修改失败!", "错误", MessageBoxButton.OK, MessageBoxImage.Error);
             }
             else
             {
                 MessageBox.Show("未知错误", "错误", MessageBoxButton.OK, MessageBoxImage.Error);
             }
         }
         else
         {
             MessageBox.Show("两次输入密码不一致", "错误", MessageBoxButton.OK, MessageBoxImage.Error);
         }
     }
     else
     {
         MessageBox.Show("还有项目未填", "错误", MessageBoxButton.OK, MessageBoxImage.Error);
     }
 }
コード例 #2
0
 public Window1()
 {
     InitializeComponent();
     label = ytj.GetLabel();
     this.grid.DataContext = label;
     refreash();
 }
コード例 #3
0
        private void Button_Click(object sender, RoutedEventArgs e)
        {
            double number;

            if (double.TryParse(textbox1.Text.Trim(), out number))
            {
                if (number < 0)
                {
                    MessageBox.Show("充值的数据不能为负数!", "错误", MessageBoxButton.OK, MessageBoxImage.Error);
                }
                Label l = ytj.GetLabel();
                l.Money += (int)(number * 100);
                int result = ytj.ReCharge(l);
                if (result == 1)
                {
                    MessageBox.Show("充值成功!", "congratulations", MessageBoxButton.OK, MessageBoxImage.Information);
                    this.DialogResult = true;
                }
                else if (result == 0)
                {
                    MessageBox.Show("充值失败!", "错误", MessageBoxButton.OK, MessageBoxImage.Error);
                }
                else
                {
                    MessageBox.Show("未知错误!", "错误", MessageBoxButton.OK, MessageBoxImage.Error);
                }
            }
            else
            {
                MessageBox.Show("输入格式有误!");
            }
        }
コード例 #4
0
 private void Del(object sender, RoutedEventArgs e)
 {
     if (listView.SelectedItem == null)
     {
         MessageBox.Show("请选中一行", "提示", MessageBoxButton.OK, MessageBoxImage.Error);
     }
     else
     {
         Label            u      = listView.SelectedItem as Label;
         MessageBoxResult result = MessageBox.Show("确认是否删除账号为 " + u.id + " 的用户", "警告", MessageBoxButton.OKCancel, MessageBoxImage.Question);
         if (result == MessageBoxResult.OK)
         {
             int result1 = kgl.DeleteLable(u.id);
             if (result1 == 1)
             {
                 MessageBox.Show("删除成功!", "congratulations", MessageBoxButton.OK, MessageBoxImage.Information);
                 List <Label> labels = kgl.GetLabel();
                 listView.ItemsSource = labels;
             }
             else if (result1 == 0)
             {
                 MessageBox.Show("删除失败!", "错误", MessageBoxButton.OK, MessageBoxImage.Error);
             }
             else
             {
                 MessageBox.Show("未知错误", "错误", MessageBoxButton.OK, MessageBoxImage.Error);
             }
         }
     }
 }
コード例 #5
0
 private void Find(object sender, RoutedEventArgs e)
 {
     if (listView.SelectedItem == null)
     {
         MessageBox.Show("请选中一行!", "提示", MessageBoxButton.OK, MessageBoxImage.Error);
     }
     else
     {
         Label            u      = listView.SelectedItem as Label;
         MessageBoxResult result = MessageBox.Show("确认是否显示账号为 " + u.id + " 的用户的消费记录", "警告", MessageBoxButton.OKCancel, MessageBoxImage.Question);
         if (result == MessageBoxResult.OK)
         {
             List <Bill> bs = kgl.GetBills(u.id);
             if (bs == null)
             {
                 MessageBox.Show("记录为空!");
                 List <Label> labels = kgl.GetLabel();
                 listView.ItemsSource = labels;
             }
             else
             {
                 listView2.ItemsSource = bs;
             }
         }
     }
 }
コード例 #6
0
        public Window2()
        {
            InitializeComponent();
            Label label = ytj.GetLabel();

            textbox1.Text = label.id;
            textbox2.Text = label.name;
        }
コード例 #7
0
        private void Button_Click_1(object sender, RoutedEventArgs e)
        {
            Label       u  = listView.SelectedItem as Label;
            List <Bill> bs = ytj.GetBills();

            if (bs == null)
            {
                Console.Out.WriteLine("获取失败!");
            }
            else
            {
                listView.ItemsSource = bs;
            }
        }
コード例 #8
0
        private void Button_Click(object sender, RoutedEventArgs e)
        {
            if (Text1.Text != string.Empty && Text2.Text != string.Empty && password1.Password != string.Empty &&
                password2.Password != string.Empty)
            {
                foreach (Label l in MainWindow.labels)
                {
                    if (l.id.Equals(Text1.Text))
                    {
                        MessageBox.Show("卡号重复!", "错误", MessageBoxButton.OK, MessageBoxImage.Error);
                        Text1.Text = "";
                        return;
                    }
                }


                if (password1.Password.Equals(password2.Password))
                {
                    Label l      = new Label(Text1.Text, Text2.Text, password1.Password, 0);
                    int   result = kgl.AddLable(l);
                    if (result == 1)
                    {
                        MessageBox.Show("创建成功!", "congratulations", MessageBoxButton.OK, MessageBoxImage.Information);
                        this.DialogResult = true;
                    }
                    else if (result == 0)
                    {
                        MessageBox.Show("创建失败!", "错误", MessageBoxButton.OK, MessageBoxImage.Error);
                    }
                    else
                    {
                        MessageBox.Show("未知错误", "错误", MessageBoxButton.OK, MessageBoxImage.Error);
                    }
                }
                else
                {
                    MessageBox.Show("两次输入密码不一致", "错误", MessageBoxButton.OK, MessageBoxImage.Error);
                }
            }
            else
            {
                MessageBox.Show("还有项目未填", "错误", MessageBoxButton.OK, MessageBoxImage.Error);
            }
        }
コード例 #9
0
        private void Change(object sender, RoutedEventArgs e)
        {
            slabel = listView.SelectedItem as Label;
            int intyue = 0;

            if (slabel == null)
            {
                MessageBox.Show("请选中一行", "提示", MessageBoxButton.OK, MessageBoxImage.Error);
            }
            else
            {
                Label            u      = listView.SelectedItem as Label;
                MessageBoxResult result = MessageBox.Show("确认是否修改账号为 " + u.id + " 的用户", "警告", MessageBoxButton.OKCancel, MessageBoxImage.Question);
                if (result == MessageBoxResult.OK)
                {
                    Label l       = new Label(u.id, textbox2.Text, password1.Text, intyue);
                    int   result1 = kgl.ChangeLabel(l);
                    if (result1 == 1)
                    {
                        MessageBox.Show("修改成功!", "congratulations", MessageBoxButton.OK, MessageBoxImage.Information);
                        List <Label> labels = kgl.GetLabel();
                        listView.ItemsSource = labels;
                        textbox1.Text        = "";
                        textbox2.Text        = "";
                        password1.Text       = "";
                    }
                    else if (result1 == 0)
                    {
                        MessageBox.Show("修改失败!", "错误", MessageBoxButton.OK, MessageBoxImage.Error);
                    }
                    else
                    {
                        MessageBox.Show("未知错误!", "错误", MessageBoxButton.OK, MessageBoxImage.Error);
                    }
                }
                else
                {
                    MessageBox.Show("两次输入的密码不一致,请重新输入");
                }
                //Window3 a1 = new Window3();
                //a1.ShowDialog();
                //initList();
            }
        }
コード例 #10
0
        private void ListView_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            Label u = listView.SelectedItem as Label;

            if (u == null)
            {
                textbox1.Text  = "";
                password1.Text = "";
                textbox2.Text  = "";
                yue.Text       = "";
            }
            else
            {
                textbox1.Text  = u.id;
                password1.Text = u.password;
                textbox2.Text  = u.name;
                yue.Text       = u.money.ToString();
            }
        }
コード例 #11
0
 private void refreash()
 {
     label             = ytj.GetLabel();
     this.cost.Content = ((double)label.Money / 100).ToString() + "元";
 }