예제 #1
0
        protected void BindWeblogListContent(Control control, IDataItemContainer dataItemContainer)
        {

            WeblogData blogName = new WeblogData();
            blogName.Property = "Name";
            blogName.Tag = WrappedControlTag.B;
            blogName.LinkTo = WeblogLinkTo.HomePage;
            control.Controls.Add(blogName);

            control.Controls.Add(new LiteralControl("<br />"));

            WeblogData postCount = new WeblogData();
            postCount.Property = "PostCount";
            control.Controls.Add(postCount);

            LiteralControl postText = new LiteralControl(" Posts | ");
            control.Controls.Add(postText);

            WeblogData commentCount = new WeblogData();
            commentCount.Property = "CommentCount";
            control.Controls.Add(commentCount);

            LiteralControl commentText = new LiteralControl(" Comments");
            control.Controls.Add(commentText);

            control.Controls.Add(new LiteralControl("<br />"));
        }
예제 #2
0
 protected virtual void AddCustomCodeToHead()
 {
     // Adds code in ThonSettings.Instance.HtmlHeader to the head of the page
     string code = string.Format("{0}<!-- Start custom code -->{0}{1}{0}<!-- End custom code -->{0}", Environment.NewLine, ThonSettings.Instance.HtmlHeader);
     LiteralControl control = new LiteralControl(code);
     Page.Header.Controls.Add(control);
 }
예제 #3
0
        protected void Page_Init_InitialLoading(object sender, ActiveEventArgs e)
        {
            Page page = HttpContext.Current.Handler as Page;

            // Injecting a CSS link reference if additional CSS files are to be included
            string custFiles = Settings.Instance["CustomCssFiles"];
            if (!string.IsNullOrEmpty(custFiles))
            {
                string[] files = custFiles.Split(
                    new char[] { ',' }, 
                    StringSplitOptions.RemoveEmptyEntries);
                foreach (string file in files)
                {
                    string fileName = file.Trim();
                    LiteralControl lit = new LiteralControl();
                    lit.Text = string.Format(@"
<link 
    href=""{0}"" 
    rel=""stylesheet""
    type=""text/css"" />",
                             fileName);
                    page.Header.Controls.Add(lit);
                }
            }
        }
예제 #4
0
 public static void Show(System.Web.UI.Page p, object mess)
 {
     //HttpContext.Current.Response.Write("<script>alert('"+mess.ToString()+"')</script>");
     System.Web.UI.LiteralControl lt = new System.Web.UI.LiteralControl();
     lt.Text=  "<script language=\"javascript\" type=\"text/javascript\"> alert(\"" + mess.ToString() + "\")</script>";
     p.Header.Controls.Add(lt);
 }
예제 #5
0
        protected override void OnPreRender(EventArgs e)
        {
            base.OnPreRender(e);

            ContentPlaceHolder contentPlaceHolder = (ContentPlaceHolder)Page.Master.FindControl("PlaceHolderPageTitle");
            contentPlaceHolder.Controls.Clear();
            LiteralControl control = new LiteralControl();
            control.Text = Constants.HomeTitle;
            var currentUrl = HttpContext.Current.Request.Url.AbsolutePath;
            if (!currentUrl.Contains(".aspx") || currentUrl.Contains("default.aspx"))
            {
                control.Text = Constants.HomeTitle;
            }
            else
            {
                var catID = Convert.ToString(Request.QueryString["CatId"]);
                if (!string.IsNullOrEmpty(catID))
                {
                    control.Text += " - " + Utilities.GetValueByField(CurrentWeb, ListsName.InternalName.CategoryList,
                                   FieldsName.CategoryList.InternalName.CategoryID, catID, "Text", "Title");
                    if (Request.QueryString["ID"] != null && Request.QueryString["ID"] != string.Empty)
                    {
                        var itemId = Convert.ToString(Request.QueryString["ID"]);
                        control.Text += " - " + Utilities.GetValueByField(CurrentWeb, ListsName.InternalName.NewsList, "ID", itemId, "Counter", "Title");
                    }
                }

            }
            contentPlaceHolder.Controls.Add(control);
        }
예제 #6
0
파일: push.aspx.cs 프로젝트: qtstc/weassist
        protected void Page_Load(object sender, EventArgs e)
        {
            NameValueCollection nvc = Request.Form;

            LiteralControl lt = new LiteralControl();
            this.Controls.Add(lt);

            if (string.IsNullOrEmpty(nvc[AzureContract.PushNotificationPost.TITLE]) ||
                string.IsNullOrEmpty(nvc[AzureContract.PushNotificationPost.CONTENT]) ||
                string.IsNullOrEmpty(nvc[AzureContract.PushNotificationPost.SUBSCRIPTION_URI]) ||
                string.IsNullOrEmpty(nvc[AzureContract.PushNotificationPost.NAVIGATION_URI]))
            {
                lt.Text = "Error, one of the required post fields is empty.\n"+nvc[AzureContract.PushNotificationPost.TITLE]+"\n"+nvc[AzureContract.PushNotificationPost.CONTENT]+"\n"+nvc[AzureContract.PushNotificationPost.SUBSCRIPTION_URI]+"\n"+nvc[AzureContract.PushNotificationPost.NAVIGATION_URI];
                return;
            }

            string title, content, subscriptionUri, navigationUri;

            title = nvc[AzureContract.PushNotificationPost.TITLE];
            content = nvc[AzureContract.PushNotificationPost.CONTENT];
            subscriptionUri = nvc[AzureContract.PushNotificationPost.SUBSCRIPTION_URI];
            navigationUri = nvc[AzureContract.PushNotificationPost.NAVIGATION_URI];
            lt.Text = "Toast title:" + title + "\ncontent:" + content + "\nnavigation uri:" + navigationUri + "\nphone uri:" + subscriptionUri;

            sendPushNotification(subscriptionUri, title, content, navigationUri);
        }
예제 #7
0
        protected override void Render(HtmlTextWriter writer)
        {
            var headControl = Page.Header;
            if (headControl == null)
            {
                base.Render(writer);
                return;
            }
            try
            {
                var hrefSchemeAndServerPart = PortalContext.Current.OriginalUri.GetComponents(UriComponents.SchemeAndServer, UriFormat.SafeUnescaped);
                var hrefPathPart = PortalContext.Current.OriginalUri.GetComponents(UriComponents.Path, UriFormat.SafeUnescaped);
                hrefSchemeAndServerPart = VirtualPathUtility.AppendTrailingSlash(hrefSchemeAndServerPart);

                var hrefString = String.Concat(hrefSchemeAndServerPart, hrefPathPart);

                //note that if the original URI already contains a trailing slash, we do not remove it
                if (AppendTrailingSlash)
                    hrefString = VirtualPathUtility.AppendTrailingSlash(hrefString);

                var baseTag = new LiteralControl
                {
                    ID = "baseTag",
                    Text = String.Format("<base href=\"{0}\" />", hrefString)
                };
                baseTag.RenderControl(writer);

            }
            catch (Exception exc) //logged
            {
                Logger.WriteException(exc);
            }

        }
