Ejemplo n.º 1
0
        private static List <ListItem> GetListNameAsListItems(string listName, string parentKey)
        {
            ListController listController = new ListController();

            ListEntryInfoCollection entries;

            if (string.IsNullOrEmpty(parentKey))
            {
                entries = listController.GetListEntryInfoCollection(listName);
            }
            else
            {
                entries = listController.GetListEntryInfoCollection(listName, parentKey);
            }
            List <ListItem> items = new List <ListItem>(entries.Count);

            foreach (ListEntryInfo entry in entries)
            {
                items.Add(new ListItem()
                {
                    Text = entry.Text.Trim(), Value = entry.Value.Trim()
                });
            }

            return(items);
        }
Ejemplo n.º 2
0
        public void GetDropDownListStates()
        {
            try
            {
                // Get State Dropdown from DNN Lists
                ListController          ctlList = new ListController();
                ListEntryInfoCollection vStates = ctlList.GetListEntryInfoCollection("Region", "Country.US", this.PortalId);
                //      ListEntryInfoCollection vStatesCanada = ctlList.GetListEntryInfoCollection("Region", "Country.CA", this.PortalId);



                //  State
                ddlState.DataTextField  = "Value";
                ddlState.DataValueField = "Value";
                ddlState.DataSource     = vStates;
                //    ddlState.DataSource = vStatesCanada;
                ddlState.DataBind();
                ddlState.Items.Insert(0, new ListItem("--", ""));

                List <DistributorLocatorInfo> items;
                DistributorLocatorController  controller = new DistributorLocatorController();

                items = controller.Distributor_Type_GetList();

                ddlDistributorType.DataTextField  = "DistributorType";
                ddlDistributorType.DataValueField = "ItemID";
                ddlDistributorType.DataSource     = items;
                ddlDistributorType.DataBind();
            }
            catch (Exception ex)
            {
                Exceptions.ProcessModuleLoadException(this, ex);
            }
        }
Ejemplo n.º 3
0
        public RegionalInfo GetRegionsFromCountry(string countryCode)
        {
            RegionalInfo            ri              = new RegionalInfo();
            ListController          ctlEntry        = new ListController(); // listKey in format "Country.US:Region"
            string                  listKey         = "Country." + countryCode;
            ListEntryInfoCollection entryCollection = ctlEntry.GetListEntryInfoCollection("Region", listKey);

            if (entryCollection.Count != 0)
            {
                foreach (ListEntryInfo lei in entryCollection)
                {
                    ri.TextArray.Add(lei.Text);
                    ri.ValueArray.Add(lei.Value);
                }
                switch (countryCode)
                {
                case "US":
                    ri.PostalText = "Zip";
                    ri.RegionText = "State";
                    break;

                case "CA":
                    ri.RegionText = "Province";
                    ri.PostalText = "Postal";
                    break;
                }
            }
            else
            {
                ri.RegionText = "Region";
                ri.PostalText = "Postal";
            }
            return(ri);
        }
Ejemplo n.º 4
0
        public static void AddDefaultDefinitions(int PortalId)
        {
            _orderCounter = 1;
            ListController          objListController = new ListController();
            ListEntryInfoCollection dataTypes         = objListController.GetListEntryInfoCollection("DataType");

            AddDefaultDefinition(PortalId, "Name", "Prefix", "Text", 50, dataTypes);
            AddDefaultDefinition(PortalId, "Name", "FirstName", "Text", 50, dataTypes);
            AddDefaultDefinition(PortalId, "Name", "MiddleName", "Text", 50, dataTypes);
            AddDefaultDefinition(PortalId, "Name", "LastName", "Text", 50, dataTypes);
            AddDefaultDefinition(PortalId, "Name", "Suffix", "Text", 50, dataTypes);
            AddDefaultDefinition(PortalId, "Address", "Unit", "Text", 50, dataTypes);
            AddDefaultDefinition(PortalId, "Address", "Street", "Text", 50, dataTypes);
            AddDefaultDefinition(PortalId, "Address", "City", "Text", 50, dataTypes);
            AddDefaultDefinition(PortalId, "Address", "Region", "Region", 0, dataTypes);
            AddDefaultDefinition(PortalId, "Address", "Country", "Country", 0, dataTypes);
            AddDefaultDefinition(PortalId, "Address", "PostalCode", "Text", 50, dataTypes);
            AddDefaultDefinition(PortalId, "Contact Info", "Telephone", "Text", 50, dataTypes);
            AddDefaultDefinition(PortalId, "Contact Info", "Cell", "Text", 50, dataTypes);
            AddDefaultDefinition(PortalId, "Contact Info", "Fax", "Text", 50, dataTypes);
            AddDefaultDefinition(PortalId, "Contact Info", "Website", "Text", 50, dataTypes);
            AddDefaultDefinition(PortalId, "Contact Info", "IM", "Text", 50, dataTypes);
            AddDefaultDefinition(PortalId, "Preferences", "Photo", "Image", 0, dataTypes);
            AddDefaultDefinition(PortalId, "Preferences", "Biography", "RichText", 0, dataTypes);
            AddDefaultDefinition(PortalId, "Preferences", "TimeZone", "TimeZone", 0, dataTypes);
            AddDefaultDefinition(PortalId, "Preferences", "PreferredLocale", "Locale", 0, dataTypes);
        }
Ejemplo n.º 5
0
    protected void Page_Load(object sender, EventArgs e)
    {
        try
        {
            if (!string.IsNullOrEmpty(this.ValidationGroupName))
            {
                AddignValidationGroup(this);
            }
            ListController          ctlEntry        = new ListController();
            ListEntryInfoCollection entryCollection = ctlEntry.GetListEntryInfoCollection("Country");
            if (!Page.IsPostBack)
            {
                ddlCountry.DataSource = entryCollection;
                ddlCountry.DataBind();
                ddlCountry.Items.FindByValue("US").Selected = true;

                string listKey = "Country.US";
                ListEntryInfoCollection regionCollection = ctlEntry.GetListEntryInfoCollection("Region", listKey);
                ddlRegion.DataSource = regionCollection;
                ddlRegion.DataBind();

                atiTxtAddress.TabIndex = Convert.ToInt16(_StartTabIndex);
                atiTxtCity.TabIndex    = Convert.ToInt16(_StartTabIndex + 2);
                ddlCountry.TabIndex    = Convert.ToInt16(_StartTabIndex + 3);
                ddlRegion.TabIndex     = Convert.ToInt16(_StartTabIndex + 4);
                txtRegion.TabIndex     = Convert.ToInt16(_StartTabIndex + 5);
                atiTxtPostal.TabIndex  = Convert.ToInt16(_StartTabIndex + 6);

                if (this.Width != null)
                {
                    ddlCountry.Width    = this.Width;
                    ddlRegion.Width     = this.Width;
                    atiTxtPostal.Width  = this.Width;
                    atiTxtCity.Width    = this.Width;
                    atiTxtAddress.Width = this.Width;
                }
            }
            else
            {
                // ddlCountry.SelectedValue
            }
        }
        catch (DotNetNuke.Services.Exceptions.ModuleLoadException mlex)
        {
        }
    }
Ejemplo n.º 6
0
        /// <Summary>
        /// Localize correctly sets up the control for US/Canada/Other Countries
        /// </Summary>
        private void Localize()
        {
            string         countryCode = cboCountry.SelectedItem.Value;
            ListController ctlEntry    = new ListController();
            // listKey in format "Country.US:Region"
            string listKey = "Country." + countryCode;
            ListEntryInfoCollection entryCollection = ctlEntry.GetListEntryInfoCollection("Region", "", listKey);

            if (entryCollection.Count != 0)
            {
                cboRegion.Visible = true;
                txtRegion.Visible = false;
                cboRegion.Items.Clear();
                cboRegion.DataSource = entryCollection;
                cboRegion.DataBind();
                cboRegion.Items.Insert(0, new ListItem("<" + Localization.GetString("Not_Specified", Localization.SharedResourceFile) + ">", ""));
                if (countryCode.ToLower() == "us")
                {
                    valRegion1.Enabled      = true;
                    valRegion2.Enabled      = false;
                    valRegion1.ErrorMessage = Localization.GetString("StateRequired", Localization.GetResourceFile(this, MyFileName));
                    plRegion.Text           = Localization.GetString("plState", Localization.GetResourceFile(this, MyFileName));
                    plRegion.HelpText       = Localization.GetString("plState.Help", Localization.GetResourceFile(this, MyFileName));
                    plPostal.Text           = Localization.GetString("plZip", Localization.GetResourceFile(this, MyFileName));
                    plPostal.HelpText       = Localization.GetString("plZip.Help", Localization.GetResourceFile(this, MyFileName));
                }
                else
                {
                    valRegion1.ErrorMessage = Localization.GetString("ProvinceRequired", Localization.GetResourceFile(this, MyFileName));
                    plRegion.Text           = Localization.GetString("plProvince", Localization.GetResourceFile(this, MyFileName));
                    plRegion.HelpText       = Localization.GetString("plProvince.Help", Localization.GetResourceFile(this, MyFileName));
                    plPostal.Text           = Localization.GetString("plPostal", Localization.GetResourceFile(this, MyFileName));
                    plPostal.HelpText       = Localization.GetString("plPostal.Help", Localization.GetResourceFile(this, MyFileName));
                }
                valRegion1.Enabled = true;
                valRegion2.Enabled = false;
            }
            else
            {
                cboRegion.ClearSelection();
                cboRegion.Visible       = false;
                txtRegion.Visible       = true;
                valRegion1.Enabled      = false;
                valRegion2.Enabled      = true;
                valRegion2.ErrorMessage = Localization.GetString("RegionRequired", Localization.GetResourceFile(this, MyFileName));
                plRegion.Text           = Localization.GetString("plRegion", Localization.GetResourceFile(this, MyFileName));
                plRegion.HelpText       = Localization.GetString("plRegion.Help", Localization.GetResourceFile(this, MyFileName));
                plPostal.Text           = Localization.GetString("plPostal", Localization.GetResourceFile(this, MyFileName));
                plPostal.HelpText       = Localization.GetString("plPostal.Help", Localization.GetResourceFile(this, MyFileName));
            }

            if (lblRegionRequired.Text == "")
            {
                valRegion1.Enabled = false;
                valRegion2.Enabled = false;
            }
        }
