예제 #1
0
        private static int FindDefaultCountry(Org org)
        {
            //Find default country = Country of anchor.
            Geographies line = Geography.FromIdentity(org.AnchorGeographyId).GetLine();

            Geography[] arrLine = line.ToArray();
            Array.Reverse(arrLine);
            Countries countries  = Countries.GetAll();
            int       foundCntry = 1; //sweden

            foreach (Geography geo in arrLine)
            {
                if (geo.Identity == 1)
                {
                    return(foundCntry); //Didnt find any, we are at world.
                }
                foreach (Country cntry in countries)
                {
                    if (geo.Identity == cntry.GeographyId)
                    {
                        foundCntry = cntry.CountryId;
                        return(foundCntry);
                    }
                }
            }
            return(foundCntry); //Didnt find any
        }
예제 #2
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!Page.IsPostBack)
        {
            // Populate Countries

            Countries countries = Countries.GetAll();

            foreach (Country country in countries)
            {
                DropCountries.Items.Add(new ListItem(country.Code + " " + country.Name, country.Code));
            }

            DropCountries.Items.FindByValue("NO").Selected = true;
            Wizard.ActiveStepIndex       = 0;
            Wizard.SideBarStyle.CssClass = "Invisible";

            if (Request.UrlReferrer != null)
            {
                LabelReferrer.Text = Request.UrlReferrer.AbsoluteUri;
            }
            else
            {
                LabelReferrer.Text = string.Empty;
            }
        }
    }
예제 #3
0
    protected void Page_Load(object sender, EventArgs e)
    {
        int personId = 1;

        Person person = Person.FromIdentity(personId);

        // TODO: Authority check

        // Populate initial fields

        if (!Page.IsPostBack)
        {
            this.TextMemberNumber.Text   = person.Identity.ToString();
            this.TextName.Text           = person.Name;
            this.TextStreet.Text         = person.Street;
            this.TextPostalCode.Text     = person.PostalCode;
            this.TextCity.Text           = person.CityName;
            this.TextEmail.Text          = person.Email;
            this.LabelGeographyLine.Text = string.Empty; //...

            // Populate countries

            Countries countries = Countries.GetAll();
            foreach (Country country in countries)
            {
                DropCountries.Items.Add(new ListItem(country.Code + " " + country.Name, country.Code));
            }

            DropCountries.Items.FindByValue(person.Country.Code).Selected = true;
        }
    }
예제 #4
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!Page.IsPostBack)
        {
            // Populate Countries

            Countries countries = Countries.GetAll();

            foreach (Country country in countries)
            {
                DropCountries.Items.Add(new ListItem(country.Code + " " + country.Name, country.Code));
            }

            //TODO: hardcoded finland
            DropCountries.Items.FindByValue("FI").Selected = true;
            Wizard.ActiveStepIndex       = 0;
            Wizard.SideBarStyle.CssClass = "Invisible";

            if (Request.UrlReferrer != null)
            {
                LabelReferrer.Text = Request.UrlReferrer.AbsoluteUri;
            }
            else
            {
                LabelReferrer.Text = string.Empty;
            }
            if (Request["repeat"] != null && Request["repeat"].ToLower().StartsWith("y"))
            {
                Wizard.ActiveStepIndex = 5; // Startpage for repeat
            }
            RepeatLink.NavigateUrl = Request.RawUrl;

            LabelMonthExample.Text = DropBirthMonths.Items[1].Text;

            DropDownListSubOrg.Items.Clear();
            DropDownListSubOrg.Items.Add(new ListItem("--- Valitse piiriyhdistys: ---", "")); //choose district organization

            Organizations childorgs = Organization.FromIdentity(Organization.PPFIid).Children;
            foreach (Organization child in childorgs)
            {
                if (child.AcceptsMembers)
                {
                    DropDownListSubOrg.Items.Add(new ListItem(child.Name, child.Identity.ToString()));
                }
            }
        }

        cbParty.Attributes["onclick"]         = "document.getElementById('" + cbPartyAndLocal.ClientID + "').checked=document.getElementById('" + cbParty.ClientID + "').checked;document.getElementById('" + cbPartyAndLocal.ClientID + "').disabled=!document.getElementById('" + cbParty.ClientID + "').checked;document.getElementById('" + DropDownListSubOrg.ClientID + "').disabled=!document.getElementById('" + cbPartyAndLocal.ClientID + "').checked;";
        cbPartyAndLocal.Attributes["onclick"] = "document.getElementById('" + DropDownListSubOrg.ClientID + "').disabled=!document.getElementById('" + cbPartyAndLocal.ClientID + "').checked;";
        // Start by clearing all the error labels, for readability later.

        this.LabelNameError.Visible      = false;
        this.LabelStreetError.Visible    = false;
        this.LabelPostalError.Visible    = false;
        this.LabelPhoneError.Visible     = false;
        this.LabelEmailError.Visible     = false;
        this.LabelBirthdateError.Visible = false;
        this.LabelGenderError.Visible    = false;
        this.LabelCityError.Visible      = false;
    }