예제 #8
0
 protected override void CreateChildControls()
 {
     base.CreateChildControls();
     LiteralControl message = new LiteralControl();
     message.Text = DisplayMessage;
     Controls.Add(message);
 }
        protected void btnCampaignSearch_Click(object sender, EventArgs e)
        {
            try
            {
                lblCampaignSearch.Text = "";
                List <Campaign> campaignsList = SharePointConnector.GetCampaigns(txbCampaign.Text.Trim());

                //System.Threading.Thread.Sleep(1000);

                if (campaignsList.Count == 0)
                {
                    lblCampaignSearch.Text = "No existen nombres de campañas que contengan los caracteres ingresados.<br/>Puede que la campaña buscada ya no esté vigente.";
                }
                else
                {
                    lsbCampaign.Enabled = true;
                }

                lsbCampaign.DataSource     = campaignsList;
                lsbCampaign.DataTextField  = "CampaignName";
                lsbCampaign.DataValueField = "CampaignImage";
                lsbCampaign.DataBind();

                txbCampaign.Focus();
            }
            catch (Exception ex)
            {
                System.Web.UI.LiteralControl errorMessage = new System.Web.UI.LiteralControl();
                errorMessage.Text = ex.Message;

                this.Controls.Clear();
                this.Controls.Add(errorMessage);
            }
        }
        protected static void Page_Init(object sender, ActiveEventArgs e)
        {
            Page page = HttpContext.Current.Handler as Page;
            if (page != null)
            {
                if(!page.IsPostBack)
                {
                    // Inject the Google Analytics tracking code...
                    string trackingID = Settings.Instance["GoogleAnalyticsTrackingID"];
                    if(!string.IsNullOrEmpty(trackingID))
                    {
                        string trackingCode = string.Format(@"
<script type=""text/javascript"">
var _gaq = _gaq || [];
_gaq.push(['_setAccount', '{0}']);
_gaq.push(['_trackPageview']);
(function() {{
var ga = document.createElement('script');
ga.src = ('https:' == document.location.protocol ?
    'https://ssl' : 'http://www') +
    '.google-analytics.com/ga.js';
ga.setAttribute('async', 'true');
document.documentElement.firstChild.appendChild(ga);
}})();
</script>", trackingID);
                        LiteralControl ctrl = new LiteralControl();
                        ctrl.Text = trackingCode;
                        page.Form.Controls.Add(ctrl);
                    }
                }
            }
        }
예제 #11
0
        private void SetupLinks()
        {
            Panel pnlContent = botnavcontent;
            HyperLink linkToAdd;
            LiteralControl space;

            for (Int32 i = 0; i < pageNames.Length; i++)
            {
                linkToAdd = new HyperLink();
                linkToAdd.NavigateUrl = pageLinks[i];
                linkToAdd.Text = linkText[i];
                if (Page.Request.Url.ToString().ToLower().Contains(pageNames[i]))
                {
                    linkToAdd.Attributes.Add("class", "unavon");
                }
                pnlContent.Controls.Add(linkToAdd);

                if (i < (pageNames.Length - 1))
                {
                    space = new LiteralControl();
                    space.Text = "&nbsp;|&nbsp;";
                    pnlContent.Controls.Add(space);
                }
            }
        }
예제 #12
0
파일: Alert.cs 프로젝트: JohnsonYuan/n2cms
		public Alert()
			: base("div")
		{
			Closable = true;
			closeButton = new LiteralControl("<button type=\"button\" class=\"close\" data-dismiss=\"alert\">&times;</button>");
			textLiteral = new LiteralControl();
		}
        private void AddPages(Dictionary <string, Dictionary <int, FundingExtensions.FundingAmounts> > summary)
        {
            short idx = 0;

            foreach (var record in summary["recorded"])
            {
                //Grab the Different Dictionaries for this mod
                var recorded                = summary["recorded"][record.Key];
                var siteFundingAlloted      = summary["allocatedSite"][record.Key];
                var studiesFundingAllocated = summary["allocatedStudies"][record.Key];
                var difference              = summary["difference"][record.Key];


                //Format html
                var fundingOverView = String.Format(htmlFormat, siteFundingAlloted.USGS, studiesFundingAllocated.USGS, siteFundingAlloted.USGS + studiesFundingAllocated.USGS, siteFundingAlloted.Customer, studiesFundingAllocated.Customer, siteFundingAlloted.Customer + studiesFundingAllocated.Customer, siteFundingAlloted.Other, studiesFundingAllocated.Other, siteFundingAlloted.Other + studiesFundingAllocated.Other, recorded.USGS, recorded.Customer, recorded.Other, difference.USGS, difference.Customer, difference.Other);
                var ltl             = new System.Web.UI.LiteralControl();
                ltl.ID   = String.Format("ltlMod{0}", record.Key);
                ltl.Text = fundingOverView;
                var rpv = new Telerik.Web.UI.RadPageView()
                {
                    TabIndex = idx,
                };
                rpv.Controls.Add(ltl);
                rmpMod.PageViews.Add(rpv);
                idx++;
            }
        }
        protected void Page_Load(object sender, EventArgs e) {

            lnkAddUpSell.Click += new EventHandler(lnkAddUpSell_Click);

            i = 1;
            while (i <= upSellProducts) {
                TextBox txt = new TextBox();
                txt.ID = "txtUpSellAddition" + i;
                plhUpSellAdditions.Controls.Add(txt);


                CustomValidator upCustomValidator = new CustomValidator();
                upCustomValidator.ControlToValidate = txt.ID;
                upCustomValidator.Enabled = true;
                upCustomValidator.EnableViewState = true;
                upCustomValidator.SetFocusOnError = true;
                upCustomValidator.Text = "This is not a valid product";
                upCustomValidator.ErrorMessage = "A upsell product you added is invlaid.";
                upCustomValidator.ServerValidate += RelatedProductValidation;

                plhUpSellAdditions.Controls.Add(upCustomValidator);

                LiteralControl l = new LiteralControl();
                l.Text = "<br/><br/>";
                plhUpSellAdditions.Controls.Add(l);
                i++;
            }

            if (product.UpSellList.Count > 0) {
                rptUpSell.DataSource = product.UpSellList;
                rptUpSell.DataBind();
            }
        }
예제 #15
0
        protected void Page_Init(object sender, EventArgs e)
        {
            BlogCategoryDAL categoryDAL = new BlogCategoryDAL();
            BlogEntryDAL entryDAL = new BlogEntryDAL();

            //setup the accordion
            this.Accordion.Panes.Clear();
            foreach (BlogCategory category in categoryDAL.ReadBlogCategory(BlogTopic))
            {
                AjaxControlToolkit.AccordionPane pane = new AjaxControlToolkit.AccordionPane();
                pane.ID = "pane" + category.Id;

                LiteralControl header = new LiteralControl(string.Format("<div class = \"MenuHeader\"><b>{0}</b></div>", category.Category));

                pane.HeaderContainer.Controls.Add(header);
                pane.ContentContainer.Controls.Add(new LiteralControl("<ul style='margin-top:0; margin-bottom:0'>"));
                foreach (BlogEntry entry in entryDAL.GetBlogEntries(category.Id))
                {
                    LinkButton linkButton = new LinkButton();
                    linkButton.ID = "linkButton" + entry.Id;
                    linkButton.Text = entry.Subject;
                    linkButton.CommandArgument = entry.Id.ToString();
                    linkButton.Command += new CommandEventHandler(linkButton_Command);
                    linkButton.CausesValidation = false;
                    linkButton.CssClass = "MenuButton";
                    pane.ContentContainer.Controls.Add(new LiteralControl("<li>"));
                    pane.ContentContainer.Controls.Add(linkButton);
                    pane.ContentContainer.Controls.Add(new LiteralControl("</li>"));
                }
                pane.ContentContainer.Controls.Add(new LiteralControl("</ul>"));
                this.Accordion.Panes.Add(pane);
            }
        }
예제 #16
0
        protected override void RegisterClientScripts()
        {
            base.RegisterClientScripts();

            //Style Sheet
            LiteralControl include = new LiteralControl("<link href='css/YUI/calendar.css' rel='stylesheet' type='text/css' />");
            this.Page.Header.Controls.Add(include);

            //scripts
            //RegisterIncludeScript("QueryBuilder", "Sage.SalesLogix.Client.GroupBuilder.jscript.querybuilder.js", true);
            RegisterIncludeScript("Yahoo_yahoo", "jscript/YUI/yahoo.js", false);
            RegisterIncludeScript("Yahoo_event", "jscript/YUI/event.js", false);
            RegisterIncludeScript("TimeObject", "jscript/timeobjs.js", false);

            if (!Page.ClientScript.IsClientScriptBlockRegistered("QBAddCondition"))
            {
                string vScript = ScriptHelper.UnpackEmbeddedResourceToString("jscript.QBAddCondition.js");
                StringBuilder vJS = new StringBuilder(vScript);

                vJS.Replace("@DateValueClientID", DateValue.ClientID + "_TXT");
                vJS.Replace("@DateValueFormat", DateValue.DateFormat);

                Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "QBAddCondition", vJS.ToString(), true);
            }
        }
        protected void rblCreditType_SelectedIndexChanged(object sender, EventArgs e)
        {
            ltrMessage.Text = "";

            cbxSegment.Checked = false;

            cblProductType.Items.Clear();
            cblWarranty.Items.Clear();
            cblTerm.Items.Clear();
            cblPeriod.Items.Clear();

            try
            {
                rblProduct.DataSource = SharePointConnector.GetProducts(rblCreditType.SelectedValue, null, rblBanx.SelectedValue);
                rblProduct.DataBind();

                cblSegment.DataSource     = SharePointConnector.GetSegments(rblCreditType.SelectedValue);
                cblSegment.DataTextField  = "NameTypeLevel";
                cblSegment.DataValueField = "Id";
                cblSegment.DataBind();
            }
            catch (Exception ex)
            {
                System.Web.UI.LiteralControl errorMessage = new System.Web.UI.LiteralControl();
                errorMessage.Text = ex.Message;

                ltrMessage.Text = ex.Message;
            }
        }
예제 #18
0
 public static void Show(System.Web.UI.Page p, object mess)
 {
     //HttpContext.Current.Response.Write("<script>alert('"+mess.ToString()+"')</script>");
     System.Web.UI.LiteralControl lt = new System.Web.UI.LiteralControl();
     lt.Text = "<script language=\"javascript\" type=\"text/javascript\"> alert(\"" + mess.ToString() + "\")</script>";
     p.Header.Controls.Add(lt);
 }
