コード例 #1
0
    protected void Page_Load(object sender, EventArgs e)
    {
        int maxRegistration = Convert.ToInt32(ConfigurationManager.AppSettings["MaxRegistration"] ?? "99999999");
        int numberRegisteredCurrentYear = Utils.GetNumberRegistered();
        bool registrationClosed = numberRegisteredCurrentYear > maxRegistration;

        // if not logged in, don't let them go to registratoin page if full
        if (!Context.User.Identity.IsAuthenticated && registrationClosed)
        {
            Response.Redirect("~/CodeCampClosedForRegistration.aspx");
        }

        if (!IsPostBack)
        {
            int sponsorListId = Utils.GetSponsorIdBasedOnUsername(Context.User.Identity.Name);
            if (sponsorListId > 0)
            {
                var rec = SponsorListManager.I.Get(new SponsorListQuery() { Id = sponsorListId }).FirstOrDefault();
                HyperLinkSponsorInformation.Text = String.Format(
                    "Sponsorship Information For {0}", rec.SponsorName);
                HyperLinkSponsorInformation.Visible = true;
            }
        }

        // if logged in, but currently not registered for saturday or sunday, don't let them login in unless special role set

        if (Context.User.Identity.IsAuthenticated && registrationClosed)
        {
            if (!Utils.CheckUserIsAllowRegistration()
                && !Utils.CheckUserIsVolunteerCoordinator() && !Utils.CheckUserIsPresenterOrAdmin())
            {
                int attendeeId = Utils.GetAttendeesIdFromUsername(Context.User.Identity.Name);
                var attendeeRec = AttendeesManager.I.Get(new AttendeesQuery() {Id = attendeeId}).FirstOrDefault();
                if (attendeeRec != null)
                {

                    if (!Utils.IsRegisteredForCurrentCodeCampYear(Context.User.Identity.Name,
                                                                 Utils.CurrentCodeCampYear))
                    {
                        Response.Redirect("~/CodeCampClosedForRegistration.aspx");
                    }
                }

            }

        }

        // could optimize below if statement)
        if ((ConfigurationManager.AppSettings["SubmitSessionsOpen"] != null &&
            ConfigurationManager.AppSettings["SubmitSessionsOpen"].Equals("true")) || Utils.CheckUserIsSubmitSession() ||
            Utils.CheckUserIsAdmin())
        {
            CheckBoxSpeakerDDL.Enabled = true;
            LabelSessionClosedMessage.Text = String.Empty;
        }
        else
        {
            CheckBoxSpeakerDDL.Enabled = false;
            LabelSessionClosedMessage.Text = "Sessions are closed to new submissions";
        }

        if (Request.QueryString["PKID"] != null)
        {
            string guidString = Request.QueryString["PKID"];
            string username = Utils.GetAttendeeUsernameByGUID(guidString);
            if (!String.IsNullOrEmpty(username))
            {
                if (!Utils.GetIgnoreAutoSignOnGuid(username))
                {
                    if (!string.IsNullOrEmpty(username))
                    {
                        if (User.Identity.IsAuthenticated)
                        {
                            FormsAuthentication.SignOut();
                        }
                        FormsAuthentication.SetAuthCookie(username, true);
                        Response.Redirect("~/Register.aspx", true);
                    }
                }
            }
        }

        if (PageMode == RegistrationPageMode.NotRegistered)
        {
            if (!IsPostBack)
            {
                RegisteringEasyFreeId.Text = "Registering is easy and FREE!";
                LoggedInButNotRegisteredThisYearID.Visible = false;
                ButtonUpdateOrRegister.Text = "Register";
                ButtonRegisterOrUpdate1.Text = "Register";
                //ButtonCancelRegistration.Visible = false;
                //ButtonUnsubscribe.Visible = false;
            }
        }

        if (Context.User.Identity.IsAuthenticated)
        {
            int attendeeId = Utils.GetAttendeesIdFromUsername(Context.User.Identity.Name);
            bool isSpeakingThisYear = Utils.CheckAttendeeIdIsSpeaker(attendeeId);

            if (isSpeakingThisYear)
            {
                if (ConfigurationManager.AppSettings["SpeakerShirtSizes"] != null)
                {
                    string list = ConfigurationManager.AppSettings["SpeakerShirtSizes"];
                    char[] splitchar = { ',' };
                    List<string> newList = list.Split(splitchar).ToList();
                    DropDownListSpeakerShirtSize.Items.Add("--Not Selected");
                    foreach (var item in newList)
                    {
                        DropDownListSpeakerShirtSize.Items.Add(new ListItem(item.Trim(), item.Trim()));
                    }
                }
                SpeakerShirtSizeDiv.Visible = true;
            }

            IDRegistrationInfo.Visible = true;
            IDAuthenticated.Visible = true;

            Attendee =
                AttendeesManager.I.Get(new AttendeesQuery
                                           {
                                               Id = attendeeId
                                           }).FirstOrDefault();

            if (Attendee != null && !IsPostBack)
            {
                ButtonUpdateOrRegister.Text = GetButtonRegisterOrUpdateText();
                ButtonRegisterOrUpdate1.Text = GetButtonRegisterOrUpdateText();
                TextBoxPhoneNumber.Text = Attendee.PhoneNumber;
                TextBoxFalafelEventBoardEmail.Text = Attendee.EmailEventBoard;

                ListItem listItem = DropDownListSpeakerShirtSize.Items.FindByValue(Attendee.ShirtSize);
                if (listItem != null)
                {
                    DropDownListSpeakerShirtSize.SelectedValue = listItem.Value;
                }

                CheckBoxAllowEmailFromSpeakerInterested.Checked = Attendee.AllowEmailToSpeakerInterested != null ? Attendee.AllowEmailToSpeakerInterested.Value : false;
                CheckBoxAllowEmailFromSpeakerPlanToAttend.Checked = Attendee.AllowEmailToSpeakerPlanToAttend != null ? Attendee.AllowEmailToSpeakerPlanToAttend.Value : false;
                CheckBoxQRPhoneNumber.Checked = Attendee.QRPhoneAllow != null ? Attendee.QRPhoneAllow.Value : false;

                if (Attendee.EmailSubscription != null)
                {
                    RadioButtonListEmailSubcription.SelectedIndex = Attendee.EmailSubscription.Value;
                }
                else
                {
                    Attendee.EmailSubscription = (int) EmailSubscriptionEnum.AllEmails;
                    RadioButtonListEmailSubcription.SelectedIndex = 0;
                }
                LabelEmailStatusMessage.Text = Attendee.EmailSubscriptionStatus;

                if (Attendee.EmailSubscription == 2)
                {
                    LabelEmailBouncing.Visible = true;
                }

            }

            // Need to see if person already registered for this year.  If so, then take them to profile page
            var attendeesCodeCampYearResult =
                AttendeesCodeCampYearManager.I.Get(new AttendeesCodeCampYearQuery()
                                                       {
                                                           AttendeesId = attendeeId,
                                                           CodeCampYearId = Utils.CurrentCodeCampYear
                                                       }).FirstOrDefault();

            // keep value from being overwritten when autopostback true happens.
            if (attendeesCodeCampYearResult != null && !IsPostBack)
            {
                CheckBoxSaturday.Checked = attendeesCodeCampYearResult.AttendSaturday;
                CheckBoxSunday.Checked = attendeesCodeCampYearResult.AttendSunday;
                CheckBoxVolunteer.Checked = attendeesCodeCampYearResult.Volunteer ?? false;
            }
            else if (CheckBoxUnableToAttend.Checked)
            {
                CheckBoxSaturday.Checked = false;
                CheckBoxSunday.Checked = false;
                var rec = AttendeesCodeCampYearManager.I.Get(new AttendeesCodeCampYearQuery()
                {
                    AttendeesId =
                        attendeeId,
                    CodeCampYearId =
                        Utils.CurrentCodeCampYear,
                }).FirstOrDefault();
                if (rec != null)
                {
                    AttendeesCodeCampYearManager.I.Delete(rec.Id);
                }
                PageMode = RegistrationPageMode.UpdateNotRegisteredThisYear;
            }

            if (PageMode == RegistrationPageMode.UpdateNotRegisteredThisYear)
            {
                RegisteringEasyFreeId.Text = "Update Your Profile For This Year Now!";
                LoggedInButNotRegisteredThisYearID.Visible = true;
                //ButtonCancelRegistration.Visible = false;
                //ButtonUnsubscribe.Visible = true;
            }
            else if (PageMode == RegistrationPageMode.UpdateRegisteredThisYear)
            {
                RegisteringEasyFreeId.Text = "Update Your Profile!";
                LoggedInButNotRegisteredThisYearID.Visible = false;
                //ButtonCancelRegistration.Visible = true;
                //ButtonUnsubscribe.Visible = true;
            }

            //// check if person has sessions.  If so, then make CheckBoxSpeakerDDL default ot Yes
            //List<int> allSessionIdsByAttendeeId =
            //    SessionPresenterManager.I.Get(new SessionPresenterQuery()
            //                                      {
            //                                          AttendeeId = attendeeId
            //                                      }).Select(a => a.SessionId).ToList();
            //int sessionsThisYearCnt = SessionsManager.I.Get(
            //    new SessionsQuery
            //        {
            //            Ids = allSessionIdsByAttendeeId
            //        }).Count;

            if (isSpeakingThisYear)
            {
                CheckBoxSpeakerDDL.SelectedIndex = 0; // first choice is YES
            }

            if (!IsPostBack)
            {
                CaptchaUltimateControl1.DataBind();
            }
        }
        else
        {
            IDRegistrationInfo.Visible = true;
            IDAuthenticated.Visible = false;
            //CaptchaUltimateControl1.Visible = true;
            //LoginStatus1.Visible = false;
            //ShowMessage.Visible = true;
        }

        // check and see if a referral URL is coming in.  If so, keep it for adding
        // to user account
        try
        {
            if (Request.QueryString["Referral"] != null)
            {
                string referralPKIDString = Request.QueryString["Referral"];
                var referralGuid = new Guid(referralPKIDString);
                Items["ReferralGuid"] = referralGuid;
            }
            else if (Session["ReferralGuid"] != null)
            {
                Items["ReferralGuid"] = (Guid) Session["ReferralGuid"];
            }
        }
        catch (Exception ee)
        {
            throw new ApplicationException(ee.ToString());
        }

        //FileUpload fileUpload = (FileUpload) CaptchaUltimateControl1.FindControl("FileUpload1");
        //string str = fileUpload.FileName;
        //string str1 = fileUpload.

        //if (Context.User.Identity.IsAuthenticated)
        //{
        //    int attendeeId = Utils.GetAttendeesIdFromUsername(Context.User.Identity.Name);
        //    AttendeesResult attendeeResultRec =
        //        AttendeesManager.I.Get(new AttendeesQuery() {Id = attendeeId}).FirstOrDefault();
        //    if (attendeeResultRec != null)
        //    {
        //        int totalRecs = (EmailOptOutManager.I.Get(
        //            new EmailOptOutQuery()
        //                {
        //                    Email = attendeeResultRec.Email
        //                })).Count;
        //        if (totalRecs > 0)
        //        {
        //            ButtonReSubscribe.Visible = true;
        //            ButtonUnsubscribe.Visible = false;
        //        }
        //        else
        //        {
        //            ButtonReSubscribe.Visible = false;
        //            ButtonUnsubscribe.Visible = true;
        //        }
        //    }
        //}
    }
