public double Insert(Department department, Stopwatch stopwatch)
 {
    double execTime;
    using (SqlConnection sqlConnection = new SqlConnection(connectionString))
    {
       sqlConnection.Open();
       using (SqlCommand command = new SqlCommand())
       {
          command.Connection = sqlConnection;
          command.CommandType = CommandType.Text;
          command.CommandText = "INSERT INTO [dbo].[Department] (Id, Name, DateAdded) VALUES (@id, @name, @dateAdd)";
          command.Parameters.AddWithValue("@id", department.Id);
          command.Parameters.AddWithValue("@name", department.Name);
          command.Parameters.AddWithValue("@dateAdd", department.DateAdded);
          
          stopwatch.Restart();
          command.ExecuteNonQuery();
          stopwatch.Stop();
          execTime = ((double)stopwatch.ElapsedTicks / (double)System.Diagnostics.Stopwatch.Frequency) * 1000;
       }
       sqlConnection.Close();
    }
    return execTime;
 }
      public double SelectDepartmentByName(string name, Stopwatch stopwatch)
      {
         double execTime;
         using (SqlConnection sqlConnection = new SqlConnection(connectionString))
         {
            sqlConnection.Open();
            using (SqlCommand command = new SqlCommand())
            {
               command.Connection = sqlConnection;
               command.CommandType = CommandType.Text;
               command.CommandText = "SELECT Id, Name, DateAdded FROM [dbo].[Department] WHERE Name LIKE @name";
               command.Parameters.AddWithValue("@name", name);

               stopwatch.Restart();
               using (SqlDataReader rdr = command.ExecuteReader())
               {
                  if (rdr.HasRows)
                  {
                     while (rdr.Read())
                     {
                        Department department = new Department
                        {
                           Id = rdr.GetInt32(0),
                           Name = rdr.GetString(1),
                           DateAdded = rdr.GetDateTime(2),
                        };
                     }
                  }
                  stopwatch.Stop();
                  execTime = ((double)stopwatch.ElapsedTicks / (double)System.Diagnostics.Stopwatch.Frequency) * 1000;
                  rdr.Close();
               }
            }
            sqlConnection.Close();
         }
         return execTime;
      }