Ejemplo n.º 7
0
        /// <Summary>CreateEditor creates the control collection.</Summary>
        protected override void CreateEditor()
        {
            CategoryDataField             = "PropertyCategory";
            EditorDataField               = "DataType";
            NameDataField                 = "PropertyName";
            RequiredDataField             = "Required";
            ValidationExpressionDataField = "ValidationExpression";
            ValueDataField                = "PropertyValue";
            VisibleDataField              = "Visible";
            VisibilityDataField           = "Visibility";
            LengthDataField               = "Length";

            base.CreateEditor();

            //We need to wire up the RegionControl to the CountryControl
            foreach (FieldEditorControl editor in Fields)
            {
                if (editor.Editor is DNNRegionEditControl)
                {
                    ListEntryInfo country = null;

                    foreach (FieldEditorControl checkEditor in Fields)
                    {
                        if (checkEditor.Editor is DNNCountryEditControl)
                        {
                            DNNCountryEditControl   countryEdit       = (DNNCountryEditControl)checkEditor.Editor;
                            ListController          objListController = new ListController();
                            ListEntryInfoCollection countries         = objListController.GetListEntryInfoCollection("Country");
                            foreach (ListEntryInfo checkCountry in countries)
                            {
                                if (checkCountry.Text == countryEdit.Value.ToString())
                                {
                                    country = checkCountry;
                                    break;
                                }
                            }
                        }
                    }

                    //Create a ListAttribute for the Region
                    string countryKey;
                    if (country != null)
                    {
                        countryKey = "Country." + country.Value;
                    }
                    else
                    {
                        countryKey = "Country.Unknown";
                    }

                    object[] attributes;
                    attributes    = new object[1];
                    attributes[0] = new ListAttribute("Region", countryKey, ListBoundField.Text, ListBoundField.Text);
                    editor.Editor.CustomAttributes = attributes;
                }
            }
        }
        private string GetCountryCode(string Country)
        {
            ListController          oController = new ListController();
            ListEntryInfoCollection oCountries  = oController.GetListEntryInfoCollection("Country");

            foreach (ListEntryInfo oCountry in oCountries)
            {
                if (oCountry.Text.ToLower() == Country.ToLower())
                {
                    return(oCountry.Value);
                }
            }
            return("");
        }
Ejemplo n.º 9
0
 public void GetDropDownLists()
 {
     try
     {
         // MailTo State
         ListController          ctlList = new ListController();
         ListEntryInfoCollection vStates = ctlList.GetListEntryInfoCollection("Region", "Country.US", this.PortalId);
         ddlStatesRecipient.DataTextField  = "Value";
         ddlStatesRecipient.DataValueField = "Value";
         ddlStatesRecipient.DataSource     = vStates;
         ddlStatesRecipient.DataBind();
         ddlStatesRecipient.Items.Insert(0, new ListItem("--", ""));
     }
     catch (Exception ex)
     {
         Exceptions.ProcessModuleLoadException(this, ex);
     }
 }
Ejemplo n.º 10
0
        protected override void OnLoad(EventArgs e)
        {
            if (!IsPostBack)
            {
                ListController          listController = new ListController();
                ListEntryInfoCollection countries      = listController.GetListEntryInfoCollection("Country");
                ddlVendorCountry.DataSource     = countries;
                ddlVendorCountry.DataTextField  = "Text";
                ddlVendorCountry.DataValueField = "Value";
                try
                {
                    ddlVendorCountry.DataBind();
                }
                catch (ArgumentOutOfRangeException ex)
                {
                    ddlVendorCountry.SelectedValue = ddlVendorCountry.Items[0].Value;
                    ddlVendorCountry.DataBind();
                }
            }

            base.OnLoad(e);
        }
Ejemplo n.º 11
0
        /// <Summary>Page_Load runs when the control is loaded</Summary>
        protected void Page_Load(object sender, EventArgs e)
        {
            try
            {
                valStreet.ErrorMessage    = Localization.GetString("StreetRequired", Localization.GetResourceFile(this, MyFileName));
                valCity.ErrorMessage      = Localization.GetString("CityRequired", Localization.GetResourceFile(this, MyFileName));
                valCountry.ErrorMessage   = Localization.GetString("CountryRequired", Localization.GetResourceFile(this, MyFileName));
                valPostal.ErrorMessage    = Localization.GetString("PostalRequired", Localization.GetResourceFile(this, MyFileName));
                valTelephone.ErrorMessage = Localization.GetString("TelephoneRequired", Localization.GetResourceFile(this, MyFileName));
                valCell.ErrorMessage      = Localization.GetString("CellRequired", Localization.GetResourceFile(this, MyFileName));
                valFax.ErrorMessage       = Localization.GetString("FaxRequired", Localization.GetResourceFile(this, MyFileName));

                if (!Page.IsPostBack)
                {
                    if (!String.IsNullOrEmpty(_LabelColumnWidth))
                    {
                        //lblCountry.Width = System.Web.UI.WebControls.Unit.Parse(_LabelColumnWidth)
                        //lblRegion.Width = System.Web.UI.WebControls.Unit.Parse(_LabelColumnWidth)
                        //lblCity.Width = System.Web.UI.WebControls.Unit.Parse(_LabelColumnWidth)
                        //lblStreet.Width = System.Web.UI.WebControls.Unit.Parse(_LabelColumnWidth)
                        //lblUnit.Width = System.Web.UI.WebControls.Unit.Parse(_LabelColumnWidth)
                        //lblPostal.Width = System.Web.UI.WebControls.Unit.Parse(_LabelColumnWidth)
                        //lblTelephone.Width = System.Web.UI.WebControls.Unit.Parse(_LabelColumnWidth)
                        //lblCell.Width = System.Web.UI.WebControls.Unit.Parse(_LabelColumnWidth)
                        //lblFax.Width = System.Web.UI.WebControls.Unit.Parse(_LabelColumnWidth)
                    }

                    if (!String.IsNullOrEmpty(_ControlColumnWidth))
                    {
                        cboCountry.Width   = System.Web.UI.WebControls.Unit.Parse(_ControlColumnWidth);
                        cboRegion.Width    = System.Web.UI.WebControls.Unit.Parse(_ControlColumnWidth);
                        txtRegion.Width    = System.Web.UI.WebControls.Unit.Parse(_ControlColumnWidth);
                        txtCity.Width      = System.Web.UI.WebControls.Unit.Parse(_ControlColumnWidth);
                        txtStreet.Width    = System.Web.UI.WebControls.Unit.Parse(_ControlColumnWidth);
                        txtUnit.Width      = System.Web.UI.WebControls.Unit.Parse(_ControlColumnWidth);
                        txtPostal.Width    = System.Web.UI.WebControls.Unit.Parse(_ControlColumnWidth);
                        txtTelephone.Width = System.Web.UI.WebControls.Unit.Parse(_ControlColumnWidth);
                        txtCell.Width      = System.Web.UI.WebControls.Unit.Parse(_ControlColumnWidth);
                        txtFax.Width       = System.Web.UI.WebControls.Unit.Parse(_ControlColumnWidth);
                    }

                    txtStreet.TabIndex    = Convert.ToInt16(_StartTabIndex);
                    txtUnit.TabIndex      = Convert.ToInt16(_StartTabIndex + 1);
                    txtCity.TabIndex      = Convert.ToInt16(_StartTabIndex + 2);
                    cboCountry.TabIndex   = Convert.ToInt16(_StartTabIndex + 3);
                    cboRegion.TabIndex    = Convert.ToInt16(_StartTabIndex + 4);
                    txtRegion.TabIndex    = Convert.ToInt16(_StartTabIndex + 5);
                    txtPostal.TabIndex    = Convert.ToInt16(_StartTabIndex + 6);
                    txtTelephone.TabIndex = Convert.ToInt16(_StartTabIndex + 7);
                    txtCell.TabIndex      = Convert.ToInt16(_StartTabIndex + 8);
                    txtFax.TabIndex       = Convert.ToInt16(_StartTabIndex + 9);

                    // <tam:note modified to test Lists
                    //Dim objRegionalController As New RegionalController
                    //cboCountry.DataSource = objRegionalController.GetCountries
                    // <this test using method 2: get empty collection then get each entry list on demand & store into cache

                    ListController          ctlEntry        = new ListController();
                    ListEntryInfoCollection entryCollection = ctlEntry.GetListEntryInfoCollection("Country");

                    cboCountry.DataSource = entryCollection;
                    cboCountry.DataBind();
                    cboCountry.Items.Insert(0, new ListItem("<" + Localization.GetString("Not_Specified", Localization.SharedResourceFile) + ">", ""));

                    switch (_CountryData.ToLower())
                    {
                    case "text":

                        if (_Country == "")
                        {
                            cboCountry.SelectedIndex = 0;
                        }
                        else
                        {
                            if (cboCountry.Items.FindByText(_Country) != null)
                            {
                                cboCountry.ClearSelection();
                                cboCountry.Items.FindByText(_Country).Selected = true;
                            }
                        }
                        break;

                    case "value":

                        if (cboCountry.Items.FindByValue(_Country) != null)
                        {
                            cboCountry.ClearSelection();
                            cboCountry.Items.FindByValue(_Country).Selected = true;
                        }
                        break;
                    }

                    Localize();

                    if (cboRegion.Visible)
                    {
                        switch (_RegionData.ToLower())
                        {
                        case "text":

                            if (_Region == "")
                            {
                                cboRegion.SelectedIndex = 0;
                            }
                            else
                            {
                                if (cboRegion.Items.FindByText(_Region) != null)
                                {
                                    cboRegion.Items.FindByText(_Region).Selected = true;
                                }
                            }
                            break;

                        case "value":

                            if (cboRegion.Items.FindByValue(_Region) != null)
                            {
                                cboRegion.Items.FindByValue(_Region).Selected = true;
                            }
                            break;
                        }
                    }
                    else
                    {
                        txtRegion.Text = _Region;
                    }

                    txtStreet.Text    = _Street;
                    txtUnit.Text      = _Unit;
                    txtCity.Text      = _City;
                    txtPostal.Text    = _Postal;
                    txtTelephone.Text = _Telephone;
                    txtCell.Text      = _Cell;
                    txtFax.Text       = _Fax;

                    rowStreet.Visible    = _ShowStreet;
                    rowUnit.Visible      = _ShowUnit;
                    rowCity.Visible      = _ShowCity;
                    rowCountry.Visible   = _ShowCountry;
                    rowRegion.Visible    = _ShowRegion;
                    rowPostal.Visible    = _ShowPostal;
                    rowTelephone.Visible = _ShowTelephone;
                    rowCell.Visible      = _ShowCell;
                    rowFax.Visible       = _ShowFax;

                    if (PortalSecurity.IsInRoles(PortalSettings.AdministratorRoleName))
                    {
                        chkStreet.Visible    = true;
                        chkCity.Visible      = true;
                        chkCountry.Visible   = true;
                        chkRegion.Visible    = true;
                        chkPostal.Visible    = true;
                        chkTelephone.Visible = true;
                        chkCell.Visible      = true;
                        chkFax.Visible       = true;
                    }

                    ViewState["ModuleId"]           = Convert.ToString(_ModuleId);
                    ViewState["LabelColumnWidth"]   = _LabelColumnWidth;
                    ViewState["ControlColumnWidth"] = _ControlColumnWidth;

                    ShowRequiredFields();
                }
            }
            catch (Exception exc) //Module failed to load
            {
                Exceptions.ProcessModuleLoadException(this, exc);
            }
        }