예제 #5
0
        private void Populate()
        {
            Countries allCountries = Countries.GetAll();

            this.DropCountries.Items.Clear();

            foreach (Country country in allCountries)
            {
                string countryLocalName = GeographyNames.ResourceManager.GetString("Country_" + country.Code);
                if (string.IsNullOrEmpty(countryLocalName))
                {
                    countryLocalName = country.Name + "*"; // In English. Asterisk indicates resource missing.
                }
                string countryDisplay = country.Code + " " + countryLocalName;
                this.DropCountries.Items.Add(new ListItem(countryDisplay, country.Code));
            }

            if (CurrentOrganization.DefaultCountry != null)
            {
                this.DropCountries.SelectedValue = CurrentOrganization.DefaultCountry.Code;
            }

            this.DropGenders.Items.Clear();
            this.DropGenders.Items.Add(new ListItem(Global.Global_UnknownUndisclosed, "Unknown"));
            this.DropGenders.Items.Add(new ListItem(Global.Global_Female, "Female"));
            this.DropGenders.Items.Add(new ListItem(Global.Global_Male, "Male"));
        }
예제 #6
0
 public IQueryable <ICountry> GetDuplicates()
 {
     return(Countries.GetAll()
            .Where(c => c.Status != Sungero.CoreEntities.DatabookEntry.Status.Closed)
            .Where(c => Equals(c.Code, _obj.Code))
            .Where(c => !Equals(c, _obj)));
 }
예제 #7
0
 /// <summary>
 /// Создать страну, регионы и города согласно ФИАС.
 /// </summary>
 public static void CreateCountryRegionsCitiesFromFIAS()
 {
     if (Functions.Module.IsServerCultureRussian() && !Countries.GetAll().Any())
     {
         InitializationLogger.DebugFormat("Init: Create country, regions and cities.");
         Docflow.PublicFunctions.Module.ExecuteSQLCommand(Queries.Module.CreateCountryRegionsCitiesFromFIAS);
     }
 }
