protected void btnSelectTimeSlot_Click(object sender, EventArgs e) { cvSelectTimeSlotUnavailable.IsValid = true; cvSelectTimeSlotError.IsValid = true; try { //check if we have a valid club selected Boolean blnTimeSuccessfullySelected = clubFindSelect.SelectedIndex != 0; if (blnTimeSuccessfullySelected == true && Session["sess_Transaction"] != null) { //load transaction transaction = (Transaction)Session["sess_Transaction"]; //selected wave DateTime selectedWaveDateTime = Convert.ToDateTime(drpRaceDate.SelectedValue.Trim() + " " + drpTimeSlot.SelectedValue.Trim() + ":00", System.Globalization.CultureInfo.CreateSpecificCulture("en-GB")); //set transaction foreach (Wave wave in transaction.Waves) { if (wave.GunTime == selectedWaveDateTime) { //assign wave to subscriber transaction.Subscriber = new Athlete(); transaction.Subscriber.Wave = wave; //assign race transaction.Subscriber.Race = wave.Race; Registration vs = new Registration(); //Add Authentication //vs.PreAuthenticate = true; //NetworkCredential myCred = new NetworkCredential("VARegistration", "cr34m t34"); //CredentialCache myCache = new CredentialCache(); //myCache.Add(new Uri(vs.Url), "Basic", myCred); //vs.Credentials = myCache; //New code added - alternate way of passing user credentials vs.UserCredentialsValue = getCredentails(); transaction = vs.GetAvailability(transaction); if (transaction.Status == TransactionStatus.OK) { transaction = vs.Reserve(transaction); if (transaction.Status == TransactionStatus.OK) { Session["sess_Transaction"] = transaction; //Update Page string classNames; classNames = pnlStep3.Attributes["class"]; pnlStep3.Attributes.Add("class", classNames.Replace(" hidden", "")); classNames = pnlStep4.Attributes["class"]; pnlStep4.Attributes.Add("class", classNames.Replace(" hidden", "")); classNames = pnlStep5.Attributes["class"]; pnlStep5.Attributes.Add("class", classNames.Replace(" hidden", "")); classNames = pnlStep6.Attributes["class"]; pnlStep6.Attributes.Add("class", classNames.Replace(" hidden", "")); classNames = timeWarning.Attributes["class"]; timeWarning.Attributes.Add("class", classNames.Replace(" hidden", "")); ////Test //Athlete subscriber = transaction.Subscriber; //subscriber.IsTeam = true; //subscriber.Type = AthleteType.Member; //subscriber.Firstname = "MyName"; //subscriber.Lastname = "MySurname"; //subscriber.Dob = Convert.ToDateTime("12/12/1980", System.Globalization.CultureInfo.CreateSpecificCulture("en-GB")); //subscriber.Gender = AthleteGender.Male; //subscriber.Address1 = "MyAddress1"; //subscriber.Address2 = "MyAddress2"; //subscriber.City = "MyAddress3"; //subscriber.Postcode = "sw11 1hh"; //subscriber.Phone = "0123412341234"; //subscriber.Email = "*****@*****.**"; ////Add Team Details ////Team name //subscriber.Team = "My Team"; ////Add user 1 //subscriber.Firstname2 = "MyTeamMateName"; //subscriber.Lastname2 = "MyTeamMateSurname"; //subscriber.Dob2 = Convert.ToDateTime("12/12/1978", System.Globalization.CultureInfo.CreateSpecificCulture("en-GB")); //subscriber.Gender2 = AthleteGender.Male; ////Add Next Of Kin //subscriber.NOKName = "MyNextForename MyNextSurname"; //subscriber.NOKRelation = "Brother"; //subscriber.NOKPhone = "01234567890"; //transaction.Subscriber = subscriber; ////Set user //User user = new User(); //user.Firstname = "MyName"; //user.Lastname = "MySurname"; //user.Password = ""; //user.Username = "******"; //transaction.User = user; ////Now subscribe ////Registration vs = new Registration(); //transaction = vs.Subscribe(transaction); //End Test pnlForm.Update(); return; } else if (transaction.Status == TransactionStatus.Unavailable) { //Display error cvSelectTimeSlotUnavailable.IsValid = false; //Update Page pnlForm.Update(); return; } else { Log.Error(String.Format("Error Message from Indoor Tri webservice Reserve: {0}", transaction.Err_msg), this); } } else if (transaction.Status == TransactionStatus.Unavailable) { //Display error cvSelectTimeSlotUnavailable.IsValid = false; //Update Page pnlForm.Update(); return; } else { Log.Error(String.Format("Error Message from Indoor Tri webservice GetAvailability: {0}", transaction.Err_msg), this); } break; } } } } catch (Exception ex) { Log.Error(String.Format("Error reserving Indoor Triathlon selecting time slots: {0}", ex.Message), null); //Error -Display message cvSelectTimeSlotError.IsValid = false; } //Error -Display message cvSelectTimeSlotError.IsValid = false; //Update Page pnlForm.Update(); }