コード例 #2
0
        public HttpResponseMessage PostForgotPassword(AttendeesResult attendeesResult)
        {
            HttpResponseMessage response;

            string usernameOrEmail = attendeesResult.Username;


            string username = Utils.GetUsernameFromEmail(usernameOrEmail);
            if (String.IsNullOrEmpty(username))
            {
                string goodEmail = Utils.GetEmailFromUsername(usernameOrEmail);
                username = Utils.GetUsernameFromEmail(goodEmail);
            }

            if (String.IsNullOrEmpty(username))
            {
                response =
                    Request.CreateErrorResponse(HttpStatusCode.ExpectationFailed,
                                                "Name not found as either username or email.  Please register as new attendee");
            }
            else
            {
                var attendeeRec = AttendeesManager.I.Get(new AttendeesQuery {Username = username}).FirstOrDefault();
                if (attendeeRec == null)
                {
                    throw new ApplicationException("attendeeRec could not be loaded");
                }
                MembershipUser mu = Membership.GetUser(username);
                if (mu == null)
                {
                    throw new ApplicationException("MembershipUser mu not found");
                }
                var newPassword = mu.ResetPassword();
                var msg = new EmailMessage(true, false)
                    {
                        Logging = false,
                        LogOverwrite = false,
                        //LogPath = Context.Server.MapPath(String.Empty) + "\\App_Data\\EmailPasswordRecovery.log",
                        FromAddress = Utils.GetServiceEmailAddress(),
                        To = attendeeRec.Email,
                        Subject = "Your New Password For http://www.siliconvalley-codecamp.com"
                    };

                if (msg.Server.Equals("smtp.gmail.com"))
                {
                    var ssl = new AdvancedIntellect.Ssl.SslSocket();
                    msg.LoadSslSocket(ssl);
                    msg.Port = 587;
                }

                var sb = new StringBuilder();
                sb.AppendLine(
                    String.Format("Please log in to your codecamp account ({0}) with the new password: {1}",
                                  username, newPassword));
                sb.AppendLine(" ");
                sb.AppendLine("We suggest that after you log in, you change your password.");
                sb.AppendLine("We store your password in an encrypted format which is");
                sb.AppendLine("why we are unable to send you your original password.");
                sb.AppendLine(" ");
                sb.AppendLine("We are looking forward to seeing you at camp!");
                sb.AppendLine(" ");
                sb.AppendLine("Best Regards,");
                sb.AppendLine("");
                sb.AppendLine("http://www.siliconvalley-codecamp.com");

                msg.Body = sb.ToString();

                try
                {
                    msg.Send();
                    response =
                        Request.CreateResponse(HttpStatusCode.OK, new AttendeesResult()
                            {
                                Email = attendeeRec.Email,
                                Username = attendeeRec.Username,
                                Id = attendeeRec.Id
                            });
                }
                catch (Exception e)
                {
                    response =
                        Request.CreateErrorResponse(HttpStatusCode.ExpectationFailed,
                                                    "We found your account but email could not be delivered to " +
                                                    attendeeRec.Email + " for account " + attendeeRec.Username +
                                                    ".  Please Make a new account or contact [email protected] and we will reset the password for you.");
                }
            }
            return response;
        }