예제 #8
0
        /// <summary>
        /// Does a high-level check of the format supplied and determines what type
        /// of location input was supplied.
        ///
        /// Formats are:
        /// 1. city                         - "Bronx"
        /// 2. city,state                   - "Bronx , New York"
        /// 3. city,state( abbreviation )   - "Bronx , NY"
        /// 4. city,country                 - "HomeTown , USA"
        /// 5. state                        - "New Jersey"
        /// 6. state abbreviation           - "NJ"
        /// 7. country                      - "Italy"
        /// the actuall parsing
        /// </summary>
        /// <param name="locationData">The location to parse. Can be any combination of
        /// inputs, check the summary above.</param>
        /// <returns></returns>
        private LocationLookUpResult InternalParse(string locationData)
        {
            CityLookUp    cityLookUp    = new CityLookUp(Cities.GetAll());
            StateLookUp   stateLookUp   = new StateLookUp(States.GetAll());
            CountryLookUp countryLookUp = new CountryLookUp(Countries.GetAll());

            try
            {
                bool isValidUSZipCode = IsUnitedStatesZipCode(locationData);
                bool containsComma    = isValidUSZipCode ? false : locationData.Contains(",");

                // United states Zip code format
                if (isValidUSZipCode)
                {
                    return(ParseUnitedStatesZipCode(locationData));
                }

                // City, ( State or Country )
                // Comma indicates search by city, <state> or <country>
                if (containsComma)
                {
                    return(LocationParser.ParseCityWithStateOrCountry(cityLookUp, stateLookUp, countryLookUp, locationData));
                }

                // Check for city, state, or country.
                // Start with narrowest search.
                // Check city.
                LocationLookUpResult result = LocationParser.ParseCity(cityLookUp, stateLookUp, countryLookUp, locationData);
                if (result != LocationLookUpResult.Empty && result.IsValid)
                {
                    return(result);
                }

                // Check State - 2nd most restrictive search.
                result = LocationParser.ParseState(stateLookUp, countryLookUp, locationData);
                if (result != LocationLookUpResult.Empty && result.IsValid)
                {
                    return(result);
                }

                // Check country - 3rd and final search criteria
                result = LocationParser.ParseCountry(countryLookUp, locationData);
                if (result != LocationLookUpResult.Empty && result.IsValid)
                {
                    return(result);
                }
            }
            catch (Exception ex)
            {
                // Some error during parsing.
                // Log the sucker into our system.
                Logger.Error("Error verifying search location", ex);
            }

            return(new LocationLookUpResult(LocationLookUpType.None, false, "Unable to determine location"));
        }
예제 #9
0
    protected void Page_Load(object sender, EventArgs e)
    {
        Person    viewingPerson = _currentUser;
        Authority authority     = _authority;

        if (!Page.IsPostBack)
        {
            // Localize


            this.LabelBankMessage.Text           = "(optional)";
            this.LabelBankAccountMessage.Text    = "(optional)";
            this.LabelPersonalNumberMessage.Text = "(optional)";

            this.LabelNameMessage.Text      = string.Empty;
            this.LabelBirthDateMessage.Text = "Like 1972-Jan-21";
            this.LabelEmailMessage.Text     = string.Empty;
            this.LabelPhoneMessage.Text     = string.Empty;
            this.LabelPostalMessage.Text    = string.Empty;
            this.LabelStreetMessage.Text    = string.Empty;
            this.LabelGenderMessage.Text    = string.Empty;


            // Populate organizations

            Organizations organizations = authority.GetOrganizations(RoleTypes.AllRoleTypes).ExpandAll();

            foreach (Organization org in organizations)
            {
                if (org.AcceptsMembers)
                {
                    this.DropOrganizations.Items.Add(new ListItem(org.Name, org.Identity.ToString()));
                }
            }

            // Populate countries

            Countries countries = Countries.GetAll();

            foreach (Country country in countries)
            {
                DropCountries.Items.Add(new ListItem(country.Code + " " + country.Name, country.Code));
            }

            // Set default country

            Organization selectedOrg = Organization.FromIdentity(Convert.ToInt32(this.DropOrganizations.SelectedValue));

            DropCountries.Items.FindByValue(selectedOrg.DefaultCountry.Code).Selected = true;


            this.TextName.Focus();
        }
    }