Ejemplo n.º 12
0
        /// <summary>
        /// BindData fetches the data from the database and updates the controls
        /// </summary>
        /// <history>
        ///     [cnurse]	9/27/2004	Updated to reflect design changes for Help, 508 support
        ///                       and localisation
        /// </history>
        private void BindData()
        {
            lblVersion.Text = Globals.glbAppVersion;
            switch (Convert.ToString(Globals.HostSettings["CheckUpgrade"]))
            {
            case "":
                chkUpgrade.Checked = true;
                break;

            case "Y":

                chkUpgrade.Checked = true;
                break;

            case "N":

                chkUpgrade.Checked = false;
                break;
            }
            if (chkUpgrade.Checked)
            {
                hypUpgrade.ImageUrl    = string.Format("{0}/update.aspx?version={1}", Globals.glbUpgradeUrl, lblVersion.Text.Replace(".", ""));
                hypUpgrade.NavigateUrl = string.Format("{0}/redirect.aspx?version={1}", Globals.glbUpgradeUrl, lblVersion.Text.Replace(".", ""));
            }
            else
            {
                hypUpgrade.Visible = false;
            }
            lblDataProvider.Text = ProviderConfiguration.GetProviderConfiguration("data").DefaultProvider;
            lblFramework.Text    = Environment.Version.ToString();
            lblIdentity.Text     = WindowsIdentity.GetCurrent().Name;
            lblHostName.Text     = Dns.GetHostName();

            PortalController objPortals = new PortalController();

            cboHostPortal.DataSource = objPortals.GetPortals();
            cboHostPortal.DataBind();
            if (Convert.ToString(Globals.HostSettings["HostPortalId"]) != "")
            {
                if (cboHostPortal.Items.FindByValue(Convert.ToString(Globals.HostSettings["HostPortalId"])) != null)
                {
                    cboHostPortal.Items.FindByValue(Convert.ToString(Globals.HostSettings["HostPortalId"])).Selected = true;
                }
            }
            txtHostTitle.Text = Convert.ToString(Globals.HostSettings["HostTitle"]);
            txtHostURL.Text   = Convert.ToString(Globals.HostSettings["HostURL"]);
            txtHostEmail.Text = Convert.ToString(Globals.HostSettings["HostEmail"]);

            //SkinController objSkins = new SkinController();
            SkinInfo objSkin;

            ctlHostSkin.Width    = "252px";
            ctlHostSkin.SkinRoot = SkinInfo.RootSkin;
            objSkin = SkinController.GetSkin(SkinInfo.RootSkin, Null.NullInteger, SkinType.Portal);
            if (objSkin != null)
            {
                if (Null.IsNull(objSkin.PortalId))
                {
                    ctlHostSkin.SkinSrc = objSkin.SkinSrc;
                }
            }
            ctlHostContainer.Width    = "252px";
            ctlHostContainer.SkinRoot = SkinInfo.RootContainer;
            objSkin = SkinController.GetSkin(SkinInfo.RootContainer, Null.NullInteger, SkinType.Portal);
            if (objSkin != null)
            {
                if (Null.IsNull(objSkin.PortalId))
                {
                    ctlHostContainer.SkinSrc = objSkin.SkinSrc;
                }
            }

            ctlAdminSkin.Width    = "252px";
            ctlAdminSkin.SkinRoot = SkinInfo.RootSkin;
            objSkin = SkinController.GetSkin(SkinInfo.RootSkin, Null.NullInteger, SkinType.Admin);
            if (objSkin != null)
            {
                if (Null.IsNull(objSkin.PortalId))
                {
                    ctlAdminSkin.SkinSrc = objSkin.SkinSrc;
                }
            }
            ctlAdminContainer.Width    = "252px";
            ctlAdminContainer.SkinRoot = SkinInfo.RootContainer;
            objSkin = SkinController.GetSkin(SkinInfo.RootContainer, Null.NullInteger, SkinType.Admin);
            if (objSkin != null)
            {
                if (Null.IsNull(objSkin.PortalId))
                {
                    ctlAdminContainer.SkinSrc = objSkin.SkinSrc;
                }
            }
            ModuleControlController objModuleControls = new ModuleControlController();
            ArrayList arrModuleControls = objModuleControls.GetModuleControls(Null.NullInteger);
            int       intModuleControl;

            for (intModuleControl = 0; intModuleControl <= arrModuleControls.Count - 1; intModuleControl++)
            {
                ModuleControlInfo objModuleControl = (ModuleControlInfo)arrModuleControls[intModuleControl];
                if (objModuleControl.ControlType == SecurityAccessLevel.ControlPanel)
                {
                    cboControlPanel.Items.Add(new ListItem(objModuleControl.ControlKey.Replace("CONTROLPANEL:", ""), objModuleControl.ControlSrc));
                }
            }
            if (Convert.ToString(Globals.HostSettings["ControlPanel"]) != "")
            {
                if (cboControlPanel.Items.FindByValue(Convert.ToString(Globals.HostSettings["ControlPanel"])) != null)
                {
                    cboControlPanel.Items.FindByValue(Convert.ToString(Globals.HostSettings["ControlPanel"])).Selected = true;
                }
            }
            else
            {
                if (cboControlPanel.Items.FindByValue(Globals.glbDefaultControlPanel) != null)
                {
                    cboControlPanel.Items.FindByValue(Globals.glbDefaultControlPanel).Selected = true;
                }
            }

            ListController          ctlList      = new ListController();
            ListEntryInfoCollection colProcessor = ctlList.GetListEntryInfoCollection("Processor", "");

            cboProcessor.DataSource = colProcessor;
            cboProcessor.DataBind();
            cboProcessor.Items.Insert(0, new ListItem("<" + Localization.GetString("None_Specified") + ">", ""));

            if (cboProcessor.Items.FindByText(Globals.HostSettings["PaymentProcessor"].ToString()) != null)
            {
                cboProcessor.Items.FindByText(Globals.HostSettings["PaymentProcessor"].ToString()).Selected = true;
            }
            txtUserId.Text = Convert.ToString(Globals.HostSettings["ProcessorUserId"]);
            txtPassword.Attributes.Add("value", Convert.ToString(Globals.HostSettings["ProcessorPassword"]));

            txtHostFee.Text = Convert.ToString(Globals.HostSettings["HostFee"]);

            ListEntryInfoCollection colCurrency = ctlList.GetListEntryInfoCollection("Currency", "");

            cboHostCurrency.DataSource = colCurrency;
            cboHostCurrency.DataBind();
            if (cboHostCurrency.Items.FindByValue(Convert.ToString(Globals.HostSettings["HostCurrency"])) != null)
            {
                cboHostCurrency.Items.FindByValue(Globals.HostSettings["HostCurrency"].ToString()).Selected = true;
            }
            else
            {
                cboHostCurrency.Items.FindByValue("USD").Selected = true;
            }

            if (cboSchedulerMode.Items.FindByValue(Convert.ToString(Globals.HostSettings["SchedulerMode"])) != null)
            {
                cboSchedulerMode.Items.FindByValue(Globals.HostSettings["SchedulerMode"].ToString()).Selected = true;
            }
            else
            {
                cboSchedulerMode.Items.FindByValue("1").Selected = true;
            }

            txtHostSpace.Text = Convert.ToString(Globals.HostSettings["HostSpace"]);
            txtPageQuota.Text = Convert.ToString(Globals.HostSettings["PageQuota"]);
            txtUserQuota.Text = Convert.ToString(Globals.HostSettings["UserQuota"]);

            if (Convert.ToString(Globals.HostSettings["SiteLogStorage"]) == "")
            {
                optSiteLogStorage.Items.FindByValue("D").Selected = true;
            }
            else
            {
                optSiteLogStorage.Items.FindByValue(Convert.ToString(Globals.HostSettings["SiteLogStorage"])).Selected = true;
            }
            if (Convert.ToString(Globals.HostSettings["SiteLogBuffer"]) == "")
            {
                txtSiteLogBuffer.Text = "1";
            }
            else
            {
                txtSiteLogBuffer.Text = Convert.ToString(Globals.HostSettings["SiteLogBuffer"]);
            }
            txtSiteLogHistory.Text = Convert.ToString(Globals.HostSettings["SiteLogHistory"]);

            if (Convert.ToString(Globals.HostSettings["PageStatePersister"]) == "")
            {
                cboPageState.Items.FindByValue("P").Selected = true;
            }
            else
            {
                cboPageState.Items.FindByValue(Convert.ToString(Globals.HostSettings["PageStatePersister"])).Selected = true;
            }

            if (Convert.ToString(Globals.HostSettings["ModuleCaching"]) == "")
            {
                cboCacheMethod.Items.FindByValue("M").Selected = true;
            }
            else
            {
                cboCacheMethod.Items.FindByValue(Convert.ToString(Globals.HostSettings["ModuleCaching"])).Selected = true;
            }

            if (cboPerformance.Items.FindByValue(Convert.ToString(Globals.HostSettings["PerformanceSetting"])) != null)
            {
                cboPerformance.Items.FindByValue(Globals.HostSettings["PerformanceSetting"].ToString()).Selected = true;
            }
            else
            {
                cboPerformance.Items.FindByValue("3").Selected = true;
            }
            if (cboCacheability.Items.FindByValue(Convert.ToString(Globals.HostSettings["AuthenticatedCacheability"])) != null)
            {
                cboCacheability.Items.FindByValue(Globals.HostSettings["AuthenticatedCacheability"].ToString()).Selected = true;
            }
            else
            {
                cboCacheability.Items.FindByValue("4").Selected = true;
            }
            if (cboCompression.Items.FindByValue(Convert.ToString(Globals.HostSettings["HttpCompression"])) != null)
            {
                cboCompression.Items.FindByValue(Globals.HostSettings["HttpCompression"].ToString()).Selected = true;
            }
            else
            {
                cboCompression.Items.FindByValue("0").Selected = true;
            }
            if (cboLevel.Items.FindByValue(Convert.ToString(Globals.HostSettings["HttpCompressionLevel"])) != null)
            {
                cboLevel.Items.FindByValue(Globals.HostSettings["HttpCompressionLevel"].ToString()).Selected = true;
            }
            else
            {
                cboLevel.Items.FindByValue("0").Selected = true;
            }
            if (Convert.ToString(Globals.HostSettings["WhitespaceFilter"]) == "Y")
            {
                chkWhitespace.Checked = true;
            }
            else
            {
                chkWhitespace.Checked = false;
            }



            string filePath = Globals.ApplicationMapPath + "\\Compression.config";

            if (File.Exists(filePath))
            {
                FileStream    fileReader = new FileStream(filePath, FileMode.Open, FileAccess.Read, FileShare.Read);
                XPathDocument doc        = new XPathDocument(fileReader);
                foreach (XPathNavigator nav in doc.CreateNavigator().Select("compression/excludedMimeTypes/mimeType"))
                {
                    txtExcludedMimeTypes.Text += nav.Value.ToLower() + Environment.NewLine;
                }
                foreach (XPathNavigator nav in doc.CreateNavigator().Select("compression/excludedPaths/path"))
                {
                    txtExcludedPaths.Text += nav.Value.ToLower() + Environment.NewLine;
                }
                txtWhitespaceFilter.Text = doc.CreateNavigator().SelectSingleNode("compression/whitespace").Value;
            }



            txtDemoPeriod.Text = Convert.ToString(Globals.HostSettings["DemoPeriod"]);
            if (Convert.ToString(Globals.HostSettings["DemoSignup"]) == "Y")
            {
                chkDemoSignup.Checked = true;
            }
            else
            {
                chkDemoSignup.Checked = false;
            }
            if (Globals.GetHashValue(Globals.HostSettings["Copyright"], "Y") == "Y")
            {
                chkCopyright.Checked = true;
            }
            else
            {
                chkCopyright.Checked = false;
            }
            if (Globals.HostSettings.ContainsKey("DisableUsersOnline"))
            {
                if (Globals.HostSettings["DisableUsersOnline"].ToString() == "Y")
                {
                    chkUsersOnline.Checked = true;
                }
                else
                {
                    chkUsersOnline.Checked = false;
                }
            }
            else
            {
                chkUsersOnline.Checked = false;
            }
            txtUsersOnlineTime.Text   = Convert.ToString(Globals.HostSettings["UsersOnlineTime"]);
            txtAutoAccountUnlock.Text = Convert.ToString(Globals.HostSettings["AutoAccountUnlockDuration"]);
            txtProxyServer.Text       = Convert.ToString(Globals.HostSettings["ProxyServer"]);
            txtProxyPort.Text         = Convert.ToString(Globals.HostSettings["ProxyPort"]);
            txtProxyUsername.Text     = Convert.ToString(Globals.HostSettings["ProxyUsername"]);
            txtProxyPassword.Attributes.Add("value", Convert.ToString(Globals.HostSettings["ProxyPassword"]));
            txtSMTPServer.Text = Convert.ToString(Globals.HostSettings["SMTPServer"]);
            if (Convert.ToString(Globals.HostSettings["SMTPAuthentication"]) != "")
            {
                optSMTPAuthentication.Items.FindByValue(Globals.HostSettings["SMTPAuthentication"].ToString()).Selected = true;
            }
            else
            {
                optSMTPAuthentication.Items.FindByValue("0").Selected = true;
            }

            if (Convert.ToString(Globals.HostSettings["SMTPEnableSSL"]) == "Y")
            {
                chkSMTPEnableSSL.Checked = true;
            }
            else
            {
                chkSMTPEnableSSL.Checked = false;
            }

            txtSMTPUsername.Text = Convert.ToString(Globals.HostSettings["SMTPUsername"]);
            txtSMTPPassword.Attributes.Add("value", Convert.ToString(Globals.HostSettings["SMTPPassword"]));
            txtFileExtensions.Text = Convert.ToString(Globals.HostSettings["FileExtensions"]);

            if (Globals.HostSettings.ContainsKey("UseCustomErrorMessages"))
            {
                if (Globals.HostSettings["UseCustomErrorMessages"].ToString() == "Y")
                {
                    chkUseCustomErrorMessages.Checked = true;
                }
                else
                {
                    chkUseCustomErrorMessages.Checked = false;
                }
            }
            else
            {
                chkUseCustomErrorMessages.Checked = false;
            }

            if (Globals.HostSettings.ContainsKey("UseFriendlyUrls"))
            {
                if (Globals.HostSettings["UseFriendlyUrls"].ToString() == "Y")
                {
                    chkUseFriendlyUrls.Checked = true;
                }
                else
                {
                    chkUseFriendlyUrls.Checked = false;
                }
            }
            else
            {
                chkUseFriendlyUrls.Checked = false;
            }
            rowFriendlyUrls.Visible = chkUseFriendlyUrls.Checked;

            if (Globals.HostSettings.ContainsKey("EventLogBuffer"))
            {
                if (Globals.HostSettings["EventLogBuffer"].ToString() == "Y")
                {
                    chkLogBuffer.Checked = true;
                }
                else
                {
                    chkLogBuffer.Checked = false;
                }
            }
            else
            {
                chkLogBuffer.Checked = false;
            }

            if (Convert.ToString(Globals.HostSettings["SkinUpload"]) != "")
            {
                optSkinUpload.Items.FindByValue(Globals.HostSettings["SkinUpload"].ToString()).Selected = true;
            }
            else
            {
                optSkinUpload.Items.FindByValue("G").Selected = true;
            }

            txtHelpURL.Text = Convert.ToString(Globals.HostSettings["HelpURL"]);
            if (Globals.HostSettings.ContainsKey("EnableModuleOnLineHelp"))
            {
                if (Globals.HostSettings["EnableModuleOnLineHelp"].ToString() == "Y")
                {
                    chkEnableHelp.Checked = true;
                }
                else
                {
                    chkEnableHelp.Checked = false;
                }
            }
            else
            {
                chkEnableHelp.Checked = true;
            }

            if (Globals.HostSettings.ContainsKey("EnableFileAutoSync"))
            {
                if (Globals.HostSettings["EnableFileAutoSync"].ToString() == "Y")
                {
                    chkAutoSync.Checked = true;
                }
                else
                {
                    chkAutoSync.Checked = false;
                }
            }
            else
            {
                chkAutoSync.Checked = false;
            }


            ViewState["SelectedSchedulerMode"]      = cboSchedulerMode.SelectedItem.Value;
            ViewState["SelectedLogBufferEnabled"]   = chkLogBuffer.Checked;
            ViewState["SelectedUsersOnlineEnabled"] = chkUsersOnline.Checked;

            // Get the name of the data provider
            ProviderConfiguration objProviderConfiguration = ProviderConfiguration.GetProviderConfiguration("data");

            // get list of script files
            string    strProviderPath = PortalSettings.GetProviderPath();
            ArrayList arrScriptFiles  = new ArrayList();

            string[] arrFiles = Directory.GetFiles(strProviderPath, "*." + objProviderConfiguration.DefaultProvider);
            foreach (string strFile in arrFiles)
            {
                arrScriptFiles.Add(Path.GetFileNameWithoutExtension(strFile));
            }
            arrScriptFiles.Sort();

            cboUpgrade.DataSource = arrScriptFiles;
            cboUpgrade.DataBind();

            ModuleInfo FileManagerModule = (new ModuleController()).GetModuleByDefinition(Null.NullInteger, "File Manager");

            string[] additionalParameters = new string[3];

            additionalParameters[0]   = "mid=" + FileManagerModule.ModuleID;
            additionalParameters[1]   = "ftype=" + UploadType.Skin;
            additionalParameters[2]   = "rtab=" + this.TabId;
            lnkUploadSkin.NavigateUrl = Globals.NavigateURL(FileManagerModule.TabID, "Edit", additionalParameters);

            additionalParameters[1]        = "ftype=" + UploadType.Container;
            lnkUploadContainer.NavigateUrl = Globals.NavigateURL(FileManagerModule.TabID, "Edit", additionalParameters);
        }
