private void ConfirmPayment_Click(object sender, System.Windows.RoutedEventArgs e)
 {
     dbman   = new DBConnectionManager();
     pmsutil = new PMSUtil();
     using (conn = new MySqlConnection(dbman.GetConnStr()))
     {
         conn.Open();
         if (conn.State == ConnectionState.Open)
         {
             MySqlCommand cmd = conn.CreateCommand();
             cmd.CommandText = "DELETE FROM appointment_types WHERE type_id = @eid LIMIT 1;";
             cmd.Parameters.AddWithValue("@eid", eid);
             cmd.Prepare();
             int stat_code = cmd.ExecuteNonQuery();
             conn.Close();
             if (stat_code > 0)
             {
                 etype.SyncEventTypes();
                 MsgSuccess();
                 this.Close();
             }
             else
             {
                 InfoArea.Foreground = new SolidColorBrush(Colors.Red);
                 InfoArea.Content    = "Unable to Delete Selected Event Type!";
             }
         }
     }
 }
Exemplo n.º 2
0
 private void CreateEventTypeButton_Click(object sender, RoutedEventArgs e)
 {
     if (CheckInputs() == true)
     {
         dbman   = new DBConnectionManager();
         pmsutil = new PMSUtil();
         using (conn = new MySqlConnection(dbman.GetConnStr()))
         {
             conn.Open();
             if (conn.State == ConnectionState.Open)
             {
                 string       eid = pmsutil.GenEventTypeID();
                 MySqlCommand cmd = conn.CreateCommand();
                 cmd.CommandText =
                     "INSERT INTO appointment_types(type_id, appointment_type, custom, fee, status)" +
                     "VALUES(@eid, @appointment_type, @custom, @fee, @status)";
                 cmd.Prepare();
                 cmd.Parameters.AddWithValue("@eid", eid);
                 cmd.Parameters.AddWithValue("@appointment_type", EType.Text);
                 cmd.Parameters.AddWithValue("@custom", Status.SelectedIndex + 1);
                 cmd.Parameters.AddWithValue("@fee", Fee.Value);
                 cmd.Parameters.AddWithValue("@status", Active.SelectedIndex + 1);
                 int stat_code = cmd.ExecuteNonQuery();
                 conn.Close();
                 if (stat_code > 0)
                 {
                     _caller.SyncEventTypes();
                     pmsutil.LogAccount("Added event type - Type: " + EType.Text + " Fee: " + Fee.Value);
                     MsgSuccess();
                     this.Close();
                 }
                 else
                 {
                     MsgFail();
                 }
             }
             else
             {
             }
         }
     }
     else
     {
     }
 }
Exemplo n.º 3
0
 private void EditEventTypeButton_Click(object sender, RoutedEventArgs e)
 {
     if (CheckInputs() == true)
     {
         dbman   = new DBConnectionManager();
         pmsutil = new PMSUtil();
         using (conn = new MySqlConnection(dbman.GetConnStr()))
         {
             conn.Open();
             if (conn.State == ConnectionState.Open)
             {
                 MySqlCommand cmd = conn.CreateCommand();
                 cmd             = conn.CreateCommand();
                 cmd.CommandText =
                     "UPDATE appointment_types SET appointment_type = @appointment_type, custom = @custom, fee = @fee, status = @status WHERE type_id = @tid";
                 cmd.Prepare();
                 cmd.Parameters.AddWithValue("@tid", _tid);
                 cmd.Parameters.AddWithValue("@appointment_type", EType.Text);
                 cmd.Parameters.AddWithValue("@custom", Status.SelectedIndex + 1);
                 cmd.Parameters.AddWithValue("@fee", Fee.Value);
                 cmd.Parameters.AddWithValue("@status", Active.SelectedIndex + 1);
                 int stat_code = cmd.ExecuteNonQuery();
                 conn.Close();
                 if (stat_code > 0)
                 {
                     _caller.SyncEventTypes();
                     pmsutil.LogAccount("Edited Event Type: " + EType.Text);
                     MsgSuccess();
                     this.Close();
                 }
                 else
                 {
                     MsgFail();
                 }
             }
             else
             {
             }
         }
     }
     else
     {
     }
 }