private void actionButton_Click(object sender, RoutedEventArgs e) { switch (type) { case "S": Common_Functions.evictionST(globalConnection, id, decree.Text, (DateTime)date.SelectedDate); break; case "SE": Common_Functions.evictionSTE(globalConnection, id, decree.Text, (DateTime)date.SelectedDate); break; case "O": Common_Functions.evictionOL(globalConnection, id, decree.Text, (DateTime)date.SelectedDate); break; case "OE": Common_Functions.evictionOLE(globalConnection, id, decree.Text, (DateTime)date.SelectedDate); break; } /*if (type == "S") * { * Common_Functions.evictionST(globalConnection, id, decree.Text, (DateTime)date.SelectedDate); * } * else * { * Common_Functions.evictionOL(globalConnection, id, decree.Text, (DateTime)date.SelectedDate); * }*/ page.searchButton_Click(sender, e); window.Close(); this.Close(); }
private void evict_Click(object sender, RoutedEventArgs e) { MySqlCommand evict = new MySqlCommand(); evict.Connection = globalConnection; if (type == "S") { evict.CommandText = "UPDATE Students SET evicted = 1, EvictedTill = '" + ((DateTime)evictDate.SelectedDate).ToString("yyyy-MM-dd H:mm:ss") + "', Room = null WHERE Student_ID = '" + globalWindow.id.Text + "';"; } else { evict.CommandText = "UPDATE OtherLiving SET evicted = 1, EvictedTill = '" + ((DateTime)evictDate.SelectedDate).ToString("yyyy-MM-dd H:mm:ss") + "', Room = null WHERE ID = '" + globalWindow.id.Text + "';"; } evict.ExecuteNonQuery(); Common_Functions.delete_FromRoom(globalConnection, globalWindow.roomNumber.Content.ToString()); globalWindow.Close(); this.Close(); }