Ejemplo n.º 13
0
        /// <summary>
        /// Page_Load runs when the control is loaded
        /// </summary>
        /// <history>
        ///     [cnurse]	9/8/2004	Updated to reflect design changes for Help, 508 support
        ///                       and localisation
        /// </history>
        protected void Page_Load(Object sender, EventArgs e)
        {
            try
            {
                if ((Request.QueryString["pid"] != null) && (PortalSettings.ActiveTab.ParentId == PortalSettings.SuperTabId || UserInfo.IsSuperUser))
                {
                    intPortalId              = int.Parse(Request.QueryString["pid"]);
                    ctlLogo.ShowUpLoad       = false;
                    ctlBackground.ShowUpLoad = false;
                }
                else
                {
                    intPortalId              = PortalId;
                    ctlLogo.ShowUpLoad       = true;
                    ctlBackground.ShowUpLoad = true;
                }

                //this needs to execute always to the client script code is registred in InvokePopupCal
                cmdExpiryCalendar.NavigateUrl = Calendar.InvokePopupCal(txtExpiryDate);
                ClientAPI.AddButtonConfirm(cmdRestore, Localization.GetString("RestoreCCSMessage", LocalResourceFile));

                // If this is the first visit to the page, populate the site data
                if (Page.IsPostBack == false)
                {
                    ClientAPI.AddButtonConfirm(cmdDelete, Localization.GetString("DeleteMessage", LocalResourceFile));

                    PortalController        objPortalController = new PortalController();
                    ListController          ctlList             = new ListController();
                    ListEntryInfoCollection colProcessor        = ctlList.GetListEntryInfoCollection("Processor");

                    cboProcessor.DataSource = colProcessor;
                    cboProcessor.DataBind();
                    cboProcessor.Items.Insert(0, new ListItem("<" + Localization.GetString("None_Specified") + ">", ""));

                    PortalInfo objPortal = objPortalController.GetPortal(intPortalId);

                    txtPortalName.Text                 = objPortal.PortalName;
                    ctlLogo.Url                        = objPortal.LogoFile;
                    ctlLogo.FileFilter                 = Globals.glbImageFileTypes;
                    txtDescription.Text                = objPortal.Description;
                    txtKeyWords.Text                   = objPortal.KeyWords;
                    ctlBackground.Url                  = objPortal.BackgroundFile;
                    ctlBackground.FileFilter           = Globals.glbImageFileTypes;
                    txtFooterText.Text                 = objPortal.FooterText;
                    optUserRegistration.SelectedIndex  = objPortal.UserRegistration;
                    optBannerAdvertising.SelectedIndex = objPortal.BannerAdvertising;

                    cboSplashTabId.DataSource = Globals.GetPortalTabs(intPortalId, true, true, false, false, false);
                    cboSplashTabId.DataBind();
                    if (cboSplashTabId.Items.FindByValue(objPortal.SplashTabId.ToString()) != null)
                    {
                        cboSplashTabId.Items.FindByValue(objPortal.SplashTabId.ToString()).Selected = true;
                    }
                    cboHomeTabId.DataSource = Globals.GetPortalTabs(intPortalId, true, true, false, false, false);
                    cboHomeTabId.DataBind();
                    if (cboHomeTabId.Items.FindByValue(objPortal.HomeTabId.ToString()) != null)
                    {
                        cboHomeTabId.Items.FindByValue(objPortal.HomeTabId.ToString()).Selected = true;
                    }
                    cboLoginTabId.DataSource = Globals.GetPortalTabs(intPortalId, true, true, false, false, false);
                    cboLoginTabId.DataBind();
                    if (cboLoginTabId.Items.FindByValue(objPortal.LoginTabId.ToString()) != null)
                    {
                        cboLoginTabId.Items.FindByValue(objPortal.LoginTabId.ToString()).Selected = true;
                    }
                    cboUserTabId.DataSource = Globals.GetPortalTabs(intPortalId, true, true, false, false, false);
                    cboUserTabId.DataBind();
                    if (cboUserTabId.Items.FindByValue(objPortal.UserTabId.ToString()) != null)
                    {
                        cboUserTabId.Items.FindByValue(objPortal.UserTabId.ToString()).Selected = true;
                    }

                    ListEntryInfoCollection colList = ctlList.GetListEntryInfoCollection("Currency");

                    cboCurrency.DataSource = colList;
                    cboCurrency.DataBind();
                    if (Null.IsNull(objPortal.Currency) || cboCurrency.Items.FindByValue(objPortal.Currency) == null)
                    {
                        cboCurrency.Items.FindByValue("USD").Selected = true;
                    }
                    else
                    {
                        cboCurrency.Items.FindByValue(objPortal.Currency).Selected = true;
                    }
                    RoleController objRoleController = new RoleController();

                    ArrayList Arr = objRoleController.GetUserRolesByRoleName(intPortalId, objPortal.AdministratorRoleName);
                    int       i;
                    for (i = 0; i <= Arr.Count - 1; i++)
                    {
                        UserRoleInfo objUser = (UserRoleInfo)Arr[i];
                        cboAdministratorId.Items.Add(new ListItem(objUser.FullName, objUser.UserID.ToString()));
                    }
                    if (cboAdministratorId.Items.FindByValue(objPortal.AdministratorId.ToString()) != null)
                    {
                        cboAdministratorId.Items.FindByValue(objPortal.AdministratorId.ToString()).Selected = true;
                    }

                    if (!Null.IsNull(objPortal.ExpiryDate))
                    {
                        txtExpiryDate.Text = objPortal.ExpiryDate.ToShortDateString();
                    }
                    txtHostFee.Text   = objPortal.HostFee.ToString();
                    txtHostSpace.Text = objPortal.HostSpace.ToString();
                    txtPageQuota.Text = objPortal.PageQuota.ToString();
                    txtUserQuota.Text = objPortal.UserQuota.ToString();
                    if (objPortal.SiteLogHistory != 0)
                    {
                        txtSiteLogHistory.Text = objPortal.SiteLogHistory.ToString();
                    }

                    DesktopModuleController objDesktopModules = new DesktopModuleController();
                    ArrayList arrDesktopModules = objDesktopModules.GetDesktopModules();

                    ArrayList arrPremiumModules = new ArrayList();
                    foreach (DesktopModuleInfo objDesktopModule in arrDesktopModules)
                    {
                        if (objDesktopModule.IsPremium)
                        {
                            arrPremiumModules.Add(objDesktopModule);
                        }
                    }

                    ArrayList arrPortalDesktopModules = objDesktopModules.GetPortalDesktopModules(intPortalId, Null.NullInteger);
                    foreach (PortalDesktopModuleInfo objPortalDesktopModule in arrPortalDesktopModules)
                    {
                        foreach (DesktopModuleInfo objDesktopModule in arrPremiumModules)
                        {
                            if (objDesktopModule.DesktopModuleID == objPortalDesktopModule.DesktopModuleID)
                            {
                                arrPremiumModules.Remove(objDesktopModule);
                                break;
                            }
                        }
                    }

                    ctlDesktopModules.Available = arrPremiumModules;
                    ctlDesktopModules.Assigned  = arrPortalDesktopModules;

                    if (!String.IsNullOrEmpty(objPortal.PaymentProcessor))
                    {
                        if (cboProcessor.Items.FindByText(objPortal.PaymentProcessor) != null)
                        {
                            cboProcessor.Items.FindByText(objPortal.PaymentProcessor).Selected = true;
                        }
                        else // default
                        {
                            if (cboProcessor.Items.FindByText("PayPal") != null)
                            {
                                cboProcessor.Items.FindByText("PayPal").Selected = true;
                            }
                        }
                    }
                    else
                    {
                        cboProcessor.Items.FindByValue("").Selected = true;
                    }
                    txtUserId.Text = objPortal.ProcessorUserId;
                    txtPassword.Attributes.Add("value", objPortal.ProcessorPassword);
                    txtHomeDirectory.Text = objPortal.HomeDirectory;

                    //Populate the default language combobox
                    Localization.LoadCultureDropDownList(cboDefaultLanguage, CultureDropDownTypes.NativeName, objPortal.DefaultLanguage);

                    //Populate the timezone combobox (look up timezone translations based on currently set culture)
                    Localization.LoadTimeZoneDropDownList(cboTimeZone, ((PageBase)Page).PageCulture.Name, Convert.ToString(objPortal.TimeZoneOffset));

                    SkinInfo objSkin;

                    ctlPortalSkin.Width    = "275px";
                    ctlPortalSkin.SkinRoot = SkinInfo.RootSkin;
                    objSkin = SkinController.GetSkin(SkinInfo.RootSkin, PortalId, SkinType.Portal);
                    if (objSkin != null)
                    {
                        if (objSkin.PortalId == PortalId)
                        {
                            ctlPortalSkin.SkinSrc = objSkin.SkinSrc;
                        }
                    }
                    ctlPortalContainer.Width    = "275px";
                    ctlPortalContainer.SkinRoot = SkinInfo.RootContainer;
                    objSkin = SkinController.GetSkin(SkinInfo.RootContainer, PortalId, SkinType.Portal);
                    if (objSkin != null)
                    {
                        if (objSkin.PortalId == PortalId)
                        {
                            ctlPortalContainer.SkinSrc = objSkin.SkinSrc;
                        }
                    }

                    ctlAdminSkin.Width    = "275px";
                    ctlAdminSkin.SkinRoot = SkinInfo.RootSkin;
                    objSkin = SkinController.GetSkin(SkinInfo.RootSkin, PortalId, SkinType.Admin);
                    if (objSkin != null)
                    {
                        if (objSkin.PortalId == PortalId)
                        {
                            ctlAdminSkin.SkinSrc = objSkin.SkinSrc;
                        }
                    }
                    ctlAdminContainer.Width    = "275px";
                    ctlAdminContainer.SkinRoot = SkinInfo.RootContainer;
                    objSkin = SkinController.GetSkin(SkinInfo.RootContainer, PortalId, SkinType.Admin);
                    if (objSkin != null)
                    {
                        if (objSkin.PortalId == PortalId)
                        {
                            ctlAdminContainer.SkinSrc = objSkin.SkinSrc;
                        }
                    }

                    LoadStyleSheet();

                    if (Convert.ToString(PortalSettings.HostSettings["SkinUpload"]) == "G" && !UserInfo.IsSuperUser)
                    {
                        lnkUploadSkin.Visible      = false;
                        lnkUploadContainer.Visible = false;
                    }
                    else
                    {
                        ModuleInfo FileManagerModule = (new ModuleController()).GetModuleByDefinition(intPortalId, "File Manager");
                        string[]   parameters        = new string[3];
                        parameters[0]             = "mid=" + FileManagerModule.ModuleID;
                        parameters[1]             = "ftype=" + UploadType.Skin;
                        parameters[2]             = "rtab=" + TabId;
                        lnkUploadSkin.NavigateUrl = Globals.NavigateURL(FileManagerModule.TabID, "Edit", parameters);

                        parameters[1] = "ftype=" + UploadType.Container;
                        lnkUploadContainer.NavigateUrl = Globals.NavigateURL(FileManagerModule.TabID, "Edit", parameters);
                    }

                    if (Request.UrlReferrer != null)
                    {
                        if (Request.UrlReferrer.AbsoluteUri == Request.Url.AbsoluteUri)
                        {
                            ViewState["UrlReferrer"] = "";
                        }
                        else
                        {
                            ViewState["UrlReferrer"] = Convert.ToString(Request.UrlReferrer);
                        }
                    }
                    else
                    {
                        ViewState["UrlReferrer"] = "";
                    }
                }

                if (UserInfo.IsSuperUser)
                {
                    dshHost.Visible   = true;
                    tblHost.Visible   = true;
                    cmdDelete.Visible = true;
                    if (Convert.ToString(ViewState["UrlReferrer"]) == "")
                    {
                        cmdCancel.Visible = false;
                    }
                    else
                    {
                        cmdCancel.Visible = true;
                    }
                }
                else
                {
                    dshHost.Visible   = false;
                    tblHost.Visible   = false;
                    cmdDelete.Visible = false;
                    cmdCancel.Visible = false;
                }
            }
            catch (Exception exc)  //Module failed to load
            {
                Exceptions.ProcessModuleLoadException(this, exc);
            }
        }