コード例 #3
0
 private AttendeesResult MakeSafeAttendee(AttendeesResult attendeesResultFull)
 {
     attendeesResultFull.ApplicationName = "";
     attendeesResultFull.FullNameUsernameZipcode = "";
     attendeesResultFull.PKID = Guid.Empty;
     attendeesResultFull.Password = "";
     attendeesResultFull.PasswordAnswer = "";
     attendeesResultFull.PasswordQuestion = "";
     attendeesResultFull.UserImage = null;
     return attendeesResultFull;
 }
コード例 #4
0
        private HttpResponseMessage UpdateAttendeeRecordParts(AttendeesResult attendeeRecord, string attendeeSaveOption)
        {
            HttpResponseMessage response;

            if (!User.Identity.IsAuthenticated)
            {
                response =
                    Request.CreateErrorResponse(HttpStatusCode.Forbidden,
                                                "User Not Logged In So Update Forbidden");
            }
            
            else
            {
                var attendeesResult =
                    AttendeesManager.I.Get(new AttendeesQuery
                        {
                            Username = User.Identity.Name,
                            CodeCampYearId = Utils.CurrentCodeCampYear,
                            IncludeAttendeesCodeCampYearResult = true
                        }).FirstOrDefault();
                if (attendeesResult != null)
                {
                    // if attempting to change password then stop them here if problem
                    if (!String.IsNullOrEmpty(attendeesResult.Password1) &&
                        (!attendeesResult.Password1.Equals(attendeesResult.Password2)))
                    {
                        response =
                            Request.CreateErrorResponse(HttpStatusCode.ExpectationFailed,
                                                        "If password entered, password and confirmation must be identical");
                    }
                    else
                    {
                        if (attendeeSaveOption.ToLower().Equals("optin"))
                        {
                            attendeesResult.OptInSponsorSpecialsLevel = attendeeRecord.OptInSponsorSpecialsLevel;
                            attendeesResult.OptInSponsoredMailingsLevel = attendeeRecord.OptInSponsoredMailingsLevel;
                            attendeesResult.OptInTechJobKeyWords = attendeeRecord.OptInTechJobKeyWords;
                            attendeesResult.OptInSvccKids = attendeeRecord.OptInSvccKids;
                        }
                        else
                        {
                            // These are the only fields that can get updated by the caller (security)
                            // (for both speaker and attendee)
                            attendeesResult.Email = attendeeRecord.Email;
                            attendeesResult.UserFirstName = attendeeRecord.UserFirstName;
                            attendeesResult.UserLastName = attendeeRecord.UserLastName;
                            attendeesResult.City = attendeeRecord.City;
                            attendeesResult.State = attendeeRecord.State;
                            attendeesResult.UserZipCode = attendeeRecord.UserZipCode;
                            attendeesResult.TwitterHandle = attendeeRecord.TwitterHandle;
                            attendeesResult.AttendingDaysChoiceCurrentYear =
                                attendeeRecord.AttendingDaysChoiceCurrentYear;
                            attendeesResult.RegisteredCurrentYear = attendeeRecord.RegisteredCurrentYear;
                            attendeesResult.PhoneNumber = attendeeRecord.PhoneNumber;
                            attendeesResult.EmailEventBoard = attendeeRecord.EmailEventBoard;
                            attendeesResult.VolunteeredCurrentYear = attendeeRecord.VolunteeredCurrentYear;
                            attendeesResult.PrincipleJob = attendeeRecord.PrincipleJob;
                            attendeesResult.Company = attendeeRecord.Company;


                            // speaker stuff below
                            if (attendeeSaveOption.ToLower().Equals("speaker"))
                            {
                                attendeesResult.FacebookId = attendeeRecord.FacebookId;
                                attendeesResult.GooglePlusId = attendeeRecord.GooglePlusId;
                                attendeesResult.LinkedInId = attendeeRecord.LinkedInId;
                                attendeesResult.ShirtSize = attendeeRecord.ShirtSize;
                                attendeesResult.UserBio = attendeeRecord.UserBio;
                            }
                        }


                        attendeesResult.CurrentCodeCampYear = Utils.CurrentCodeCampYear;
                        AttendeesManager.I.UpdateWithAttendeeCCY(attendeesResult);

                        response = Request.CreateResponse(HttpStatusCode.OK, MakeSafeAttendee(attendeesResult));
                    }
                }
                else
                {
                    response =
                        Request.CreateErrorResponse(HttpStatusCode.Forbidden,
                                                    "User Authenticated but no base attendee record found");
                }
            }
            return response;
        }
