コード例 #1
0
 private void btn_Save_Click(object sender, RoutedEventArgs e)
 {
     MySQLCommands.InsertPayment(issuedDate, id, expDate);
     paymentWindow.RefreshPaymentList();
     paymentWindow.CheckStatus();
     this.Close();
 }
コード例 #2
0
 private void refreshTimer_Tick(object sender, EventArgs e)
 {
     lb_MaleMembers.Content         = MySQLCommands.GetMaleMembersCount();
     lb_FemaleMembers.Content       = MySQLCommands.GetFemaleMembersCount();
     lb_MaleActiveMembers.Content   = MySQLCommands.GetActiveMaleMembersCount();
     lb_FemaleActiveMembers.Content = MySQLCommands.GetActiveFemaleMembersCount();
 }
コード例 #3
0
        private void btn_GetID_Click(object sender, RoutedEventArgs e)
        {
            MySQLCommands.EnterGetCardIdMode();
            FetchCardID fetchCardIDWindow = new FetchCardID(this, true);

            fetchCardIDWindow.Show();
        }
コード例 #4
0
 public void RefreshMembers()
 {
     //dataTable.Load(MySQLCommands.GetActiveUsers().ExecuteReader());
     //dg_Members.DataContext = dataTable;
     //dg_Members.Items.Refresh();
     adapter = MySQLCommands.TestGetActiveUsers();
     dataSet = new DataSet();
     adapter.Fill(dataSet, "Users");
     dg_Members.ItemsSource = dataSet.Tables["Users"].DefaultView;
 }
コード例 #5
0
 private void btn_Save_Click(object sender, RoutedEventArgs e)
 {
     if (!string.IsNullOrWhiteSpace(tb_Name.Text) && !string.IsNullOrWhiteSpace(tb_Surname.Text) && !string.IsNullOrWhiteSpace(tb_PhoneNumber.Text) && !string.IsNullOrWhiteSpace(tb_CardID.Text) && gender != "" && dp_RegistrationDate.SelectedDate != null)
     {
         MySQLCommands.DropIDTable();
         MySQLCommands.InsertUsers(tb_Name.Text, tb_Surname.Text, tb_PhoneNumber.Text, gender, dp_RegistrationDate.SelectedDate.Value, cardID);
         this.Close();
     }
     else
     {
         MessageBox.Show("Please enter all the data", "Error", MessageBoxButton.OK, MessageBoxImage.Error);
     }
 }
コード例 #6
0
 private void btn_Save_Click(object sender, RoutedEventArgs e)
 {
     if (!string.IsNullOrWhiteSpace(tb_Name.Text) && !string.IsNullOrWhiteSpace(tb_Surname.Text) && !string.IsNullOrWhiteSpace(tb_PhoneNumber.Text) && !string.IsNullOrWhiteSpace(tb_CardID.Text) && gender != null)
     {
         name    = tb_Name.Text;
         surname = tb_Surname.Text;
         phone   = tb_PhoneNumber.Text;
         MySQLCommands.DropIDTable();
         MySQLCommands.UpdateUser(ID, name, surname, phone, gender, regDate, cardID);
         membersWindow.RefreshMembers();
         this.Close();
     }
     else
     {
         MessageBox.Show("Please enter all the data", "Error", MessageBoxButton.OK, MessageBoxImage.Error);
     }
 }
コード例 #7
0
 public void RefreshPaymentList()
 {
     dataTable.Load(MySQLCommands.GetPayments(ID).ExecuteReader());
     dg_Payments.DataContext = dataTable;
     if (expireDateFormat >= DateTime.Today)
     {
         tb_Status.Text       = "Active";
         tb_Status.Foreground = System.Windows.Media.Brushes.GreenYellow;
         btn_Pay.IsEnabled    = false;
     }
     else
     {
         tb_Status.Text       = "Not Active";
         tb_Status.Foreground = System.Windows.Media.Brushes.Red;
         btn_Pay.IsEnabled    = true;
     }
 }
コード例 #8
0
 public void CheckStatus()
 {
     Console.WriteLine("check status");
     expireDate       = MySQLCommands.GetNewestPayment(ID);
     expireDateFormat = DateTime.Parse(expireDate);
     if (expireDateFormat >= DateTime.Today)
     {
         Console.WriteLine("cActives");
         tb_Status.Text       = "Active";
         tb_Status.Foreground = System.Windows.Media.Brushes.GreenYellow;
         btn_Pay.IsEnabled    = false;
     }
     else
     {
         Console.WriteLine("cActives not active");
         tb_Status.Text       = "Not Active";
         tb_Status.Foreground = System.Windows.Media.Brushes.Red;
         btn_Pay.IsEnabled    = true;
     }
 }
コード例 #9
0
 public Payments(int _id, string _name, string _surname, string _phone, string _gender, DateTime _regDate, string _cardID)
 {
     InitializeComponent();
     ID                  = _id;
     name                = _name;
     surname             = _surname;
     phone               = _phone;
     regDate             = _regDate;
     tb_Name.Text        = name;
     tb_Surname.Text     = surname;
     tb_PhoneNumber.Text = phone;
     tb_CardID.Text      = _cardID;
     cardID              = _cardID;
     expireDate          = MySQLCommands.GetNewestPayment(ID);
     if (expireDate != null)
     {
         expireDateFormat = DateTime.Parse(expireDate);
     }
     RefreshPaymentList();
     rb_1Month.IsChecked = true;
 }
コード例 #10
0
 private void dispatcherTimer_Tick(object sender, EventArgs e)
 {
     if (MySQLCommands.GetCardID() == "1")
     {
     }
     else
     {
         cardID = MySQLCommands.GetCardID();
         if (isEdit)
         {
             editMemberWindow.SetID(cardID);
             dispatcherTimer.Stop();
             this.Close();
         }
         else
         {
             addMemberWindow.SetID(cardID);
             dispatcherTimer.Stop();
             this.Close();
         }
     }
 }
コード例 #11
0
        private void btn_Delete_Click(object sender, RoutedEventArgs e)
        {
            MessageBoxResult result = MessageBox.Show("Are you sure?", "Confirmation", MessageBoxButton.YesNo, MessageBoxImage.Question);

            if (result == MessageBoxResult.Yes)
            {
                MySQLCommands.DeleteUserPayments(ID);
                MySQLCommands.DeleteUser(ID);
                DataRowView dataRowView = (DataRowView)dg_Members.SelectedItem;
                dataRowView.Delete();
                btn_Edit.IsEnabled         = false;
                btn_Delete.IsEnabled       = false;
                btn_ViewPayments.IsEnabled = false;
                ID      = 0;
                name    = null;
                surname = null;
                phone   = null;
                gender  = null;
                regDate = DateTime.Today;
                cardID  = null;
            }
            RefreshMembers();
        }
コード例 #12
0
 private void btn_Logout_Click(object sender, RoutedEventArgs e)
 {
     MySQLCommands.DeleteActiveUser(ID);
 }
コード例 #13
0
 public void RefreshMembers()
 {
     dataTable.Load(MySQLCommands.GetUsers().ExecuteReader());
     dg_Members.DataContext = dataTable;
 }