Ejemplo n.º 14
0
        //public ContactAddressInfo ContactAddress
        //{
        //    get
        //    {
        //        if (_contactAddress != null)
        //            return _contactAddress;

        //        if (Request.Cookies["ContactAddress"] != null)
        //        {
        //            ContactAddressInfo contact = (ContactAddressInfo) VfpInterop.DeserializeFromBase64String(Request.Cookies["ContactAddress"].Value);
        //            if (contact != null && contact.Lastname != null)
        //               _contactAddress = contact;
        //        }
        //        return null;
        //    }
        //    set
        //    {
        //        _contactAddress = value;
        //        string strVal = VfpInterop.SerializeToBase64String(value);
        //        if (Response.Cookies["ContactAddress"] != null)
        //            Response.Cookies["ContactAddress"].Value = strVal;
        //        else
        //        {
        //            HttpCookie cookie = new HttpCookie("ContactAddress");
        //            cookie.Value = strVal;
        //            Response.Cookies.Add(cookie);
        //        }
        //    }
        //}
        #endregion

        #region Event Handlers
        protected void Page_Load(object sender, EventArgs e)
        {
            try
            {
                if (!IsConfigured)
                {
                    string message = Localization.GetString("Configure.Message", this.LocalResourceFile);
                    DotNetNuke.UI.Skins.Skin.AddModuleMessage(this, message, ModuleMessage.ModuleMessageType.YellowWarning);
                    pnlContactView.Visible = false;
                }
                else
                {
                    TemplateControl tp = LoadControl("controls/TemplateControl.ascx") as TemplateControl;
                    tp.Key    = "Contact";
                    _template = tp.GetTemplate((string)Settings["ProductTemplate"]);

                    if (!Page.IsPostBack)
                    {
                        ListController          ListController = new ListController();
                        ListEntryInfoCollection Countries      = ListController.GetListEntryInfoCollection("Country");


                        Hashtable storeSettings = Controller.GetStoreSettings(PortalId);

                        ddlCountry.DataSource     = Countries;
                        ddlCountry.DataTextField  = "Text";
                        ddlCountry.DataValueField = "Value";
                        ddlCountry.DataBind();

                        if (!String.IsNullOrEmpty((string)storeSettings["VendorCountry"]))
                        {
                            ddlCountry.SelectedValue = (string)storeSettings["VendorCountry"];
                        }

                        // Prefill data if logged in user
                        ContactAddressInfo contactAddress = null;
                        if (Request.Cookies["ContactAddress"] != null)
                        {
                            contactAddress = (ContactAddressInfo)VfpInterop.DeserializeFromBase64String(Request.Cookies["ContactAddress"].Value);
                        }

                        if (contactAddress == null)
                        {
                            if (Request.IsAuthenticated)
                            {
                                UserInfo usr = UserController.GetUserById(PortalId, UserId);
                                if (usr != null)
                                {
                                    txtContactCompany.Text    = (usr.Profile.GetPropertyValue("Company") ?? "");
                                    txtContactPrefix.Text     = (usr.Profile.GetPropertyValue("Prefix") ?? "");
                                    txtContactFirstname.Text  = (usr.FirstName ?? "");
                                    txtContactLastname.Text   = (usr.LastName ?? "");
                                    txtContactUnit.Text       = (usr.Profile.GetPropertyValue("Unit") ?? "");
                                    txtContactStreet.Text     = (usr.Profile.Street ?? "");
                                    txtContactRegion.Text     = (usr.Profile.GetPropertyValue("Region") ?? "");
                                    txtContactPostalcode.Text = (usr.Profile.PostalCode ?? "");
                                    txtContactCity.Text       = (usr.Profile.City ?? "");
                                    if (ddlCountry.Items.FindByText(usr.Profile.Country ?? "") != null)
                                    {
                                        ddlCountry.Items.FindByText(usr.Profile.Country ?? "").Selected = true;
                                    }
                                    txtContactTelephone.Text = (usr.Profile.Telephone ?? "");
                                    txtContactFax.Text       = (usr.Profile.Fax ?? "");
                                    txtContactEmail.Text     = (usr.Email ?? "");
                                }
                            }
                        }
                        else
                        {
                            txtContactCompany.Text    = contactAddress.Company;
                            txtContactPrefix.Text     = contactAddress.Prefix;
                            txtContactFirstname.Text  = contactAddress.Firstname;
                            txtContactLastname.Text   = contactAddress.Lastname;
                            txtContactUnit.Text       = contactAddress.Unit;
                            txtContactStreet.Text     = contactAddress.Street;
                            txtContactRegion.Text     = contactAddress.Region;
                            txtContactPostalcode.Text = contactAddress.PostalCode;
                            txtContactCity.Text       = contactAddress.City;
                            if (ddlCountry.Items.FindByText(contactAddress.Country) != null)
                            {
                                ddlCountry.Items.FindByText(contactAddress.Country).Selected = true;
                            }
                            txtContactTelephone.Text = contactAddress.Telephone;
                            txtContactFax.Text       = contactAddress.Fax;
                            txtContactEmail.Text     = contactAddress.Email;
                            txtContactCell.Text      = contactAddress.Cell;
                        }
                    }
                    string requiredText = Localization.GetString("Required.Validator", this.LocalResourceFile);
                    bool   required;

                    trCompany.Visible      = Convert.ToBoolean(Settings["ShowCompany"]);
                    lblContactCompany.Text = Localization.GetString("lblContactCompany.Text", this.LocalResourceFile) +
                                             (Convert.ToBoolean(Settings["MandCompany"]) ? " *" : "");
                    txtContactCompany.TextChanged += txt_TextChanged;
                    required = Convert.ToBoolean(Settings["MandCompany"]);
                    valContactCompany.Visible = required;
                    if (required)
                    {
                        valContactCompany.Text     = requiredText;
                        txtContactCompany.CssClass = "dnnFormRequired";
                    }

                    trPrefix.Visible      = Convert.ToBoolean(Settings["ShowPrefix"]);
                    lblContactPrefix.Text = Localization.GetString("lblContactPrefix.Text", this.LocalResourceFile) +
                                            (Convert.ToBoolean(Settings["MandPrefix"]) ? " *" : "");
                    txtContactPrefix.TextChanged += txt_TextChanged;
                    required = Convert.ToBoolean(Settings["MandPrefix"]);
                    valContactPrefix.Visible = required;
                    if (required)
                    {
                        valContactPrefix.Text     = requiredText;
                        txtContactPrefix.CssClass = "dnnFormRequired";
                    }

                    trFirstname.Visible      = Convert.ToBoolean(Settings["ShowFirstname"]);
                    lblContactFirstname.Text = Localization.GetString("lblContactFirstname.Text", this.LocalResourceFile) +
                                               (Convert.ToBoolean(Settings["MandFirstname"]) ? " *" : "");
                    txtContactFirstname.TextChanged += txt_TextChanged;
                    required = Convert.ToBoolean(Settings["MandFirstname"]);
                    valContactFirstname.Visible = required;
                    if (required)
                    {
                        valContactFirstname.Text     = requiredText;
                        txtContactFirstname.CssClass = "dnnFormRequired";
                    }

                    trLastname.Visible      = Convert.ToBoolean(Settings["ShowLastname"]);
                    lblContactLastname.Text = Localization.GetString("lblContactLastname.Text", this.LocalResourceFile) +
                                              (Convert.ToBoolean(Settings["MandLastname"]) ? " *" : "");
                    txtContactLastname.TextChanged += txt_TextChanged;
                    required = Convert.ToBoolean(Settings["MandLastname"]);
                    valContactLastname.Visible = required;
                    if (required)
                    {
                        valContactLastname.Text     = requiredText;
                        txtContactLastname.CssClass = "dnnFormRequired";
                    }

                    trStreet.Visible      = Convert.ToBoolean(Settings["ShowStreet"]);
                    lblContactStreet.Text = Localization.GetString("lblContactStreet.Text", this.LocalResourceFile) +
                                            (Convert.ToBoolean(Settings["MandStreet"]) ? " *" : "");
                    txtContactStreet.TextChanged += txt_TextChanged;
                    required = Convert.ToBoolean(Settings["MandStreet"]);
                    valContactStreet.Visible = required;
                    if (required)
                    {
                        valContactStreet.Text     = requiredText;
                        txtContactStreet.CssClass = "dnnFormRequired";
                    }

                    trRegion.Visible      = Convert.ToBoolean(Settings["ShowRegion"]);
                    lblContactRegion.Text = Localization.GetString("lblContactRegion.Text", this.LocalResourceFile) +
                                            (Convert.ToBoolean(Settings["MandRegion"]) ? " *" : "");
                    txtContactRegion.TextChanged += txt_TextChanged;
                    required = Convert.ToBoolean(Settings["MandRegion"]);
                    valContactRegion.Visible = required;
                    if (required)
                    {
                        valContactRegion.Text     = requiredText;
                        txtContactRegion.CssClass = "dnnFormRequired";
                    }

                    trCity.Visible            = Convert.ToBoolean(Settings["ShowCity"]);
                    lblContactPostalcode.Text = Localization.GetString("lblContactPostalcode.Text", this.LocalResourceFile) +
                                                (Convert.ToBoolean(Settings["MandCity"]) ? " *" : "");
                    txtContactCity.TextChanged += txt_TextChanged;
                    required = Convert.ToBoolean(Settings["MandCity"]);
                    valContactCity.Visible = required;
                    if (required)
                    {
                        valContactCity.Text     = requiredText;
                        txtContactCity.CssClass = "dnnFormRequired";
                    }

                    trCountry.Visible      = Convert.ToBoolean(Settings["ShowCountry"]);
                    lblContactCountry.Text = Localization.GetString("lblContactCountry.Text", this.LocalResourceFile) +
                                             (Convert.ToBoolean(Settings["MandCountry"]) ? " *" : "");
                    ddlCountry.TextChanged += txt_TextChanged;
                    required = Convert.ToBoolean(Settings["MandCountry"]);
                    valContactCountry.Visible = required;
                    if (required)
                    {
                        valContactCountry.Text = requiredText;
                        ddlCountry.CssClass    = "dnnFormRequired";
                    }

                    trPhone.Visible          = Convert.ToBoolean(Settings["ShowPhone"]);
                    lblContactTelephone.Text = Localization.GetString("lblContactTelephone.Text", this.LocalResourceFile) +
                                               (Convert.ToBoolean(Settings["MandPhone"]) ? " *" : "");
                    txtContactTelephone.TextChanged += txt_TextChanged;
                    required = Convert.ToBoolean(Settings["MandPhone"]);
                    valContactTelephone.Visible = required;
                    if (required)
                    {
                        valContactTelephone.Text     = requiredText;
                        txtContactTelephone.CssClass = "dnnFormRequired";
                    }

                    trCell.Visible      = Convert.ToBoolean(Settings["ShowCell"]);
                    lblContactCell.Text = Localization.GetString("lblContactCell.Text", this.LocalResourceFile) +
                                          (Convert.ToBoolean(Settings["MandCell"]) ? " *" : "");
                    txtContactCell.TextChanged += txt_TextChanged;
                    required = Convert.ToBoolean(Settings["MandCell"]);
                    valContactCell.Visible = required;
                    if (required)
                    {
                        valContactCell.Text     = requiredText;
                        txtContactCell.CssClass = "dnnFormRequired";
                    }

                    trFax.Visible      = Convert.ToBoolean(Settings["ShowFax"]);
                    lblContactFax.Text = Localization.GetString("lblContactFax.Text", this.LocalResourceFile) +
                                         (Convert.ToBoolean(Settings["MandFax"]) ? " *" : "");
                    txtContactFax.TextChanged += txt_TextChanged;
                    required = Convert.ToBoolean(Settings["MandFax"]);
                    valContactFax.Visible = required;
                    if (required)
                    {
                        valContactFax.Text     = requiredText;
                        txtContactFax.CssClass = "dnnFormRequired";
                    }

                    trEmail.Visible      = Convert.ToBoolean(Settings["ShowEmail"]);
                    lblContactEmail.Text = Localization.GetString("lblContactEmail.Text", this.LocalResourceFile) +
                                           (Convert.ToBoolean(Settings["MandEmail"]) ? " *" : "");
                    txtContactEmail.TextChanged += txt_TextChanged;
                    required = Convert.ToBoolean(Settings["MandEmail"]);
                    valContactEmail.Visible = required;
                    if (required)
                    {
                        valContactEmail.Text     = requiredText;
                        txtContactEmail.CssClass = "dnnFormRequired";
                    }


                    Products = Controller.GetContactProductsByCartId(PortalId, CartId, CurrentLanguage);
                    if (Products.Count > 0)
                    {
                        lstProducts.DataSource = Products;
                        lstProducts.DataBind();
                    }
                    else
                    {
                        lstProducts.Visible = false;
                    }
                }
            }
            catch (Exception exc)
            {
                Exceptions.ProcessModuleLoadException(this, exc);
            }
        }