コード例 #5
0
        public HttpResponseMessage PostCreateUser(AttendeesResult attendee)
        {
            HttpResponseMessage response;
            if (!ConfigurationManager.AppSettings["OverrideCaptcha"].ToLower().Equals("true") &&
                !HttpContext.Current.Request.IsAuthenticated)
            {
                // First, verif captcha
                string clientAddress = HttpContext.Current.Request.UserHostAddress;
                string message;
                if (
                    !VerifyRecaptcha(attendee.RecaptchaChallengeField, attendee.RecaptchaResponseField, clientAddress,
                                     out message))
                {
                    response =
                        Request.CreateErrorResponse(HttpStatusCode.ExpectationFailed,
                                                    message);
                    return response;

                }
            }

            if (String.IsNullOrEmpty(attendee.Username) ||
                String.IsNullOrEmpty(attendee.Password) ||
                String.IsNullOrEmpty(attendee.Email))
            {
                response =
                    Request.CreateErrorResponse(HttpStatusCode.Forbidden,
                                                "CreateUser requires non blank Username,Password and Email");
            }
            else if (attendee.Password.Length < 4)
            {
                response =
                    Request.CreateErrorResponse(HttpStatusCode.Forbidden,
                                                "CreateUser requires password at least 4 characters long");
            }
            else
            {
                // now we have username, password and email
                bool emailExists = AttendeesManager.I.CheckAttendeeEmailExists(attendee.Email);
                bool usernameExists = AttendeesManager.I.CheckAttendeeEmailExists(attendee.Username);
                if (emailExists || usernameExists)
                {
                    response =
                        Request.CreateErrorResponse(HttpStatusCode.Forbidden,
                                                    string.Format(
                                                        "CreateUser email or username exists so can not create {0}:{1}",
                                                        emailExists.ToString(), usernameExists.ToString()));
                }
                else
                {
                    // create the user! everything should be good
                    MembershipCreateStatus mStatus;
                    Membership.CreateUser(
                        attendee.Username,
                        attendee.Password,
                        attendee.Email,
                        "Question", "Answer",
                        true,
                        out mStatus);

                    if (mStatus.Equals(MembershipCreateStatus.Success))
                    {
                        FormsAuthentication.SetAuthCookie(attendee.Username, true);
                        // for now update counts
                        var attendeeNew = AttendeesManager.I.Get(new AttendeesQuery()
                            {
                                Username = attendee.Username
                            }).FirstOrDefault();

                        if (attendeeNew != null)
                        {
                            attendeeNew.PresentationLimit = 3;
                            attendeeNew.PresentationApprovalRequired = false;
                            AttendeesManager.I.Update(attendeeNew);
                        }
                        response = Request.CreateResponse(HttpStatusCode.OK, attendeeNew);


                    }
                    else
                    {
                        response =
                            Request.CreateErrorResponse(HttpStatusCode.Forbidden,
                                                        "CreateUser membership failed " + mStatus.ToString());
                    }
                }
            }
            return response;
        }