예제 #19
0
 protected void Page_Load(object sender, EventArgs e)
 {
     var projectFile = Server.MapPath("~/App_Data/Projects.txt");
     var lines = File.ReadAllLines(projectFile);
     LiteralControl projectGallery = new LiteralControl();
     string tableStart = "<table class=\"table table-striped table-hover \"><thead><tr><th>#</th><th>Name</th><th>Description</th><th>Type</th><th>Language</th><th>Code</th></tr></thead><tbody>";
     projectGallery.Text += tableStart;
     int count = 1;
     string projectHTML;
     foreach (var line in lines)
     {
         var splitLine = line.Split('$');
         if (splitLine[5] == "True")
         {
             if (count % 2 == 1)
             {
                 projectHTML = @"<tr><td>" + count.ToString() + @"</td><td>" + splitLine[0] + @"</td><td>" + splitLine[1] + @"</td><td>" + splitLine[2] + @"</td><td>" + splitLine[3] + @"</td><td><a href=""" + splitLine[4] + @"""class=""btn btn-success"">Source</a>";
             }
             else
             {
                 projectHTML = @"<tr class=""info""><td>" + count.ToString() + @"</td><td>" + splitLine[0] + @"</td><td>" + splitLine[1] + @"</td><td>" + splitLine[2] + @"</td><td>" + splitLine[3] + @"</td><td><a href=""" + splitLine[4] + @"""class=""btn btn-success"">Source</a>";
             }
             count++;
             projectGallery.Text += projectHTML;
         }
     }
     projectGallery.Text += @"</tbody></table>";
     finishedProjectsDiv.Controls.Add(projectGallery);
 }
예제 #20
0
        private void cbUpgrade_Callback(object sender, Controls.CallBackEventArgs e)
        {
            string upFilePath = Server.MapPath("~/desktopmodules/activeforums/upgrade4x.txt");
            string err = "Success";
            try
            {
                if (System.IO.File.Exists(upFilePath))
                {
                    string s = Utilities.GetFileContent(upFilePath);
                    err = DotNetNuke.Entities.Portals.PortalSettings.ExecuteScript(s);
                    System.IO.File.Delete(upFilePath);
                }
            }
            catch (Exception ex)
            {
                if (ex is UnauthorizedAccessException && string.IsNullOrEmpty(err))
                {
                    err = "<span style=\"font-size:14px;font-weight:bold;\">The forum data was upgraded successfully, but you must manually delete the following file:<br /><br />" + upFilePath + "<br /><br />The upgrade is not complete until you delete the file indicated above.</span>";
                }
                else
                {
                    err = "<span style=\"font-size:14px;font-weight:bold;\">Upgrade Failed - Please go to the <a href=\"http://www.activemodules.com/community/helpdesk.aspx\">Active Modules Help Desk</a> to report the error indicated below:<br /><br />" + ex.Message + "</span>";
                }

            }
            LiteralControl lit = new LiteralControl();
            if (string.IsNullOrEmpty(err))
            {
                err = "<script type=\"text/javascript\">LoadView('home');</script>";
            }
            lit.Text = err;
            lit.RenderControl(e.Output);
        }
예제 #21
0
 //must implement following method
 public void InstantiateIn(Control container)
 {
     LiteralControl l = new LiteralControl();
       l.DataBinding +=
     new EventHandler(this.OnDataBinding);
       container.Controls.Add(l);
 }
예제 #22
0
		private void magix_forms_controls_panel(object sender, ActiveEventArgs e)
		{
            Node ip = Ip(e.Params);
			if (ShouldInspect(ip))
			{
				Inspect(ip);
				return;
			}

			LiteralControl ctrl = new LiteralControl();

            Node node = ip["_code"].Get<Node>();

            string idPrefix = "";
            if (ip.ContainsValue("id-prefix"))
                idPrefix = ip["id-prefix"].Get<string>();

            if (node.ContainsValue("id"))
                ctrl.ID = idPrefix + node["id"].Get<string>();
            else if (node.Value != null)
                ctrl.ID = idPrefix + node.Get<string>();

            if (node.ContainsValue("text"))
				ctrl.Text = node["text"].Get<string>();

            ip["_ctrl"].Value = ctrl;
		}
예제 #23
0
    private void BindPageList()
    {
        foreach (Page page in BlogEngine.Core.Page.Pages)
        {
            if (!page.HasParentPage)
            {
                HtmlGenericControl li = new HtmlGenericControl("li");
                HtmlAnchor a = new HtmlAnchor();
                a.HRef = "?id=" + page.Id.ToString();
                a.InnerHtml = page.Title;

                System.Web.UI.LiteralControl text = new System.Web.UI.LiteralControl
                (" (" + page.DateCreated.ToString("yyyy-dd-MM HH:mm") + ")");

                li.Controls.Add(a);
                li.Controls.Add(text);

                if (page.HasChildPages)
                {
                    li.Controls.Add(BuildChildPageList(page));
                }

                li.Attributes.CssStyle.Remove("font-weight");
                li.Attributes.CssStyle.Add("font-weight", "bold");

                ulPages.Controls.Add(li);
            }
        }

        divPages.Visible = true;
        aPages.InnerHtml = BlogEngine.Core.Page.Pages.Count + " " + Resources.labels.pages;
    }
예제 #24
0
        protected void Page_Load(object sender, EventArgs e)
        {
            LiteralControl litcon01 = new LiteralControl();
            litcon01.Text += "<h1>nbl_WC_Close-Coupled</h1>";
            model01_title.Controls.Add(litcon01);

            LiteralControl litcon02 = new LiteralControl();
            litcon02.Text += "<h1>nbl_WashFountain</h1>";
            model02_title.Controls.Add(litcon02);

            LiteralControl litcon03 = new LiteralControl();
            litcon03.Text += "<h1>nbl_WashBasin_Pedestal</h1>";
            model03_title.Controls.Add(litcon03);

            LiteralControl litcon04 = new LiteralControl();
            litcon04.Text += "<h1>nbl_Sink_Belfast</h1>";
            model04_title.Controls.Add(litcon04);

            LiteralControl litcon05 = new LiteralControl();
            litcon05.Text += "<h1>nbl_Shower_Rctngl</h1>";
            model05_title.Controls.Add(litcon05);

            LiteralControl litcon06 = new LiteralControl();
            litcon06.Text += "<h1>nbl_SanitaryAccessory_Hand-Drier</h1>";
            model06_title.Controls.Add(litcon06);
        }
        protected override void OnInit(EventArgs e)
        {
            base.OnInit(e);

            //Editors in the control panel hack
            if (Page != null && Page.Master != null && Page.Master.Master != null)
            {
                ContentPlaceHolder placeholder = Page.Master.Master.FindControl("StyleRegion") as ContentPlaceHolder;
                if(placeholder == null && Page.Master.Master.Master != null)
                {
                    placeholder = Page.Master.Master.Master.FindControl("StyleRegion") as ContentPlaceHolder;
                }

                if (placeholder != null)
                {
                    placeholder.PreRender += (sender, b) =>
                    {
                        ICustomEditorPlugin plugin = PluginManager.GetSingleton<ICustomEditorPlugin>();

                        LiteralControl lit = new LiteralControl("<style type=\"text/css\">" + plugin.Css + "</style>");

                        ((Control)sender).Controls.Add(lit);

                    };
                }
            }
        }
예제 #26
0
    private void BindDrafts()
    {
        Guid id = Guid.Empty;

        if (!String.IsNullOrEmpty(Request.QueryString["id"]) && Request.QueryString["id"].Length == 36)
        {
            id = new Guid(Request.QueryString["id"]);
        }

        int counter = 0;

        foreach (Post post in Post.Posts)
        {
            if (!post.IsPublished && post.Id != id)
            {
                HtmlGenericControl li = new HtmlGenericControl("li");
                HtmlAnchor         a  = new HtmlAnchor();
                a.HRef      = "?id=" + post.Id.ToString();
                a.InnerHtml = post.Title;

                System.Web.UI.LiteralControl text = new System.Web.UI.LiteralControl(" by " + post.Author + " (" + post.DateCreated.ToString("yyyy-dd-MM HH\\:mm") + ")");

                li.Controls.Add(a);
                li.Controls.Add(text);
                ulDrafts.Controls.Add(li);
                counter++;
            }
        }

        if (counter > 0)
        {
            divDrafts.Visible = true;
            aDrafts.InnerHtml = string.Format(Resources.labels.thereAreXDrafts, counter);
        }
    }
예제 #27
0
        protected void btnAgreementSearch_Click(object sender, EventArgs e)
        {
            try
            {
                lblAgreementSearch.Text = "";
                List <Agreement> agreementsList = SharePointConnector.GetAgreements(txbAgreement.Text.Trim());

                //System.Threading.Thread.Sleep(1000);

                if (agreementsList.Count == 0)
                {
                    lblAgreementSearch.Text = "No existen nombres de convenios que contengan los caracteres ingresados.";
                }
                else
                {
                    lsbAgreement.Enabled = true;
                }

                lsbAgreement.DataSource     = agreementsList;
                lsbAgreement.DataTextField  = "AgreementName";
                lsbAgreement.DataValueField = "AgreementImage";
                lsbAgreement.DataBind();

                txbAgreement.Focus();
            }
            catch (Exception ex)
            {
                System.Web.UI.LiteralControl errorMessage = new System.Web.UI.LiteralControl();
                errorMessage.Text = ex.Message;

                this.Controls.Clear();
                this.Controls.Add(errorMessage);
            }
        }
        protected override void CreateChildControls()
        {
            return;
            SPQuery query = new SPQuery();
            // supports less than 130,000 records
            // query.Query = "<Where><Eq><FieldRef Name='_x804c__x4f4d_'/><Value Type='Text'>J</Value></Eq></Where>";
            query.Query = "<Where><And><Eq><FieldRef Name='_x6027__x522b_'/><Value Type='Text'>男</Value></Eq><Eq><FieldRef Name='_x804c__x4f4d_'/><Value Type='Text'>J</Value></Eq></And></Where>";
            SPWeb web = SPContext.Current.Web;
            PortalSiteMapProvider ps = PortalSiteMapProvider.WebSiteMapProvider;
            PortalWebSiteMapNode psNode = (PortalWebSiteMapNode)ps.FindSiteMapNode(web.ServerRelativeUrl);

            if (psNode != null)
            {
                Stopwatch timer = new Stopwatch();
                timer.Start();
                SiteMapNodeCollection items = ps.GetCachedListItemsByQuery(psNode, "人物列表", query, web);

                StringBuilder sb = new StringBuilder();
                foreach (PortalListItemSiteMapNode item in items)
                {
                    sb.Append(item["性别"]);
                    sb.Append(",");
                }
                timer.Stop();
                sb.Append("<hr>");
                sb.Append(string.Format("{0:N}",timer.Elapsed.Ticks / 10m));
                LiteralControl lc = new LiteralControl();
                lc.Text = sb.ToString();
                this.Controls.Add(lc);
            }
        }
예제 #29
0
        private static void ClearControls(Control control)
        {
            for (int index = control.Controls.Count - 1; index >= 0; index--)
            {
                ClearControls(control.Controls[index]);
            }

            if (!(control is TableCell))
            {
                if (control.GetType().GetProperty("SelectedItem") != null)
                {
                    LiteralControl m_Literal = new LiteralControl();
                    control.Parent.Controls.Add(m_Literal);

                    m_Literal.Text = (string)control.GetType().GetProperty("SelectedItem").GetValue(control, null);
                    control.Parent.Controls.Remove(control);
                }
                else
                {
                    if (control.GetType().GetProperty("Text") != null)
                    {
                        LiteralControl m_Literal = new LiteralControl();
                        control.Parent.Controls.Add(m_Literal);
                        m_Literal.Text = (string)control.GetType().GetProperty("Text").GetValue(control, null);
                        control.Parent.Controls.Remove(control);
                    }
                }
            }
        }
예제 #30
0
        protected void btnShowAgreement_Click(object sender, EventArgs e)
        {
            try
            {
                pnlForm.Visible  = false;
                pnlPrint.Visible = true;

                lblMessage.Visible      = false;
                btnPrint.Visible        = false;
                btnSaveAndPrint.Visible = true;

                lblFisa.Text            = txbFisa.Text.Trim();
                lblCreditType.Text      = rblCreditType.SelectedValue;
                lblClientCode.Text      = txbClientCode.Text.Trim();
                lblClientName.Text      = txbClientName.Text.Trim();
                lblCpop.Text            = rblCpop.SelectedValue;
                lblDisabled.Text        = rblDisabled.SelectedValue;
                lblClientBirthdate.Text = SharePointConnector.IsBanxClient(txbClientBirthdate.Text) ? "SI" : "NO";
                ltrAgreementImage.Text  = string.Format(
                    "<img src='{0}' alt='' />",
                    lsbAgreement.SelectedValue);
            }
            catch (Exception ex)
            {
                System.Web.UI.LiteralControl errorMessage = new System.Web.UI.LiteralControl();
                errorMessage.Text = ex.Message;

                this.Controls.Clear();
                this.Controls.Add(errorMessage);
            }
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            if (Session["user_id"] == null)
            {
                Response.Redirect("Login.aspx");
            }

            if (!IsPostBack)
            {
                int user_id = int.Parse(Session["user_id"].ToString());
                if(DatabaseManagement.isUserAdmin(user_id)) {
                    lblAddDocument.Visible = true;
                    btnAddDocument.Visible = true;
                }

                List<Document> documents = DatabaseManagement.getAllDocuments();

                foreach (Document d in documents)
                {
                    LiteralControl lc = new LiteralControl("<a href=\"UploadedFiles/documents/" + d.getPath() + "\">" + d.getTitle() + "</a>");
                    pnlDocuments.Controls.Add(lc);
                    pnlDocuments.Controls.Add(new LiteralControl("<br />"));

                }
            }
        }
예제 #32
0
 public static void IncludeStringAtTop(Page page, string str)
 {
     var child = new LiteralControl();
     child.ID = GetHeaderChildID(page);
     child.Text = str;
     page.Header.Controls.AddAt(0, child);
 }
예제 #33
0
 protected virtual void Page_Load(object sender, EventArgs e)
 {
     genericControl = new HtmlGenericControl();
     genericControl.InnerHtml = "My Header";
     this.Controls.Add(genericControl);
     LiteralControl control = new LiteralControl("<a href='Default.aspx'>Blank</a>");
     this.Controls.Add(control);
 }
예제 #34
0
		public virtual Control AddTo(Control container)
		{
			var link = new LiteralControl(
					string.Format("<a href='{0}' data-url-template='{0}' target='{1}' class='option templatedurl {2}'>{3}</a>", N2.Web.Url.ResolveTokens(Url), Target, Selected ? "selected" : "", Title)
				);
			container.Controls.Add(link);
			return link;
		}
예제 #35
0
 public void InstantiateIn(System.Web.UI.Control container)
 {
     LiteralControl lc = new LiteralControl();
     lc.ID = "label";
     GridViewEditItemTemplateContainer templateContainer = container as GridViewEditItemTemplateContainer;
     lc.Text = templateContainer.Text;
     container.Controls.Add(lc);
 }
예제 #36
0
파일: ToolbarOption.cs 프로젝트: Jobu/n2cms
 public virtual Control AddTo(Control container)
 {
     var link = new LiteralControl(
             string.Format("<a href='{0}' target='{1}' class='option'>{2}</a>", Url, Target, Title)
         );
     container.Controls.Add(link);
     return link;
 }
예제 #37
0
 protected override void CreateChildControls()
 {
     // 种
     LiteralControl literal = new LiteralControl();
     literal.ID = "biblio";
     literal.Text = "";
     this.Controls.Add(literal);
 }
예제 #38
0
        protected void btnExportReport_Click(object sender, EventArgs e)
        {
            try
            {
                Response.Clear();
                Response.Buffer = true;
                Response.AddHeader("content-disposition", "attachment;filename=BMSCResumenTasasASFI.csv");
                Response.Charset     = "";
                Response.ContentType = "text/csv";

                System.Text.StringBuilder sb = new System.Text.StringBuilder();
                sb.Append("MONEDA;");
                sb.Append("CREDITO;");
                sb.Append("PRODUCTO;");
                sb.Append("TIPO PRODUCTO;");
                sb.Append("TF;");
                sb.Append("TV");
                sb.Append("\r\n");

                for (int i = 0; i < dgrReport.Items.Count; i++)
                {
                    sb.Append(rblCurrency.SelectedValue + ";");

                    for (int k = 0; k < dgrReport.Items[i].Cells.Count; k++)
                    {
                        string text = dgrReport.Items[i].Cells[k].Text;

                        byte[] bytes = Encoding.Default.GetBytes(text);
                        text = Encoding.Default.GetString(bytes);

                        if (k == dgrReport.Items[i].Cells.Count - 1)
                        {
                            sb.Append(text);
                        }
                        else
                        {
                            sb.Append(text + ';');
                        }
                    }

                    sb.Append("\r\n");
                }

                Response.Output.Write(sb.ToString());
                Response.Flush();
                Response.Close();
                Response.End();
            }
            catch (Exception ex)
            {
                System.Web.UI.LiteralControl errorMessage = new System.Web.UI.LiteralControl();
                errorMessage.Text = ex.Message;

                this.Controls.Clear();
                this.Controls.Add(errorMessage);
            }
        }
예제 #39
0
 private void ChangeDefaultAttachmentEmptyText(string section)
 {
     System.Web.UI.HtmlControls.HtmlGenericControl attachSect = (HtmlGenericControl)FindControlRecursive(attachments, section);
     if (attachSect != null && attachSect.HasControls())
     {
         System.Web.UI.LiteralControl ul = (LiteralControl)attachSect.Controls[0];
         ul.Text = @"<ul><li>Pending</li></ul>";
     }
 }
예제 #40
0
        protected void rblCreditType_SelectedIndexChanged(object sender, EventArgs e)
        {
            //System.Threading.Thread.Sleep(1000);

            try
            {
                ddlSegmentType.Focus();

                ddlSegmentType.DataSource     = SharePointConnector.GetSegments(rblCreditType.SelectedValue);
                ddlSegmentType.DataTextField  = "NameAndType";
                ddlSegmentType.DataValueField = "Id";
                ddlSegmentType.DataBind();
                ddlSegmentType.SelectedIndex = 0;

                ddlProduct.DataSource = SharePointConnector.GetProducts(rblCreditType.SelectedValue, txbClientBirthdate.Text, null);
                ddlProduct.DataBind();
                ddlProduct.Items.Insert(0, new ListItem("(Seleccione el producto)", string.Empty));
                ddlProduct.SelectedIndex = 0;

                ddlProductType.SelectedIndex = 0;
                ddlWarranty.SelectedIndex    = 0;
                ddlTerm.SelectedIndex        = 0;
                ddlMargin.SelectedIndex      = 0;

                #region Forcing initial validation for later asignments
                rfvClientName.Validate();
                rfvClientCode.Validate();
                cmvClientCode.Validate();
                rfvClientBirthdate.Validate();
                cmvClientBirthdate.Validate();

                if (rfvClientName.IsValid &&
                    rfvClientCode.IsValid && cmvClientCode.IsValid &&
                    rfvClientBirthdate.IsValid && cmvClientBirthdate.IsValid)
                {
                    txbClientName.Enabled      = false;
                    txbClientCode.Enabled      = false;
                    txbClientBirthdate.Enabled = false;

                    ddlProduct.Enabled = true;
                }
                else
                {
                    ddlProduct.Enabled = false;
                }
                #endregion
            }
            catch (Exception ex)
            {
                System.Web.UI.LiteralControl errorMessage = new System.Web.UI.LiteralControl();
                errorMessage.Text = ex.Message;

                this.Controls.Clear();
                this.Controls.Add(errorMessage);
            }
        }
        /// <summary>
        /// Checks if the meta tags contain unallowed meta tags.
        /// </summary>
        /// <param name="page"></param>
        private PageValidationResult CheckForbiddenMetaTags(PageValidationResult res)
        {
            res.MetaTagsAreValid.Valid = true;
            //Loop controls
            foreach (Control header in res.Page.Header.Controls)
            {
                Type headerType = header.GetType();

                if (headerType == typeof(System.Web.UI.HtmlControls.HtmlMeta))
                {
                    System.Web.UI.HtmlControls.HtmlMeta control = (System.Web.UI.HtmlControls.HtmlMeta)header;

                    string TagName = control.Name;
                    if (config.Modules.Yoast.MetaTagIsUnallowed(TagName.ToLower()))
                    {
                        res.MetaTagsAreValid.Valid    = false;
                        res.MetaTagsAreValid.Message  = TagName + " meta tag found, this is unallowed!";
                        res.MetaTagsAreValid.CssClass = defaultInvalidCssClass;
                        res.Fail(res.MetaTagsAreValid.Message);
                        return(res);
                    }
                }
                else
                {
                    if (headerType == typeof(System.Web.UI.LiteralControl))
                    {
                        System.Web.UI.LiteralControl control = (LiteralControl)header;

                        //Match paterns to find out with tokens are used
                        Regex fullNameRegex = new Regex("name=\"(.+?)\"");
                        Regex nameRegex     = new Regex("\"(.+?)\"");
                        Regex contentRegex  = new Regex("content=\"(.+?)\"");
                        Regex metaTags      = new Regex(@"<meta(.+?)>");
                        foreach (Match metaTag in metaTags.Matches(control.Text))
                        {
                            string fullName = fullNameRegex.Match(metaTag.Value).Value;
                            string name     = nameRegex.Match(fullName).Value;
                            name = name.Replace("\"", "");
                            string content = contentRegex.Match(metaTag.Value).Value;

                            if (config.Modules.Yoast.MetaTagIsUnallowed(name.ToLower()))
                            {
                                res.MetaTagsAreValid.Valid    = false;
                                res.MetaTagsAreValid.Message  = name + " meta tag found, this is unallowed!";
                                res.MetaTagsAreValid.CssClass = defaultInvalidCssClass;
                                res.Fail(res.MetaTagsAreValid.Message);
                                return(res);
                            }
                        }
                    }
                }
            }

            return(res);
        }
예제 #42
0
                /// <summary>
                /// this method makes a copy of control as a clone function
                /// <note>
                ///     properties not in the object will NOT be cloned.
                /// </note>
                /// </summary>
                /// <param name="c">control to clone from</param>
                /// <returns>Control</returns>
                /// <example title="Clone Control of Table Cells">
                ///     <code>
                ///     foreach (Control control in tempTableCellControls)
                ///     {
                ///         tc.Controls.Add(RF.GlobalClass.WebForm.ControlCollection.CloneControl(control));
                ///     }
                ///     </code>
                /// </example>
                public static System.Web.UI.Control CloneControl(Control c)
                {
                    Type type  = c.GetType();
                    var  clone = (0 == type.GetConstructors().Length) ? new Control() : Activator.CreateInstance(type) as Control;

                    try
                    {
                        if (c is HtmlControl)
                        {
                            clone.ID = c.ID;
                            AttributeCollection            attributeCollection = ((HtmlControl)c).Attributes;
                            System.Collections.ICollection keys = attributeCollection.Keys;
                            foreach (string key in keys)
                            {
                                ((HtmlControl)c).Attributes.Add(key, (string)attributeCollection[key]);
                            }
                        }
                        else if (c is System.Web.UI.LiteralControl)
                        {
                            clone = new System.Web.UI.LiteralControl(((System.Web.UI.LiteralControl)(c)).Text);
                        }
                        else
                        {
                            PropertyInfo[] properties = c.GetType().GetProperties();
                            foreach (PropertyInfo p in properties)
                            {
                                // "InnerHtml/Text" are generated on the fly, so skip them. "Page" can be ignored, because it will be set when control is added to a Page.
                                if (p.Name != "InnerHtml" && p.Name != "InnerText" && p.Name != "Page" && p.CanRead && p.CanWrite)
                                {
                                    try
                                    {
                                        ParameterInfo[] indexParameters = p.GetIndexParameters();
                                        p.SetValue(clone, p.GetValue(c, indexParameters), indexParameters);
                                    }
                                    catch (System.Reflection.TargetInvocationException tiex)
                                    {
                                    }
                                }
                            }
                        }
                        int cControlsCount = c.Controls.Count;
                        for (int i = 0; i < cControlsCount; ++i)
                        {
                            clone.Controls.Add(CloneControl(c.Controls[i]));
                        }
                    }
                    catch (Exception ex)
                    {
                    }
                    return(clone);
                }
예제 #43
0
        protected void InsertBodyAttributes(string lsAttributes)
        {
            int lnBodyHeaderIndex = GetBodyHeaderControlIndex();

            if (lnBodyHeaderIndex >= 0)
            {
                System.Web.UI.LiteralControl loHTMLHeader = (System.Web.UI.LiteralControl) this.Controls[lnBodyHeaderIndex];
                string lsHTMLHeader = loHTMLHeader.Text.ToLower();
                int    lnPos        = lsHTMLHeader.IndexOf("body");
                lsHTMLHeader      = loHTMLHeader.Text;
                lsHTMLHeader      = lsHTMLHeader.Substring(0, lnPos + 4) + " " + lsAttributes + " " + lsHTMLHeader.Substring(lnPos + 4, lsHTMLHeader.Length - lnPos - 4);
                loHTMLHeader.Text = lsHTMLHeader;
            }
        }
예제 #44
0
	private HtmlGenericControl BuildChildPageList(BlogEngine.Core.Page page)
	{
		HtmlGenericControl ul = new HtmlGenericControl("ul");
		foreach (Page cPage in BlogEngine.Core.Page.Pages.FindAll(delegate(BlogEngine.Core.Page p)
		{
			//p => (p.Parent == page.Id)))
			return p.Parent == page.Id;
		}))
		{
			HtmlGenericControl cLi = new HtmlGenericControl("li");
			cLi.Attributes.CssStyle.Add("font-weight", "normal");
			HtmlAnchor cA = new HtmlAnchor();
			cA.HRef = "?id=" + cPage.Id.ToString();
			cA.InnerHtml = cPage.Title;

			System.Web.UI.LiteralControl cText = new System.Web.UI.LiteralControl
			(" (" + cPage.DateCreated.ToString("yyyy-dd-MM HH:mm") + ") ");

			string deleteText = "Are you sure you want to delete the page?";
			HtmlAnchor delete = new HtmlAnchor();
			delete.InnerText = Resources.labels.delete;
			delete.Attributes["onclick"] = "if (confirm('" + deleteText + "')){location.href='?delete=" + cPage.Id + "'}";
			delete.HRef = "javascript:void(0);";
			delete.Style.Add(System.Web.UI.HtmlTextWriterStyle.FontWeight, "normal");

			cLi.Controls.Add(cA);
			cLi.Controls.Add(cText);
			cLi.Controls.Add(delete);

			if (cPage.HasChildPages)
			{
				cLi.Attributes.CssStyle.Remove("font-weight");
				cLi.Attributes.CssStyle.Add("font-weight", "bold");
				cLi.Controls.Add(BuildChildPageList(cPage));
			}

			ul.Controls.Add(cLi);

		}
		return ul;
	}
예제 #45
0
        protected void btnSaveAndPrint_Click(object sender, EventArgs e)
        {
            try
            {
                SharePointConnector.SaveAgreement(lblFisa.Text, lblCreditType.Text, lblClientCode.Text,
                                                  lblClientName.Text, lblCpop.Text + " | " + lblClientBirthdate.Text + " | " + lblDisabled.Text,
                                                  lsbAgreement.SelectedValue);

                lblMessage.Visible      = true;
                btnPrint.Visible        = true;
                btnSaveAndPrint.Visible = false;
            }
            catch (Exception ex)
            {
                System.Web.UI.LiteralControl errorMessage = new System.Web.UI.LiteralControl();
                errorMessage.Text = ex.Message;

                this.Controls.Clear();
                this.Controls.Add(errorMessage);
            }
        }
예제 #46
0
	private void BindPageList()
	{
		foreach (Page page in BlogEngine.Core.Page.Pages)
		{
			if (!page.HasParentPage)
			{
				HtmlGenericControl li = new HtmlGenericControl("li");
				HtmlAnchor a = new HtmlAnchor();
				a.HRef = "?id=" + page.Id.ToString();
				a.InnerHtml = page.Title;

				System.Web.UI.LiteralControl text = new System.Web.UI.LiteralControl
				(" (" + page.DateCreated.ToString("yyyy-dd-MM HH:mm") + ") ");

				string deleteText = "Are you sure you want to delete the page?";
				HtmlAnchor delete = new HtmlAnchor();
				delete.InnerText = Resources.labels.delete;
				delete.Attributes["onclick"] = "if (confirm('" + deleteText + "')){location.href='?delete=" + page.Id + "'}";
				delete.HRef = "javascript:void(0);";
				delete.Style.Add(System.Web.UI.HtmlTextWriterStyle.FontWeight, "normal");

				li.Controls.Add(a);
				li.Controls.Add(text);
				li.Controls.Add(delete);

				if (page.HasChildPages)
				{
					li.Controls.Add(BuildChildPageList(page));					
				}

				li.Attributes.CssStyle.Remove("font-weight");
				li.Attributes.CssStyle.Add("font-weight", "bold");

				ulPages.Controls.Add(li);
			}
		}

		divPages.Visible = true;
		aPages.InnerHtml = BlogEngine.Core.Page.Pages.Count + " " + Resources.labels.pages;
	}
예제 #47
0
        protected void btnShowReport_Click(object sender, EventArgs e)
        {
            if (isUserContentEditor)
            {
                btnExportReport.Visible = true;
            }

            try
            {
                string[] creditTypesList = new string[] { "PERSONAL", "PYME", "EMPRESARIAL" };
                dgrReport.DataSource = SharePointConnector.GetReportTableRates(creditTypesList, rblCurrency.SelectedValue);
                dgrReport.DataBind();
            }
            catch (Exception ex)
            {
                System.Web.UI.LiteralControl errorMessage = new System.Web.UI.LiteralControl();
                errorMessage.Text = ex.Message;

                this.Controls.Clear();
                this.Controls.Add(errorMessage);
            }
        }
예제 #48
0
        protected void btnSaveAndPrint_Click(object sender, EventArgs e)
        {
            try
            {
                lblMessage.Visible      = true;
                btnPrint.Visible        = true;
                btnSaveAndPrint.Visible = false;

                SharePointConnector.SaveRate(
                    lblFisa.Text, lblExecutive.Text,
                    lblBank.Text,
                    lblClientName.Text, lblClientCode.Text,
                    lblCpop.Text, lblBanx.Text, lblDisabled.Text,
                    lblSector.Text,
                    lblSegmentType.Text,
                    lblIvc.Text, lblIrt.Text,
                    lblProduct.Text,
                    lblProductType.Text,
                    lblWarranty.Text,
                    lblTerm.Text,
                    lblPeriodFixed.Text,
                    lblCurrency.Text,
                    lblMargin.Text,
                    //System.Text.RegularExpressions.Regex.Replace(lblRate.Text, @"<[^>]+>|&nbsp;", "").Trim(),
                    lblRate.Text,
                    lblCpopBenefit.Text,
                    lblDisabledBenefit.Text);
            }
            catch (Exception ex)
            {
                System.Web.UI.LiteralControl errorMessage = new System.Web.UI.LiteralControl();
                errorMessage.Text = ex.Message;

                this.Controls.Clear();
                this.Controls.Add(errorMessage);
            }
        }
예제 #49
0
        protected void btnShowRates_Click(object sender, EventArgs e)
        {
            try
            {
                pnlForm.Visible  = false;
                pnlPrint.Visible = true;

                lblMessage.Visible      = false;
                btnPrint.Visible        = false;
                btnSaveAndPrint.Visible = true;

                Rate theRate = SharePointConnector.GetRates(
                    rblCreditType.SelectedValue,
                    int.Parse(ddlSegmentType.SelectedItem.Value),
                    ddlProduct.SelectedValue,
                    ddlProductType.SelectedItem.Text,
                    SharePointConnector.IsBanxClient(txbClientBirthdate.Text),
                    SharePointConnector.IsDisabledClient(rblDisabled.SelectedValue),
                    SharePointConnector.IsCpopClient(rblCpop.SelectedValue),
                    rblSector.SelectedValue,
                    txbIvc.Text,
                    txbIrt.Text,
                    ddlMargin.SelectedItem.Text,
                    ddlWarranty.SelectedItem.Text,
                    ddlTerm.SelectedItem.Value,
                    ddlPeriodFixed.SelectedItem.Value,
                    rblCurrency.SelectedValue);

                if (theRate.RateFixed > 50.0)
                {
                    ltrMessage.Text = "<table class='print' style='width:100%;padding:3em 12em;'>" +
                                      "<tr><td><span class='number' style='padding:20px;'>" +
                                      "LA TASA SOLICITADA NO APLICA.</span></td></tr></table>";

                    tblPrint.Visible        = false;
                    btnSaveAndPrint.Visible = false;

                    return;
                }
                else if (rblCreditType.SelectedValue == "PERSONAL" &&
                         ddlProductType.SelectedItem.Text == "VISA INTERNACIONAL PAYBANX" &&
                         ddlWarranty.SelectedItem.Text.StartsWith("NO DEBIDAMENTE GARANTIZADO", StringComparison.CurrentCultureIgnoreCase))
                {
                    ltrMessage.Text = "<table class='print' style='width:100%;padding:3em 12em;'>" +
                                      "<tr><td><span class='number' style='padding:20px;'>" +
                                      "LA TASA SOLICITADA NO APLICA.</span></td></tr></table>";

                    tblPrint.Visible        = false;
                    btnSaveAndPrint.Visible = false;
                }
                else
                {
                    ltrMessage.Text         = "";
                    tblPrint.Visible        = true;
                    btnSaveAndPrint.Visible = true;
                }

                #region Make the assignments
                lblFisa.Text         = txbFisa.Text;
                lblBank.Text         = rblBank.SelectedValue;
                lblClientCode.Text   = txbClientCode.Text;
                lblClientName.Text   = txbClientName.Text;
                lblBanx.Text         = SharePointConnector.IsBanxClient(txbClientBirthdate.Text) ? "SI" : "NO";
                lblSector.Text       = rblSector.SelectedValue;
                lblSegmentType.Text  = ddlSegmentType.SelectedItem.Text;
                lblSegmentLabel.Text =
                    (rblCreditType.SelectedValue == "PERSONAL" ? "Segmento" : "Tamaño de Actividad") + " | Tipo de Segmento";
                lblCpop.Text        = rblCpop.SelectedValue;
                lblDisabled.Text    = rblDisabled.SelectedValue;
                lblIvc.Text         = string.IsNullOrEmpty(txbIvc.Text) ? "(sin valor)" : txbIvc.Text;
                lblIrt.Text         = string.IsNullOrEmpty(txbIrt.Text) ? "(sin valor)" : txbIrt.Text;;
                lblProduct.Text     = rblCreditType.SelectedValue + " | " + ddlProduct.SelectedValue;
                lblProductType.Text = ddlProductType.SelectedItem.Text;
                lblWarranty.Text    = ddlWarranty.SelectedItem.Text;
                lblTerm.Text        = ddlTerm.SelectedItem.Text;
                lblPeriodFixed.Text = ddlPeriodFixed.SelectedItem.Text;
                lblCurrency.Text    = rblCurrency.SelectedValue;
                lblMargin.Text      = ddlMargin.SelectedItem.Text;

                if (rblCreditType.SelectedValue != "PERSONAL" &&
                    !ddlProduct.SelectedValue.Contains("NO PRODUCTIVO") &&
                    ddlProduct.SelectedValue.Contains("PRODUCTIVO"))
                {
                    theRate.RateVariable = 100;
                }

                Int16 period, term;
                if (Int16.TryParse(ddlPeriodFixed.SelectedItem.Value, out period) &&
                    Int16.TryParse(ddlTerm.SelectedItem.Value, out term) &&
                    period < term &&
                    theRate.RateVariable < 50)
                {//if 'Periodo Fijo' (months) is a number & is smaller than 'Plazo' (months)
                    lblRate.Text =
                        "<span class='number'>" + string.Format("{0:0.00}", theRate.RateFixed) + "%</span> fijo los primeros " +
                        "<span class='number'>" + period + " meses</span>,<br/>" +
                        "<span class='number'>" + string.Format("{0:0.00}", theRate.RateVariable) + "%</span> + TRE a partir del " +
                        "<span class='number'>mes " + (period + 1) + "</span>.";
                }
                else
                {
                    lblRate.Text =
                        "<span class='number'>" + string.Format("{0:0.00}", theRate.RateFixed) + "%</span> todo el período del crédito.<br/>";
                }

                if (lblCpop.Text == "SI")
                {
                    if (!string.IsNullOrEmpty(theRate.CpopBenefit))
                    {
                        lblCpopBenefit.Text = theRate.CpopBenefit;
                    }
                    else if (theRate.CpopValue != 0.0)
                    {
                        lblCpopBenefit.Text = "Reducción de tasa (ya incluida en la tasa calculada).";
                    }
                    else
                    {
                        lblCpopBenefit.Text = "(no disponible)";
                    }
                }
                else
                {
                    lblCpopBenefit.Text = "(no disponible)";
                }

                if (lblDisabled.Text == "SI")
                {
                    if (!string.IsNullOrEmpty(theRate.DisabledBenefit))
                    {
                        lblDisabledBenefit.Text = theRate.DisabledBenefit;
                    }
                    else if (theRate.DisabledValue != 0.0)
                    {
                        lblDisabledBenefit.Text = "Reducción de tasa (ya incluida en la tasa calculada).";
                    }
                    else
                    {
                        lblDisabledBenefit.Text = "(no disponible)";
                    }
                }
                else
                {
                    lblDisabledBenefit.Text = "(no disponible)";
                }
                #endregion
            }
            catch (Exception ex)
            {
                System.Web.UI.LiteralControl errorMessage = new System.Web.UI.LiteralControl();
                errorMessage.Text = ex.Message;

                this.Controls.Clear();
                this.Controls.Add(errorMessage);
            }
        }
예제 #50
0
        protected void ddlProduct_SelectedIndexChanged(object sender, EventArgs e)
        {
            //System.Threading.Thread.Sleep(1000);

            try
            {
                if (SharePointConnector.HasForeignCurrency(
                        ddlProduct.SelectedValue,
                        rblCreditType.SelectedValue,
                        ddlSegmentType.SelectedItem.Value))
                {
                    rblCurrency.Enabled = true;
                    rblCurrency.Focus();
                }
                else
                {
                    rblCurrency.Enabled       = false;
                    rblCurrency.SelectedIndex = 0;
                    ddlProductType.Focus();
                }

                ddlProductType.DataSource     = SharePointConnector.GetProductTypes(ddlProduct.SelectedValue, rblCreditType.SelectedValue);
                ddlProductType.DataTextField  = "Name";
                ddlProductType.DataValueField = "Id";
                ddlProductType.DataBind();
                ddlProductType.Items.Insert(0, new ListItem("(Seleccione el tipo de producto)", string.Empty));
                ddlProductType.SelectedIndex = 0;

                ddlWarranty.DataSource     = SharePointConnector.GetWarranties(ddlProduct.SelectedValue, rblCreditType.SelectedValue);
                ddlWarranty.DataTextField  = "Name";
                ddlWarranty.DataValueField = "Id";
                ddlWarranty.DataBind();
                ddlWarranty.Items.Insert(0, new ListItem("(Seleccione la garantía)", string.Empty));
                ddlWarranty.SelectedIndex = 0;

                ddlTerm.DataSource     = SharePointConnector.GetTerms(ddlProduct.SelectedValue, rblCreditType.SelectedValue, txbClientBirthdate.Text, null);
                ddlTerm.DataTextField  = "Display";
                ddlTerm.DataValueField = "Name";
                ddlTerm.DataBind();
                ddlTerm.Items.Insert(0, new ListItem("(Seleccione el plazo)", string.Empty));
                ddlTerm.SelectedIndex = 0;

                ddlPeriodFixed.DataSource     = SharePointConnector.GetPeriods(ddlProduct.SelectedValue, rblCreditType.SelectedValue, txbClientBirthdate.Text, null);
                ddlPeriodFixed.DataTextField  = "Display";
                ddlPeriodFixed.DataValueField = "Name";
                ddlPeriodFixed.DataBind();
                ddlPeriodFixed.Items.Insert(0, new ListItem("(Seleccione el período)", string.Empty));
                ddlPeriodFixed.SelectedIndex = 0;

                ddlMargin.DataSource     = SharePointConnector.GetMargins(ddlProduct.SelectedValue, ddlSegmentType.SelectedItem.Value, rblCreditType.SelectedValue);
                ddlMargin.DataTextField  = "Name";
                ddlMargin.DataValueField = "Id";
                ddlMargin.DataBind();
                ddlMargin.Items.Insert(0, new ListItem("(Seleccione el margen de negociación)", string.Empty));
                ddlMargin.SelectedIndex = 0;
            }
            catch (Exception ex)
            {
                System.Web.UI.LiteralControl errorMessage = new System.Web.UI.LiteralControl();
                errorMessage.Text = ex.Message;

                this.Controls.Clear();
                this.Controls.Add(errorMessage);
            }
        }
        protected void btnExportReport_Click(object sender, EventArgs e)
        {
            ltrMessage.Text = "";

            try
            {
                Response.Clear();
                Response.Buffer = true;
                Response.AddHeader("content-disposition", "attachment;filename=BMSCResumenTasas.csv");
                Response.Charset     = "";
                Response.ContentType = "text/csv";

                System.Text.StringBuilder sb = new System.Text.StringBuilder();
                sb.Append("RESUMEN;");
                sb.Append("MONEDA;");
                sb.Append("BANX;");
                sb.Append("CREDITO;");
                sb.Append("PRODUCTO;");
                sb.Append("TIPO PRODUCTO;");
                sb.Append("SEGMENTO;");
                sb.Append("GARANTIA;");
                sb.Append("PLAZO;");
                sb.Append("PERIODO;");
                sb.Append("TF;");
                sb.Append("TV");
                sb.Append("\r\n");

                for (int i = 0; i < dgrReport.Items.Count; i++)
                {
                    sb.Append(rblReportType.SelectedValue + ";");
                    sb.Append(rblCurrency.SelectedValue + ";");
                    sb.Append(rblBanx.SelectedValue + ";");
                    sb.Append(rblCreditType.SelectedValue + ";");

                    for (int k = 0; k < dgrReport.Items[i].Cells.Count; k++)
                    {
                        string text = dgrReport.Items[i].Cells[k].Text;

                        if (text.Contains("span"))
                        {
                            string subs = text.Substring(text.IndexOf('>') + 1);
                            text = subs.Remove(subs.LastIndexOf('<'));
                        }

                        byte[] bytes = Encoding.Default.GetBytes(text);
                        text = Encoding.Default.GetString(bytes);

                        if (k == dgrReport.Items[i].Cells.Count - 1)
                        {
                            sb.Append(text);
                        }
                        else
                        {
                            sb.Append(text + ';');
                        }
                    }

                    sb.Append("\r\n");
                }

                Response.Output.Write(sb.ToString());
                Response.Flush();
                Response.Close();
                Response.End();
            }
            catch (Exception ex)
            {
                System.Web.UI.LiteralControl errorMessage = new System.Web.UI.LiteralControl();
                errorMessage.Text = ex.Message;

                ltrMessage.Text = ex.Message;
            }
        }
        protected void cblProduct_SelectedIndexChanged(object sender, EventArgs e)
        {
            ltrMessage.Text = "";

            cbxProductType.Checked = false;
            cbxWarranty.Checked    = false;
            cbxTerm.Checked        = false;
            cbxPeriod.Checked      = false;

            cblProductType.Items.Clear();
            cblWarranty.Items.Clear();
            cblTerm.Items.Clear();
            cblPeriod.Items.Clear();

            try
            {
                foreach (ListItem item in rblProduct.Items)
                {
                    if (item.Selected)
                    {
                        List <Product> products =
                            SharePointConnector.GetProductTypes(item.Value, rblCreditType.SelectedValue);
                        List <Warranty> warranties =
                            SharePointConnector.GetWarranties(item.Value, rblCreditType.SelectedValue);
                        List <Term> terms =
                            SharePointConnector.GetTerms(item.Value, rblCreditType.SelectedValue, null, rblBanx.SelectedValue);
                        List <Period> periods =
                            SharePointConnector.GetPeriods(item.Value, rblCreditType.SelectedValue, null, rblBanx.SelectedValue);

                        cblProductType.Items.Add(new ListItem(item.Value, "", false));
                        cblWarranty.Items.Add(new ListItem(item.Value, "", false));
                        cblTerm.Items.Add(new ListItem(item.Value, "", false));
                        cblPeriod.Items.Add(new ListItem(item.Value, "", false));

                        foreach (Product product in products)
                        {
                            cblProductType.Items.Add(new ListItem(product.Name, product.Id.ToString()));
                        }
                        foreach (Warranty warranty in warranties)
                        {
                            cblWarranty.Items.Add(new ListItem(warranty.Name, warranty.Id.ToString()));
                        }
                        foreach (Term term in terms)
                        {
                            cblTerm.Items.Add(new ListItem(term.Display, term.Name));
                        }
                        foreach (Period period in periods)
                        {
                            cblPeriod.Items.Add(new ListItem(period.Display, period.Name));
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                System.Web.UI.LiteralControl errorMessage = new System.Web.UI.LiteralControl();
                errorMessage.Text = ex.Message;

                ltrMessage.Text = ex.Message;
            }
        }
        private static Control[] ParseControlsInternalHelper(DesignTimeParseData data, bool returnFirst)
        {
            TemplateParser parser = new PageParser();

            parser.FInDesigner  = true;
            parser.DesignerHost = data.DesignerHost;
            parser.DesignTimeDataBindHandler = data.DataBindingHandler;
            parser.Text = data.ParseText;
            parser.Parse();

            ArrayList parsedControls = new ArrayList();
            ArrayList subBuilders    = parser.RootBuilder.SubBuilders;

            if (subBuilders != null)
            {
                // Look for the first control builder
                IEnumerator en = subBuilders.GetEnumerator();

                for (int i = 0; en.MoveNext(); i++)
                {
                    object cur = en.Current;

                    if ((cur is ControlBuilder) && !(cur is CodeBlockBuilder))
                    {
                        // Instantiate the control
                        ControlBuilder controlBuilder = (ControlBuilder)cur;

                        System.Diagnostics.Debug.Assert(controlBuilder.CurrentFilterResolutionService == null);

                        IServiceProvider builderServiceProvider = null;

                        // If there's a designer host, use it as the service provider
                        if (data.DesignerHost != null)
                        {
                            builderServiceProvider = data.DesignerHost;
                        }
                        // If it doesn't exist, use a default ---- filter resolution service
                        else
                        {
                            ServiceContainer serviceContainer = new ServiceContainer();
                            serviceContainer.AddService(typeof(IFilterResolutionService), new SimpleDesignTimeFilterResolutionService(data.Filter));
                            builderServiceProvider = serviceContainer;
                        }

                        controlBuilder.SetServiceProvider(builderServiceProvider);
                        try {
                            Control control = (Control)controlBuilder.BuildObject(data.ShouldApplyTheme);
                            parsedControls.Add(control);
                        }
                        finally {
                            controlBuilder.SetServiceProvider(null);
                        }
                        if (returnFirst)
                        {
                            break;
                        }
                    }
                    // To preserve backwards compatibility, we don't add LiteralControls
                    // to the control collection when parsing for a single control
                    else if (!returnFirst && (cur is string))
                    {
                        LiteralControl literalControl = new LiteralControl(cur.ToString());
                        parsedControls.Add(literalControl);
                    }
                }
            }

            data.SetUserControlRegisterEntries(parser.UserControlRegisterEntries, parser.TagRegisterEntries);

            return((Control[])parsedControls.ToArray(typeof(Control)));
        }
        internal static MasterPage CreateMaster(TemplateControl owner, HttpContext context,
                                                VirtualPath masterPageFile, IDictionary contentTemplateCollection)
        {
            Debug.Assert(owner is MasterPage || owner is Page);

            MasterPage master = null;

            if (masterPageFile == null)
            {
                if (contentTemplateCollection != null && contentTemplateCollection.Count > 0)
                {
                    throw new HttpException(SR.GetString(SR.Content_only_allowed_in_content_page));
                }

                return(null);
            }

            // If it's relative, make it *app* relative.  Treat is as relative to this
            // user control (ASURT 55513)
            VirtualPath virtualPath = VirtualPathProvider.CombineVirtualPathsInternal(
                owner.TemplateControlVirtualPath, masterPageFile);

            // Compile the declarative control and get its Type
            ITypedWebObjectFactory result = (ITypedWebObjectFactory)BuildManager.GetVPathBuildResult(
                context, virtualPath);

            // Make sure it has the correct base type
            if (!typeof(MasterPage).IsAssignableFrom(result.InstantiatedType))
            {
                throw new HttpException(SR.GetString(SR.Invalid_master_base,
                                                     masterPageFile));
            }

            master = (MasterPage)result.CreateInstance();

            master.TemplateControlVirtualPath = virtualPath;

            if (owner.HasControls())
            {
                foreach (Control control in owner.Controls)
                {
                    LiteralControl literal = control as LiteralControl;
                    if (literal == null || Util.FirstNonWhiteSpaceIndex(literal.Text) >= 0)
                    {
                        throw new HttpException(SR.GetString(SR.Content_allowed_in_top_level_only));
                    }
                }

                // Remove existing controls.
                owner.Controls.Clear();
            }

            // Make sure the control collection is writable.
            if (owner.Controls.IsReadOnly)
            {
                throw new HttpException(SR.GetString(SR.MasterPage_Cannot_ApplyTo_ReadOnly_Collection));
            }

            if (contentTemplateCollection != null)
            {
                foreach (String contentName in contentTemplateCollection.Keys)
                {
                    if (!master.ContentPlaceHolders.Contains(contentName.ToLower(CultureInfo.InvariantCulture)))
                    {
                        throw new HttpException(SR.GetString(SR.MasterPage_doesnt_have_contentplaceholder, contentName, masterPageFile));
                    }
                }
                master._contentTemplates = contentTemplateCollection;
            }

            master._ownerControl = owner;
            master.InitializeAsUserControl(owner.Page);
            owner.Controls.Add(master);
            return(master);
        }
예제 #55
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="control"></param>
        /// note: made public so that RAMP project can use it!
        public static void ClearDataGridControls(System.Web.UI.Control control)
        {
            // translated from VB: http://forums.asp.net/p/466278/466278.aspx
            for (int i = control.Controls.Count - 1; i >= 0; i--)
            {
                ClearDataGridControls(control.Controls[i]);
            }

            if (!(control is System.Web.UI.WebControls.TableCell))
            {
                Type t = control.GetType();
                if (t.GetProperty("SelectedItem") != null)
                {
                    System.Web.UI.LiteralControl literal = new System.Web.UI.LiteralControl();
                    control.Parent.Controls.Add(literal);
                    try
                    {
                        literal.Text = t.GetProperty("SelectedItem").GetValue(control, null).ToString();
                    }
                    catch
                    { }
                    control.Parent.Controls.Remove(control);
                }
                else if (t.GetProperty("Text") != null)
                {
                    System.Web.UI.LiteralControl literal = new System.Web.UI.LiteralControl();
                    control.Parent.Controls.Add(literal);
                    try
                    {
                        literal.Text = t.GetProperty("Text").GetValue(control, null).ToString();
                    }
                    catch
                    { }
                    control.Parent.Controls.Remove(control);
                }
                else if (control is LinkButton)
                {
                    control.Parent.Controls.Add(new LiteralControl((control as LinkButton).Text));
                    control.Parent.Controls.Remove(control);
                }
                else if (control is ImageButton)
                {
                    control.Parent.Controls.Add(new LiteralControl((control as ImageButton).AlternateText));
                    control.Parent.Controls.Remove(control);
                }
                else if (control is HyperLink)
                {
                    control.Parent.Controls.Add(new LiteralControl((control as HyperLink).Text));
                    control.Parent.Controls.Remove(control);
                }
                else if (control is DropDownList)
                {
                    control.Parent.Controls.Add(new LiteralControl((control as DropDownList).SelectedItem.Text));
                    control.Parent.Controls.Remove(control);
                }
                else if (control is CheckBox)
                {
                    control.Parent.Controls.Add(new LiteralControl((control as CheckBox).Checked ? "True" : "False"));
                    control.Parent.Controls.Remove(control);
                }
            }
        } //