Ejemplo n.º 15
0
        /// <summary>
        /// Page_Load runs when the control is loaded
        /// </summary>
        /// <remarks>
        /// </remarks>
        /// <history>
        ///     [cnurse]	9/10/2004	Updated to reflect design changes for Help, 508 support
        ///                       and localisation
        /// </history>
        protected void Page_Load(Object sender, EventArgs e)
        {
            try
            {
                if ((Request.QueryString["RoleID"] != null))
                {
                    RoleID = int.Parse(Request.QueryString["RoleID"]);
                }

                if (Page.IsPostBack == false)
                {
                    ClientAPI.AddButtonConfirm(cmdDelete, Localization.GetString("DeleteItem"));

                    RoleController objUser = new RoleController();

                    ListController          ctlList        = new ListController();
                    ListEntryInfoCollection colFrequencies = ctlList.GetListEntryInfoCollection("Frequency", "");

                    cboBillingFrequency.DataSource = colFrequencies;
                    cboBillingFrequency.DataBind();
                    cboBillingFrequency.Items.FindByValue("N").Selected = true;

                    cboTrialFrequency.DataSource = colFrequencies;
                    cboTrialFrequency.DataBind();
                    cboTrialFrequency.Items.FindByValue("N").Selected = true;

                    BindGroups();

                    ctlIcon.FileFilter = Globals.glbImageFileTypes;

                    if (RoleID != -1)
                    {
                        lblRoleName.Visible = true;
                        txtRoleName.Visible = false;
                        valRoleName.Enabled = false;

                        RoleInfo objRoleInfo = objUser.GetRole(RoleID, PortalSettings.PortalId);

                        if (objRoleInfo != null)
                        {
                            lblRoleName.Text    = objRoleInfo.RoleName;
                            txtDescription.Text = objRoleInfo.Description;
                            if (cboRoleGroups.Items.FindByValue(objRoleInfo.RoleGroupID.ToString()) != null)
                            {
                                cboRoleGroups.ClearSelection();
                                cboRoleGroups.Items.FindByValue(objRoleInfo.RoleGroupID.ToString()).Selected = true;
                            }
                            if (string.Format("{0:#,##0.00}", objRoleInfo.ServiceFee) != "0.00")
                            {
                                txtServiceFee.Text    = string.Format("{0:#,##0.00}", objRoleInfo.ServiceFee);
                                txtBillingPeriod.Text = objRoleInfo.BillingPeriod.ToString();
                                if (cboBillingFrequency.Items.FindByValue(objRoleInfo.BillingFrequency) != null)
                                {
                                    cboBillingFrequency.ClearSelection();
                                    cboBillingFrequency.Items.FindByValue(objRoleInfo.BillingFrequency).Selected = true;
                                }
                            }
                            if (objRoleInfo.TrialFrequency != "N")
                            {
                                txtTrialFee.Text    = string.Format("{0:#,##0.00}", objRoleInfo.TrialFee);
                                txtTrialPeriod.Text = objRoleInfo.TrialPeriod.ToString();
                                if (cboTrialFrequency.Items.FindByValue(objRoleInfo.TrialFrequency) != null)
                                {
                                    cboTrialFrequency.ClearSelection();
                                    cboTrialFrequency.Items.FindByValue(objRoleInfo.TrialFrequency).Selected = true;
                                }
                            }
                            chkIsPublic.Checked       = objRoleInfo.IsPublic;
                            chkAutoAssignment.Checked = objRoleInfo.AutoAssignment;
                            txtRSVPCode.Text          = objRoleInfo.RSVPCode;
                            ctlIcon.Url = objRoleInfo.IconFile;
                        }
                        else // security violation attempt to access item not related to this Module
                        {
                            Response.Redirect(Globals.NavigateURL("Security Roles"));
                        }

                        if (RoleID == PortalSettings.AdministratorRoleId || RoleID == PortalSettings.RegisteredRoleId)
                        {
                            cmdDelete.Visible = false;
                            cmdUpdate.Visible = false;
                            ActivateControls(false);
                        }

                        if (RoleID == PortalSettings.RegisteredRoleId)
                        {
                            cmdManage.Visible = false;
                        }
                    }
                    else
                    {
                        cmdDelete.Visible   = false;
                        cmdManage.Visible   = false;
                        lblRoleName.Visible = false;
                        txtRoleName.Visible = true;
                    }
                }
            }
            catch (Exception exc)  //Module failed to load
            {
                Exceptions.ProcessModuleLoadException(this, exc);
            }
        }