コード例 #6
0
 public HttpResponseMessage PostUpdateOptIn(AttendeesResult attendeeRecord)
 {
     return UpdateAttendeeRecordParts(attendeeRecord, "optin");
 }
コード例 #7
0
 public HttpResponseMessage PostUpdateAttendee(AttendeesResult attendeeRecord)
 {
     //return  Request.CreateErrorResponse(HttpStatusCode.ExpectationFailed,"test bad responose from PostUpdateAttendee");
     return UpdateAttendeeRecordParts(attendeeRecord, "attendee");
 }
コード例 #8
0
 public HttpResponseMessage PostUpdateSpeaker(AttendeesResult attendeeRecord)
 {
     return UpdateAttendeeRecordParts(attendeeRecord, "speaker");
 }
コード例 #9
0
        public HttpResponseMessage PostCheckUsernameEmailExists(AttendeesResult attendeeRecord)
        {
            Thread.Sleep(300); // try to defend a little against denial of service attack or username searching attack

            var errorMessage = new StringBuilder();

            if (String.IsNullOrEmpty(attendeeRecord.Username) && String.IsNullOrEmpty(attendeeRecord.Email))
            {
                errorMessage.Append("Failure: Must specify username, email or both in incoming parameters.");
            }
            else if (!String.IsNullOrEmpty(attendeeRecord.Username) && String.IsNullOrEmpty(attendeeRecord.Email))
            {
                bool attendeeUsernameExists = AttendeesManager.I.CheckAttendeeUsernameExists(attendeeRecord.Username);
                if (attendeeUsernameExists)
                {
                    errorMessage.Append("Failure: Username Exists.");
                }
            }
            else if (String.IsNullOrEmpty(attendeeRecord.Username) && !String.IsNullOrEmpty(attendeeRecord.Email))
            {
                bool attendeeEmailExists = AttendeesManager.I.CheckAttendeeEmailExists(attendeeRecord.Username);
                if (attendeeEmailExists)
                {
                    errorMessage.Append("Failure: Email Exists.");
                }
            }
            else if (!String.IsNullOrEmpty(attendeeRecord.Username) && !String.IsNullOrEmpty(attendeeRecord.Email))
            {
                bool attendeeUsernameExists = AttendeesManager.I.CheckAttendeeUsernameExists(attendeeRecord.Username);
                bool attendeeEmailExists = AttendeesManager.I.CheckAttendeeEmailExists(attendeeRecord.Username);
                if (attendeeEmailExists || attendeeUsernameExists)
                {
                    if (attendeeEmailExists)
                    {
                        errorMessage.Append("Failure: Email Exists.");
                    }
                    if (attendeeUsernameExists)
                    {
                        errorMessage.Append("Failure: Username Exists");
                    }
                }
            }

            return errorMessage.Length == 0
                       ? Request.CreateResponse(HttpStatusCode.OK, "")
                       : Request.CreateErrorResponse(HttpStatusCode.Forbidden,
                                                     errorMessage.ToString());
        }
