예제 #1
0
        public AdminPanel()
        {
            InitializeComponent();

            items = new ObservableCollection <Goods>();

            UserPanel.userlist(out Goodsname);

            for (int i = 0; i < Goodsname.Length; ++i)
            {
                string a, b, c;
                int    d, e;

                string temp = path;
                temp += Goodsname[i] + ".txt";

                StreamReader reader = new StreamReader(temp);

                a = reader.ReadLine();
                d = int.Parse(reader.ReadLine());
                e = int.Parse(reader.ReadLine());
                b = reader.ReadLine();
                c = reader.ReadLine();

                reader.Close();

                items.Add(new Goods()
                {
                    Name = a, Price = d, ID = e, Pro1 = b, Pro2 = c
                });
            }

            ManageList.ItemsSource = items;
        }
예제 #2
0
        private void serchbtn_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                int bugfounder = int.Parse(Searchbar.Text);

                string path = Extention.path;
                path += @"\GOODS\";

                string input = Searchbar.Text;

                string output = "";

                string[] property;

                UserPanel.userlist(out property);

                if (property.Length != 0)
                {
                    bool flag = true;
                    for (int i = 0; i < property.Length; ++i)
                    {
                        StreamReader reader = new StreamReader(path + property[i] + ".txt");
                        string       a      = reader.ReadLine();
                        string       b      = reader.ReadLine();
                        output = reader.ReadLine();
                        string c = reader.ReadLine();
                        string d = reader.ReadLine();
                        reader.Close();
                        if (input == output)
                        {
                            flag = false;

                            string message = "Name :" + a + '\n' + "Cost :" + b + '\n' + "ID :" + output + '\n' + "Pro 1 :" + c + '\n' + "Pro 2 :" + d;

                            MessageBox.Show(message, "Information", MessageBoxButton.OK, MessageBoxImage.Information);
                            break;
                        }
                    }
                    if (flag)
                    {
                        MessageBox.Show("This goods not found in our store .", "Not found", MessageBoxButton.OK, MessageBoxImage.Warning);
                    }
                }
                else
                {
                    MessageBox.Show("There isn't any goods in store .");
                }
            }
            catch
            {
                MessageBox.Show("Please enter numberic ID .", "Error", MessageBoxButton.OK, MessageBoxImage.Error);
            }
        }
예제 #3
0
        private void work()
        {
            string username = UserNamebox.Text;
            string passbar  = PassBox.Text;

            if (StuCH.IsChecked == true)
            {
                Student   stu = new Student(username, passbar);
                UserPanel UP  = new UserPanel(stu);
                UP.ShowDialog();
            }
            else if (TeCH.IsChecked == true)
            {
                Teacher   tea = new Teacher(username, passbar);
                UserPanel UP  = new UserPanel(tea);
                UP.ShowDialog();
            }
            else
            {
                Customer  cus = new Customer(username, passbar);
                UserPanel UP  = new UserPanel(cus);
                UP.ShowDialog();
            }
        }