Ejemplo n.º 16
0
        protected void Page_Load(object sender, EventArgs e)
        {
            cmdAdrEditCancel.CssClass = (string)Settings["ShoppingButtonCssClass"] ?? "";
            cmdAdrEditSave.CssClass   = (string)Settings["CheckoutButtonCssClass"] ?? "";

            // Is he logged in ?
            if (!Request.IsAuthenticated)
            {
                // Attention ! returnUrl must be relative path (cross-site-scripting denying)
                string returnUrl = HttpContext.Current.Request.RawUrl;
                returnUrl = HttpUtility.UrlEncode(returnUrl);

                Response.Redirect(Globals.NavigateURL(TabId, "", "action=login", "returnurl=" + returnUrl));
            }

            if (true)
            {
                lblIntro.Text = LocalizeString("Intro.Message");

                // Lets retrieve the CustomerAdressId and the CustomerAdress from Database
                hidAdrEditCustomerAddressId.Value = (Request.QueryString["adrid"] != null ? Request.QueryString["adrid"].ToString() : "-1");

                string  form = GenerateForm();
                Control ctrl = ParseControl(form);
                string  selectedCountryCode = "";

                ddlCountry = FindControlRecursive(ctrl, "ddlCountry") as DropDownList;
                if (ddlCountry != null)
                {
                    ListController          ListController = new ListController();
                    ListEntryInfoCollection Countries      = ListController.GetListEntryInfoCollection("Country");
                    ddlCountry.DataSource     = Countries;
                    ddlCountry.DataTextField  = "Text";
                    ddlCountry.DataValueField = "Value";
                    ddlCountry.DataBind();
                    if (!String.IsNullOrEmpty((string)StoreSettings["VendorCountry"]))
                    {
                        selectedCountryCode = (string)StoreSettings["VendorCountry"];
                    }
                }
                txtAdrEditCompany    = FindControlRecursive(ctrl, "txtAdrEditCompany") as TextBox;
                txtAdrEditPrefix     = FindControlRecursive(ctrl, "txtAdrEditPrefix") as TextBox;
                txtAdrEditFirstname  = FindControlRecursive(ctrl, "txtAdrEditFirstname") as TextBox;
                txtAdrEditMiddlename = FindControlRecursive(ctrl, "txtAdrEditMiddlename") as TextBox;
                txtAdrEditLastname   = FindControlRecursive(ctrl, "txtAdrEditLastname") as TextBox;
                txtAdrEditSuffix     = FindControlRecursive(ctrl, "txtAdrEditSuffix") as TextBox;
                txtAdrEditUnit       = FindControlRecursive(ctrl, "txtAdrEditUnit") as TextBox;
                txtAdrEditStreet     = FindControlRecursive(ctrl, "txtAdrEditStreet") as TextBox;
                txtAdrEditRegion     = FindControlRecursive(ctrl, "txtAdrEditRegion") as TextBox;
                txtAdrEditPostalCode = FindControlRecursive(ctrl, "txtAdrEditPostalCode") as TextBox;
                txtAdrEditCity       = FindControlRecursive(ctrl, "txtAdrEditCity") as TextBox;
                txtAdrEditSuburb     = FindControlRecursive(ctrl, "txtAdrEditSuburb") as TextBox;
                txtAdrEditPhone      = FindControlRecursive(ctrl, "txtAdrEditPhone") as TextBox;
                txtAdrEditFax        = FindControlRecursive(ctrl, "txtAdrEditFax") as TextBox;
                txtAdrEditCell       = FindControlRecursive(ctrl, "txtAdrEditCell") as TextBox;
                txtAdrEditEmail      = FindControlRecursive(ctrl, "txtAdrEditEmail") as TextBox;
                phAddressEdit.Controls.Add(ctrl);

                if (hidAdrEditCustomerAddressId.Value != "-1")
                {
                    int CustomerAddressId;
                    if (Int32.TryParse(hidAdrEditCustomerAddressId.Value, out CustomerAddressId))
                    {
                        CustomerAddressInfo CustomerAddress = Controller.GetCustomerAddress(CustomerAddressId);

                        if (CustomerAddress != null && CustomerAddress.CustomerId == this.MainControl.CustomerId)
                        {
                            if (txtAdrEditCompany != null)
                            {
                                txtAdrEditCompany.Text = CustomerAddress.Company.Trim();
                            }
                            if (txtAdrEditPrefix != null)
                            {
                                txtAdrEditPrefix.Text = CustomerAddress.Prefix.Trim();
                            }
                            if (txtAdrEditFirstname != null)
                            {
                                txtAdrEditFirstname.Text = CustomerAddress.Firstname.Trim();
                            }
                            if (txtAdrEditMiddlename != null)
                            {
                                txtAdrEditMiddlename.Text = CustomerAddress.Middlename.Trim();
                            }
                            if (txtAdrEditLastname != null)
                            {
                                txtAdrEditLastname.Text = CustomerAddress.Lastname.Trim();
                            }
                            if (txtAdrEditSuffix != null)
                            {
                                txtAdrEditSuffix.Text = CustomerAddress.Suffix.Trim();
                            }
                            if (txtAdrEditUnit != null)
                            {
                                txtAdrEditUnit.Text = CustomerAddress.Unit.Trim();
                            }
                            if (txtAdrEditStreet != null)
                            {
                                txtAdrEditStreet.Text = CustomerAddress.Street.Trim();
                            }
                            if (txtAdrEditRegion != null)
                            {
                                txtAdrEditRegion.Text = CustomerAddress.Region.Trim();
                            }
                            if (txtAdrEditPostalCode != null)
                            {
                                txtAdrEditPostalCode.Text = CustomerAddress.PostalCode.Trim();
                            }
                            if (txtAdrEditCity != null)
                            {
                                txtAdrEditCity.Text = CustomerAddress.City.Trim();
                            }
                            if (txtAdrEditSuburb != null)
                            {
                                txtAdrEditSuburb.Text = CustomerAddress.Suburb.Trim();
                            }
                            if (txtAdrEditPhone != null)
                            {
                                txtAdrEditPhone.Text = CustomerAddress.Telephone.Trim();
                            }
                            if (txtAdrEditFax != null)
                            {
                                txtAdrEditFax.Text = CustomerAddress.Fax.Trim();
                            }
                            if (txtAdrEditCell != null)
                            {
                                txtAdrEditCell.Text = CustomerAddress.Cell.Trim();
                            }
                            if (txtAdrEditEmail != null)
                            {
                                txtAdrEditEmail.Text = CustomerAddress.Email.Trim();
                            }
                            selectedCountryCode = CustomerAddress.CountryCode;
                        }
                        else
                        {
                            hidAdrEditCustomerAddressId.Value = "-1";
                        }
                    }
                    else
                    {
                        hidAdrEditCustomerAddressId.Value = "-1";
                    }
                }
                if (ddlCountry != null && selectedCountryCode != string.Empty)
                {
                    ListItem itemToSelect = ddlCountry.Items.FindByValue(selectedCountryCode.Trim());
                    if (itemToSelect != null)
                    {
                        ddlCountry.SelectedIndex = ddlCountry.Items.IndexOf(itemToSelect);
                    }
                }
            }
        }