예제 #10
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!Page.IsPostBack)
        {
            if (Request.UrlReferrer != null && Request.UrlReferrer.Host.ToLowerInvariant().Contains("piratpartiet.se"))
            {
                // We are currently at the generic, disambiguating signup. If we know that we are signing up to Piratpartiet SE,
                // redirect to the PPSE-specific signup.

                Response.Redirect("https://pirateweb.net/Pages/Public/SE/People/MemberSignup.aspx");
                return;
            }

            // Populate Countries

            Countries countries = Countries.GetAll();

            foreach (Country country in countries)
            {
                DropCountries.Items.Add(new ListItem(country.Code + " " + country.Name, country.Code));
            }

            //TODO: hardcoded sweden
            DropCountries.Items.FindByValue("SE").Selected = true;
            Wizard.ActiveStepIndex       = 0;
            Wizard.SideBarStyle.CssClass = "Invisible";

            if (Request.UrlReferrer != null)
            {
                LabelReferrer.Text = Request.UrlReferrer.AbsoluteUri;
            }
            else
            {
                LabelReferrer.Text = string.Empty;
            }
            if (Request["repeat"] != null && Request["repeat"].ToLower().StartsWith("y"))
            {
                Wizard.ActiveStepIndex = 5; // Startpage for repeat
            }
            RepeatLink.NavigateUrl = Request.RawUrl;
        }

        // Start by clearing all the error labels, for readability later.

        this.LabelNameError.Visible      = false;
        this.LabelStreetError.Visible    = false;
        this.LabelPostalError.Visible    = false;
        this.LabelPhoneError.Visible     = false;
        this.LabelEmailError.Visible     = false;
        this.LabelBirthdateError.Visible = false;
        this.LabelGenderError.Visible    = false;
        this.LabelCityError.Visible      = false;
    }
예제 #11
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!Page.IsPostBack)
        {
            // Populate Countries

            Countries countries = Countries.GetAll();

            foreach (Country country in countries)
            {
                DropCountries.Items.Add(new ListItem(country.Code + " " + country.Name, country.Code));
            }

            //TODO: hardcoded denmark
            DropCountries.Items.FindByValue("DK").Selected = true;
            Wizard.ActiveStepIndex       = 0;
            Wizard.SideBarStyle.CssClass = "Invisible";

            if (Request.UrlReferrer != null)
            {
                LabelReferrer.Text = Request.UrlReferrer.AbsoluteUri;
            }
            else
            {
                LabelReferrer.Text = string.Empty;
            }
            if (Request["repeat"] != null && Request["repeat"].ToLower().StartsWith("y"))
            {
                Wizard.ActiveStepIndex = 5; // Startpage for repeat
            }
            RepeatLink.NavigateUrl = Request.RawUrl;

            LabelMonthExample.Text = DropBirthMonths.Items[1].Text;
        }

        // Start by clearing all the error labels, for readability later.

        this.LabelNameError.Visible      = false;
        this.LabelStreetError.Visible    = false;
        this.LabelPostalError.Visible    = false;
        this.LabelPhoneError.Visible     = false;
        this.LabelEmailError.Visible     = false;
        this.LabelBirthdateError.Visible = false;
        this.LabelGenderError.Visible    = false;
        this.LabelCityError.Visible      = false;
    }
예제 #12
0
    private void FillDefaultCountry(string defaultCountryCode)
    {
        try
        {
            DropDownList DropCountries = FindControlRecursive(FormView1, "DropDefaultCountry") as DropDownList;
            if (DropCountries.Items.Count < 1)
            {
                Countries countries = Countries.GetAll();

                foreach (Country country in countries)
                {
                    DropCountries.Items.Add(new ListItem(country.Code + " " + country.Name, country.Code));
                }

                DropCountries.Items.FindByValue(defaultCountryCode).Selected = true;
            }
        }
        catch { }
    }