コード例 #10
0
        public HttpResponseMessage PostCheckPictureExists(AttendeesResult attendeeRecord)
        {
            Thread.Sleep(300); // try to defend a little against denial of service attack or username searching attack

            var errorMessage = new StringBuilder();

            if (attendeeRecord == null || attendeeRecord.Id <= 0)
            {
                return Request.CreateErrorResponse(HttpStatusCode.Forbidden,
                                                   "PostCheckPictureExists: attendeeRecord no passed in populated");

            }

            var pictureLen = Utils.GetPictureLengthByAttendee(attendeeRecord.Id);

            return pictureLen > 0
                       ? Request.CreateResponse(HttpStatusCode.OK, "")
                       : Request.CreateErrorResponse(HttpStatusCode.Forbidden,
                                                     "picture length for attendee zero");
        }
コード例 #11
0
 /// <summary>
 ///  only create a URL if this person is really a speaker for the given year
 /// </summary>
 /// <param name="speaker"></param>
 /// <param name="query"></param>
 /// <returns></returns>
 private static string CreateSpeakerLocalUrl(AttendeesResult speaker,AttendeesQuery query)
 {
     var retStr = "NOT SPEAKER";
        if (query.PresentersOnly.HasValue && query.PresentersOnly.Value && query.CodeCampYearIds != null && query.CodeCampYearIds.Count == 1)
        {
        retStr = String.Format("/Presenter/{0}/{1}-{2}-{3}",
                               Utils.ConvertCodeCampYearToActualYear(
                                   query.CodeCampYearIds[0].ToString(CultureInfo.InvariantCulture)),
                               speaker.UserFirstName,
                               speaker.UserLastName, speaker.Id);
        }
        return retStr;
 }