Ejemplo n.º 17
0
        /// <summary>
        /// Page_Load runs when the control is loaded
        /// </summary>
        /// <remarks>
        /// </remarks>
        /// <history>
        ///     [cnurse]	9/15/2004	Updated to reflect design changes for Help, 508 support
        ///                       and localisation
        /// </history>
        protected void Page_Load(Object sender, EventArgs e)
        {
            try
            {
                //this needs to execute always to the client script code is registred in InvokePopupCal
                cmdStartCalendar.NavigateUrl = Calendar.InvokePopupCal(txtStartDate);
                cmdEndCalendar.NavigateUrl   = Calendar.InvokePopupCal(txtEndDate);

                // If this is the first visit to the page, bind the role data to the datalist
                if (Page.IsPostBack == false)
                {
                    string strSiteLogStorage = "D";
                    if (Convert.ToString(Globals.HostSettings["SiteLogStorage"]) != "")
                    {
                        strSiteLogStorage = Convert.ToString(Globals.HostSettings["SiteLogStorage"]);
                    }
                    if (strSiteLogStorage == "F")
                    {
                        UI.Skins.Skin.AddModuleMessage(this, Localization.GetString("LogDisabled", this.LocalResourceFile), ModuleMessageType.YellowWarning);
                        cmdDisplay.Visible = false;
                    }
                    else
                    {
                        switch (PortalSettings.SiteLogHistory)
                        {
                        case -1:      // unlimited

                            break;

                        case 0:

                            UI.Skins.Skin.AddModuleMessage(this, Localization.GetString("LogDisabled", this.LocalResourceFile), ModuleMessageType.YellowWarning);
                            break;

                        default:

                            UI.Skins.Skin.AddModuleMessage(this, string.Format(Localization.GetString("LogHistory", this.LocalResourceFile), PortalSettings.SiteLogHistory), ModuleMessageType.YellowWarning);
                            break;
                        }
                        cmdDisplay.Visible = true;
                    }

                    ListController          ctlList           = new ListController();
                    ListEntryInfoCollection colSiteLogReports = ctlList.GetListEntryInfoCollection("Site Log Reports");

                    cboReportType.DataSource = colSiteLogReports;
                    cboReportType.DataBind();
                    cboReportType.SelectedIndex = 0;

                    txtStartDate.Text = DateTime.Today.AddDays(-6).ToShortDateString();
                    txtEndDate.Text   = DateTime.Today.AddDays(1).ToShortDateString();

                    // Store URL Referrer to return to portal
                    if (Request.UrlReferrer != null)
                    {
                        if (Request.UrlReferrer.AbsoluteUri == Request.Url.AbsoluteUri)
                        {
                            ViewState["UrlReferrer"] = "";
                        }
                        else
                        {
                            ViewState["UrlReferrer"] = Convert.ToString(Request.UrlReferrer);
                        }
                    }
                    else
                    {
                        ViewState["UrlReferrer"] = "";
                    }
                }

                if (Convert.ToString(ViewState["UrlReferrer"]) == "")
                {
                    cmdCancel.Visible = false;
                }
                else
                {
                    cmdCancel.Visible = true;
                }
            }
            catch (Exception exc)  //Module failed to load
            {
                Exceptions.ProcessModuleLoadException(this, exc);
            }
        }