private void BindControls()
        {
            try
            {
                bool isPublic = false;
                GoogleAdsenseController  objController  = new GoogleAdsenseController();
                List <GoogleAdsenseInfo> adsenseSetting = objController.GetAdSenseSettingsByUserModuleID(userModuleID, GetPortalID);
                foreach (GoogleAdsenseInfo adsContent in adsenseSetting)
                {
                    switch (adsContent.SettingName)
                    {
                    case "AdsenseShow":
                        if (adsContent.SettingValue.Trim() != "")
                        {
                            chkShow.Checked = bool.Parse(adsContent.SettingValue);
                        }
                        break;

                    case "AdsenseUnitFormat":
                        if (adsContent.SettingValue.Trim() != "")
                        {
                            ddlUnitFormat.SelectedValue = adsContent.SettingValue;
                            chkActive.Checked           = (bool)adsContent.IsActive;
                        }
                        break;

                    case "AdsenseUnitType":
                        if (adsContent.SettingValue.Trim() != "")
                        {
                            ddlAddType.SelectedValue = adsContent.SettingValue;
                        }
                        break;

                    case "AdsenseChannelID":
                        if (adsContent.SettingValue.Trim() != "")
                        {
                            txtChannelID.Text = adsContent.SettingValue;
                        }
                        break;

                    case "AdsenseBorderColor":
                        if (adsContent.SettingValue.Trim() != "")
                        {
                            txtBorder.Text = adsContent.SettingValue;
                        }
                        break;

                    case "AdsenseBackColor":
                        if (adsContent.SettingValue.Trim() != "")
                        {
                            txtbackcolor.Text = adsContent.SettingValue;
                        }
                        break;

                    case "AdsenseLinkColor":
                        if (adsContent.SettingValue.Trim() != "")
                        {
                            txtLink.Text = adsContent.SettingValue;
                        }
                        break;

                    case "AdsenseTextColor":
                        if (adsContent.SettingValue.Trim() != "")
                        {
                            txtText.Text = adsContent.SettingValue;
                        }
                        break;

                    case "AdsenseURLColor":
                        if (adsContent.SettingValue.Trim() != "")
                        {
                            txtURL.Text = adsContent.SettingValue;
                        }
                        break;

                    case "AdsenseAnotherURL":
                        if (adsContent.SettingValue.Trim() != "")
                        {
                            if (isPublic == false)
                            {
                                txtanotherURL.Text = adsContent.SettingValue;
                                anotherURL.Visible = true;
                                solidFill.Visible  = false;
                            }
                        }
                        break;

                    case "AdsenseSolidFillColor":
                        if (adsContent.SettingValue.Trim() != "")
                        {
                            if (isPublic == false)
                            {
                                txtSolidFill.Text  = adsContent.SettingValue;
                                solidFill.Visible  = true;
                                anotherURL.Visible = false;
                            }
                        }
                        break;

                    case "AdsenseAlternateAds":
                        ddlAlternateAds.SelectedValue = adsContent.SettingValue;
                        if (adsContent.SettingValue == "-1")
                        {
                            solidFill.Visible  = false;
                            anotherURL.Visible = false;
                        }
                        if (adsContent.SettingValue == "0")
                        {
                            isPublic           = true;
                            solidFill.Visible  = false;
                            anotherURL.Visible = false;
                        }
                        break;
                    }
                }
            }
            catch (Exception ex)
            {
                ProcessException(ex);
            }
            imbDelete.Visible = true;
            //lblDelete.Visible = true;
        }
Exemple #2
0
        private void BindAdsControl()
        {
            try
            {
                AdsenseDisplay.Visible = true;
                GoogleAdsenseController  objController  = new GoogleAdsenseController();
                List <GoogleAdsenseInfo> adsenseSetting = objController.GetAdSenseSettingsByUserModuleID(Int32.Parse(hdnUserModuleID.Value), GetPortalID);
                foreach (GoogleAdsenseInfo adsContent in adsenseSetting)
                {
                    switch (adsContent.SettingName)
                    {
                    case "AdsenseUnitFormat":
                        AdsenseDisplay.AdUnitFormat = (AdUnitFormat)Enum.Parse(typeof(AdUnitFormat), adsContent.SettingValue, true);
                        break;

                    case "AdsenseUnitType":
                        AdsenseDisplay.AdUnitType = (AdUnitType)Enum.Parse(typeof(AdUnitType), adsContent.SettingValue, true);
                        break;

                    case "AdsenseChannelID":
                        AdsenseDisplay.ChannelId = adsContent.SettingValue;
                        break;

                    case "AdsenseBorderColor":
                        if (adsContent.SettingValue.Trim() != "")
                        {
                            AdsenseDisplay.BorderColor = System.Drawing.ColorTranslator.FromHtml("#" + adsContent.SettingValue.Trim());
                        }
                        break;

                    case "AdsenseBackColor":

                        if (adsContent.SettingValue.Trim() != "")
                        {
                            AdsenseDisplay.BackColor = System.Drawing.ColorTranslator.FromHtml("#" + adsContent.SettingValue.Trim());
                        }
                        break;

                    case "AdsenseLinkColor":
                        if (adsContent.SettingValue.Trim() != "")
                        {
                            AdsenseDisplay.LinkColor = System.Drawing.ColorTranslator.FromHtml("#" + adsContent.SettingValue.Trim());
                        }
                        break;

                    case "AdsenseTextColor":
                        if (adsContent.SettingValue.Trim() != "")
                        {
                            AdsenseDisplay.TextColor = System.Drawing.ColorTranslator.FromHtml("#" + adsContent.SettingValue.Trim());
                        }
                        break;

                    case "AdsenseURLColor":
                        if (adsContent.SettingValue.Trim() != "")
                        {
                            AdsenseDisplay.UrlColor = System.Drawing.ColorTranslator.FromHtml("#" + adsContent.SettingValue.Trim());
                        }
                        break;

                    case "AdsenseAnotherURL":
                        if (adsContent.SettingValue.Trim() != "")
                        {
                            AdsenseDisplay.AnotherUrl = adsContent.SettingValue.Trim();
                        }
                        break;

                    case "AdsenseSolidFillColor":
                        if (adsContent.SettingValue.Trim() != "")
                        {
                            AdsenseDisplay.SolidFillColor = System.Drawing.ColorTranslator.FromHtml("#" + adsContent.SettingValue.Trim());
                        }
                        break;

                    case "AdsenseAlternateAds":
                        if (adsContent.SettingValue.Trim() != "" && adsContent.SettingValue.Trim() != "-1")
                        {
                            AdsenseDisplay.AlternateAdType = (AlternateAdTypes)Enum.Parse(typeof(AlternateAdTypes), adsContent.SettingValue, true);
                        }
                        break;
                    }
                }
            }
            catch (Exception ex)
            {
                ProcessException(ex);
            }
        }