コード例 #12
0
        public void UpdateWithAttendeeCCY(AttendeesResult attendeesResult)
        {
            base.Update(attendeesResult);

            if (!attendeesResult.CurrentCodeCampYear.HasValue)
            {
                throw new ApplicationException("IncludeAttendeesCodeCampYearResult seet on AttendeesManager but CurrentCodeCampYear Not also set and is required");
            }

            var rec = AttendeesCodeCampYearManager.I.Get(new AttendeesCodeCampYearQuery
                                                             {
                                                                 AttendeesId = attendeesResult.Id,
                                                                 CodeCampYearId = attendeesResult.CurrentCodeCampYear
                                                             }).FirstOrDefault();
            if (rec != null)
            {
                rec.Volunteer = attendeesResult.VolunteeredCurrentYear;
                rec.AttendingDaysChoice = attendeesResult.AttendingDaysChoiceCurrentYear;
                AttendeesCodeCampYearManager.I.Update(rec);
            }
            else
            {
                var newRec = new AttendeesCodeCampYearResult()
                                 {
                                     CreateDate = DateTime.Now,
                                     CodeCampYearId = attendeesResult.CurrentCodeCampYear.Value,
                                     Volunteer = attendeesResult.VolunteeredCurrentYear,
                                     AttendingDaysChoice = attendeesResult.AttendingDaysChoiceCurrentYear,
                                     AttendeesId = attendeesResult.Id
                                 };
                AttendeesCodeCampYearManager.I.Insert(newRec);
            }
        }