示例#1
0
        private void Details_Click(object sender, RoutedEventArgs e)
        {
            if (this.listView.SelectedIndex == -1)
            {
                System.Windows.Forms.MessageBox.Show("Select an item first."); return;
            }
            int        index   = this.listView.SelectedIndex;
            InsureInfo current = all[index];
            string     detail  = string.Format("Insurance ID= {0}, Provider={1}, Expire Date={2}, Total worth={3}, Associated Item={4}", current.ID, current.Provider, current.ExpireDate, current.TotalWorth, "50");
            infoDialog ii      = new infoDialog("Details", detail);

            ii.ShowDialog();
        }
示例#2
0
        private void new_Click(object sender, RoutedEventArgs e)
        {
            string[] aa = current.getCredintials();
            if (aa[0].Equals(null) || aa[0].Equals("") || aa[1].Equals(null) || aa[1].Equals(""))
            {
                return;
            }
            if (aa[0].Equals("admin") && aa[1].Equals("admin"))
            {
                HomeView home = new HomeView();
                home.Show();

                this.Close();
            }
            else
            {
                infoDialog ii = new infoDialog("Login", "Incorrect ID or Password :(");
                ii.ShowDialog();
            }
        }
示例#3
0
        private void Window_KeyDown(object sender, KeyEventArgs e)
        {
            if (e.Key == Key.Return)
            {
                string[] aa = current.getCredintials();
                if (aa[0].Equals(null) || aa[0].Equals("") || aa[1].Equals(null) || aa[1].Equals(""))
                {
                    return;
                }
                if (aa[0].Equals("admin") && aa[1].Equals("admin"))
                {
                    HomeView home = new HomeView();
                    home.Show();

                    this.Close();
                }
                else
                {
                    infoDialog ii = new infoDialog("Login", "Incorrect ID or Password :(");
                    ii.ShowDialog();
                }
            }
        }
        private void Button_Click(object sender, RoutedEventArgs e)
        {
            int idint;

            int.TryParse(id.Text.ToString(), out idint);
            int worth;

            int.TryParse(id.Text.ToString(), out worth);
            DateTime expDate = DateTime.Now;
            String   prov    = provider.Text.ToString();
            String   itemID  = item.Text.ToString();

            if (date.SelectedDate != null)
            {
                expDate = (DateTime)date.SelectedDate;
            }
            if (String.IsNullOrWhiteSpace(prov) || String.IsNullOrWhiteSpace(itemID))
            {
                MessageBox.Show("Fields must be field out");
                return;
            }
            if (button.Content.ToString().Equals("ADD"))
            {
                //MessageBox.Show(expDate.ToString());
                InsureInfo.Add(prov, expDate, itemID, worth);
                MessageBox.Show("New Item Added!");
                this.Close();
            }
            else if (button.Content.ToString().Equals("Edit"))
            {
                InsureInfo.Edit(idint, prov, expDate, "");
                infoDialog ii = new infoDialog("Insurance Update", "You have successfully Updated your data");
                ii.ShowDialog();
                this.Close();
            }
        }