예제 #13
0
    protected void Page_Load(object sender, EventArgs e)
    {
        _authority = Person.FromIdentity(Convert.ToInt32(HttpContext.Current.User.Identity.Name)).GetAuthority();

        if (!Page.IsPostBack)
        {
            // Initialize the fields from the Person object

            this.ButtonSaveChanges.Text = this.GetLocalResourceObject("Interface.Controls.Common.ButtonSaveChanges").ToString() /*Save Changes*/;

            // Member number

            this.TextMemberNumber.Text  = Person.Identity.ToString();
            this.LabelMemberNumber.Text = this.GetLocalResourceObject("Interface.Controls.EditPerson.MemberNumber").ToString() /*Member #*/ + "&nbsp;&nbsp;";

            // Name

            this.TextName.Text = Person.Name;
            this.TextName.Attributes.Add("onkeypress", "OnTextChange (this);");
            this.TextName.Attributes.Add("onchange", "OnTextChange (this);");
            this.LabelName.Text = this.GetLocalResourceObject("Interface.Controls.EditPerson.Name").ToString() /*Name*/ + "&nbsp;&nbsp;";

            // Street

            this.TextStreet.Text = Person.Street;
            this.TextStreet.Attributes.Add("onkeypress", "OnTextChange (this);");
            this.TextStreet.Attributes.Add("onchange", "OnTextChange (this);");
            this.LabelStreet.Text = this.GetLocalResourceObject("Interface.Controls.EditPerson.Street").ToString() /*Street*/ + "&nbsp;&nbsp;";

            // Postal code, city

            this.TextPostalCode.Text = Person.PostalCode;
            this.TextPostalCode.Attributes.Add("onkeypress", "OnTextChangePostals();");
            this.TextCity.Text = Person.CityName;
            this.TextCity.Attributes.Add("onkeypress", "OnTextChangePostals();");
            this.TextCity.Attributes.Add("onchange", "OnTextChangePostals();");
            this.LabelPostal.Text = this.GetLocalResourceObject("Interface.Controls.EditPerson.Postal").ToString() /*Postal code, CityName*/ + "&nbsp;&nbsp;";

            this.DropDownMunicipalities.Attributes.Add("onchange", "OnChangeMunicipality();");


            // Countries

            this.DropCountries.Attributes.Add("onchange", "OnChangeCountries();");
            this.LabelCountry.Text = this.GetLocalResourceObject("Interface.Controls.EditPerson.Country").ToString() /*Country*/ + "&nbsp;&nbsp;";

            Cities cities          = Cities.FromPostalCode(Person.PostalCode.Replace(" ", ""), person.Country);
            int    personGeography = person.GeographyId;
            DropDownMunicipalities.Items.Clear();
            bool foundCurrent = false;

            foreach (City city in cities)
            {
                Geographies subGeo = city.Geography.GetTree();
                foreach (Geography geo in subGeo)
                {
                    // ignore  if it is not a leaf
                    if (geo.ChildrenCount == 0)
                    {
                        DropDownMunicipalities.Items.Add(new ListItem(geo.Name, geo.GeographyId.ToString()));

                        if (geo.GeographyId == person.GeographyId)
                        {
                            foundCurrent = true;
                        }
                    }
                }
            }


            if (!foundCurrent)
            {
                DropDownMunicipalities.Items.Add(new ListItem(Person.Geography.Name, Person.GeographyId.ToString()));
            }

            DropDownMunicipalities.SelectedValue = Person.GeographyId.ToString();


            // Populate countries

            Countries countries = Countries.GetAll();

            foreach (Country country in countries)
            {
                DropCountries.Items.Add(new ListItem(country.Code + " " + country.Name, country.Code));
            }

            DropCountries.Items.FindByValue(Person.Country.Code).Selected = true;

            // Email

            this.TextEmail.Text = Person.Email;
            this.TextEmail.Attributes.Add("onkeypress", "OnTextChange (this);");
            this.TextEmail.Attributes.Add("onchange", "OnTextChange (this);");
            this.LabelEmail.Text = this.GetLocalResourceObject("Interface.Controls.EditPerson.Email").ToString() + "&nbsp;&nbsp;";

            if (Person.MailUnreachable)
            {
                this.LabelEmailMessage.Text     = "Unreachable!";
                this.LabelEmailMessage.CssClass = "ErrorMessage";
            }

            // Party Email

            this.TextPartyEmail.Text = Person.PartyEmail;
            if (Person.PartyEmail.Length > 2)
            {
                this.ButtonSendNewPassword.Enabled = true;
            }
            else
            {
                this.ButtonSendNewPassword.Visible = false;
            }

            this.LabelPartyEmail.Text = this.GetLocalResourceObject("Interface.Controls.EditPerson.PartyEmail").ToString() /*Party Email*/ + "&nbsp;&nbsp;";

            // Phone

            this.TextPhone.Text = Person.Phone;
            this.TextPhone.Attributes.Add("onkeypress", "OnTextChange(this);");
            this.TextPhone.Attributes.Add("onchange", "OnTextChange(this);");
            this.LabelPhone.Text = this.GetLocalResourceObject("Interface.Controls.EditPerson.Phone").ToString() /*Phone #*/ + "&nbsp;&nbsp;";

            // Birthdate

            this.TextBirthdate.Text = Person.Birthdate.ToShortDateString();
            this.TextBirthdate.Attributes.Add("onkeypress", "OnTextChange(this);");
            this.TextBirthdate.Attributes.Add("onchange", "OnTextChange(this);");
            this.LabelBirthdate.Text = this.GetLocalResourceObject("Interface.Controls.EditPerson.Birthdate").ToString() /*Birthdate*/ + "&nbsp;&nbsp;";

            // Gender

            this.DropGenders.SelectedValue = Person.Gender.ToString();
            this.DropGenders.Attributes.Add("onclick", "OnTextChange(this);");

            // Handle
            try
            {
                this.TextHandle.Text = Person.Handle;
            }
            catch (Exception ex)
            {
                this.TextHandle.Text    = "Connection Error";
                this.TextHandle.ToolTip = ex.Message;
                this.TextHandle.Enabled = false;
            }

            this.TextHandle.Attributes.Add("onkeypress", "OnTextChange(this);");
            this.TextHandle.Attributes.Add("onchange", "OnTextChange(this);");
            this.LabelHandle.Text = this.GetLocalResourceObject("Interface.Controls.EditPerson.ForumHandle").ToString() /*Forum Handle*/ + "&nbsp;&nbsp;";

            // Personal Number

            this.TextPersonalNumber.Text = Person.PersonalNumber;
            this.TextPersonalNumber.Attributes.Add("onkeypress", "OnTextChange (this);");
            this.TextPersonalNumber.Attributes.Add("onchange", "OnTextChange (this);");
            this.LabelPersonalNumber.Text = this.GetLocalResourceObject("Interface.Controls.EditPerson.PersonalNumber").ToString() /*Personal #*/ + "&nbsp;&nbsp;";

            // Bank name

            this.TextBankName.Text = Person.BankName;
            this.TextBankName.Attributes.Add("onkeypress", "OnTextChange (this);");
            this.TextBankName.Attributes.Add("onchange", "OnTextChange (this);");
            this.LabelBankName.Text = this.GetLocalResourceObject("Interface.Controls.EditPerson.BankName").ToString() /*Bank Name*/ + "&nbsp;&nbsp;";

            // Bank clearing#

            this.TextBankClearing.Text = Person.BankClearing;
            this.TextBankClearing.Attributes.Add("onkeypress", "OnTextChange (this);");
            this.TextBankClearing.Attributes.Add("onchange", "OnTextChange (this);");
            // this.LabelBankClearing.Text = this.GetLocalResourceObject("Interface.Controls.EditPerson.BankName").ToString()/*Bank Name*/ + "&nbsp;&nbsp;";

            // Bank account

            this.TextBankAccount.Text = Person.BankAccount;
            this.TextBankAccount.Attributes.Add("onkeypress", "OnTextChange (this);");
            this.TextBankAccount.Attributes.Add("onchange", "OnTextChange (this);");
            this.LabelBankAccount.Text = this.GetLocalResourceObject("Interface.Controls.EditPerson.BankAccount").ToString() /*Bank Account*/ + "&nbsp;&nbsp;";

            // Crypto key

            this.TextCryptoFingerprint.Enabled  = false;
            this.TextCryptoFingerprint.ReadOnly = true;

            if (Person.CryptoFingerprint.Length > 4)
            {
                this.TextCryptoFingerprint.Text = Person.CryptoFingerprint;
            }
            else
            {
                this.TextCryptoFingerprint.Text = "--";
            }

            // T-Shirt Size

            this.TextTShirtSize.Enabled  = false;
            this.TextTShirtSize.ReadOnly = true;
            this.TextTShirtSize.Text     = Person.TShirtSize;


            // If we are looking at ourselves, enable the bank fields, which are otherwise disabled

            if (Person.Identity == Convert.ToInt32(HttpContext.Current.User.Identity.Name))
            {
                this.TextBankName.ReadOnly     = false;
                this.TextBankClearing.ReadOnly = false;
                this.TextBankAccount.ReadOnly  = false;
            }
            else
            {
                if (!_authority.HasAnyPermission(Permission.CanEditPeople))
                {
                    this.TextBirthdate.ReadOnly         = true;
                    this.DropGenders.Enabled            = false;
                    this.TextCity.ReadOnly              = true;
                    this.TextEmail.ReadOnly             = true;
                    this.TextHandle.ReadOnly            = true;
                    this.TextMemberNumber.ReadOnly      = true;
                    this.TextName.ReadOnly              = true;
                    this.TextPartyEmail.ReadOnly        = true;
                    this.TextPersonalNumber.ReadOnly    = true;
                    this.TextPhone.ReadOnly             = true;
                    this.TextPostalCode.ReadOnly        = true;
                    this.TextStreet.ReadOnly            = true;
                    this.DropCountries.Enabled          = false;
                    this.DropDownMunicipalities.Enabled = false;
                    this.ButtonSendNewPassword.Enabled  = false;
                    this.ButtonSaveChanges.Visible      = false;
                }
            }
        }

        if (_authority.HasPermission(Permission.CanEditMailDB, Organization.PPSEid, -1, Authorization.Flag.AnyGeographyExactOrganization))
        {
            ButtonDeleteMail.Visible = true;
            if (TextPartyEmail.Text.Trim() != "")
            {
                ButtonDeleteMail.Enabled = true;
            }
            else
            {
                ButtonDeleteMail.Enabled = false;
            }
        }
    }
