private void continueButton_Click(object sender, RoutedEventArgs e) { TotalCost = 0; EventCalculation.eventStartTime = Convert.ToString(startTimeTextBox.Text); EventCalculation.eventEndTime = Convert.ToString(EndTimeTextBox.Text); EventCalculation.printedPhotos = Convert.ToString(PrintedPhotoTextBox.Text); EventCalculation.eachPhotoCost = Convert.ToString(eachPhotoCostTextBox.Text); int duration = EventCalculation.Duration(Convert.ToDouble(startTimeTextBox.Text), Convert.ToDouble(EndTimeTextBox.Text)); { SqlConnection connection = new SqlConnection("Server=Tanmoy-PC; Database=Wedding Management; User Id=sa; Password=1238628257"); connection.Open(); SqlCommand cmd = new SqlCommand("SELECT Id, Name,Email,ContactNumber,Salary FROM AddedPhotographer", connection); SqlDataReader reader = cmd.ExecuteReader(); List <Members> SearchList = new List <Members>(); if (reader.HasRows) { while (reader.Read()) { SearchList.Add(new Members(reader.GetString(0), reader.GetString(1), reader.GetString(2), reader.GetString(3), reader.GetString(4))); TotalCost = TotalCost + (Convert.ToDouble(reader.GetString(4)) * duration); } tempphotographyCost = TotalCost + (Convert.ToDouble(PrintedPhotoTextBox.Text) * Convert.ToDouble(eachPhotoCostTextBox.Text)); } connection.Close(); EventCalculation.photographyCost = tempphotographyCost; MemberServices clr = new MemberServices(); int j = clr.ClearTable(); Hide(); EventDecoration decor = new EventDecoration(); DecorationService DS = new DecorationService(); connection.Open(); decor.Show(); } }