예제 #14
0
    protected void Page_Load(object sender, EventArgs e)
    {
        // Set a couple of input box widths

        this.TextFirstName.Style[HtmlTextWriterStyle.Width]  = "100px";
        this.TextStreet.Style[HtmlTextWriterStyle.Width]     = "250px";
        this.TextPostalCode.Style[HtmlTextWriterStyle.Width] = "50px";

        this.DropBirthDay.Style[HtmlTextWriterStyle.Width]   = "45px";
        this.DropBirthMonth.Style[HtmlTextWriterStyle.Width] = "100px";
        this.DropBirthYear.Style[HtmlTextWriterStyle.Width]  = "60px";

        if (!Page.IsPostBack)
        {
            // Populate dropdowns

            // Countries

            Countries countries = Countries.GetAll();
            foreach (Country country in countries)
            {
                DropCountries.Items.Add(new ListItem(country.Code + " " + country.Name, country.Code));
            }
            DropCountries.Items.FindByValue("SE").Selected = true;

            // Months

            CultureInfo previousCulture = Thread.CurrentThread.CurrentCulture;

            Thread.CurrentThread.CurrentCulture = new CultureInfo(Country.FromCode("SE").Culture);

            for (int month = 1; month <= 12; month++)
            {
                DropBirthMonth.Items.Add(new ListItem(new DateTime(2010, month, 1).ToString("MMMM"), month.ToString("0#")));
            }

            Thread.CurrentThread.CurrentCulture = previousCulture;

            // Days

            for (int day = 1; day <= 31; day++)
            {
                DropBirthDay.Items.Add(new ListItem(day.ToString("0#")));
            }

            // Years. People need to sign up of their own free will -- assume people under 3 can't read yet.

            int maxYear = DateTime.Today.Year - 3;

            for (int year = 1900; year <= maxYear; year++)
            {
                DropBirthYear.Items.Add(new ListItem(year.ToString()));
            }

            DropBirthYear.SelectedIndex = 85;

            // Assume no postback means we're at first page, so set focus

            this.TextFirstName.Focus();

            // Remember the referrer before the first postback

            if (Request.UrlReferrer != null)
            {
                ViewState["Referrer"] = Request.UrlReferrer.ToString();
            }
            else
            {
                ViewState["Referrer"] = string.Empty;
            }
        }
    }