Ejemplo n.º 1
0
    private void BindSearchResult()
    {
        List<IPublishable> items = Search.Hits(SearchTerm, false);
        int max = 1;
        foreach (IPublishable item in items)
        {
            HtmlAnchor link = new HtmlAnchor();
            link.InnerHtml = item.Title;
            link.HRef = item.RelativeLink.ToString();
            divSearchResult.Controls.Add(link);

            if (!string.IsNullOrEmpty(item.Description))
            {
                HtmlGenericControl desc = new HtmlGenericControl("span");
                desc.InnerHtml = item.Description;

                divSearchResult.Controls.Add(new LiteralControl("<br />"));
                divSearchResult.Controls.Add(desc);
            }

            divSearchResult.Controls.Add(new LiteralControl("<br />"));
            max++;
            if (max == 3)
                break;
        }
    }
Ejemplo n.º 2
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;
    }
    protected void GridTeachers_RowDataBound(object sender, GridViewRowEventArgs e)
    {
        if (e.Row.RowType == DataControlRowType.DataRow)
        {
            HtmlAnchor aPages = e.Row.Cells[0].FindControl("aPages") as HtmlAnchor;
            PlaceHolder ltTchs = e.Row.Cells[1].FindControl("ltTchs") as PlaceHolder;
            HtmlAnchor aMore = e.Row.Cells[0].FindControl("aMore") as HtmlAnchor;
            Field fd = e.Row.DataItem as Field;
            if (fd != null)
            {
                aPages.HRef = aMore.HRef = Utils.AbsoluteWebRoot + @"TeacherList.aspx?fid=" + fd.Id;
                int num = 0;
                foreach (MembershipUser user in Membership.GetAllUsers())
                {
                    AuthorProfile ap = AuthorProfile.GetProfile(user.UserName);
                    if (ap!=null && ap.IsTeacher && !ap.IsAdmin && ap.IsPrivate && ap.Fields.Contains(fd.Id.ToString()) && num<9)
                    {
                        HtmlAnchor aTch = new HtmlAnchor();
                        aTch.HRef = Utils.AbsoluteWebRoot + @"Views\TeacherView.aspx?uid=" + ap.UserName;
                        aTch.Title = ap.DisplayName;
                        aTch.InnerText = StripString(ap.DisplayName, 4);
                        //aTch.Style.Add(HtmlTextWriterStyle.Color, "#333333");
                        ltTchs.Controls.Add(aTch);

                        Literal lt = new Literal();
                        lt.Text = " ";
                        ltTchs.Controls.Add(lt);
                        num++;
                    }
                }
            }
        }
    }
Ejemplo n.º 4
0
    private void BindMenu()
    {
        SiteMapNode root = SiteMap.Providers["SecuritySiteMap"].RootNode;
        if (root != null)
        {
            foreach (SiteMapNode adminNode in root.ChildNodes)
            {
                if (adminNode.IsAccessibleToUser(HttpContext.Current))
                {
                    if (!Request.RawUrl.ToUpperInvariant().Contains("/ADMIN/") && (adminNode.Url.Contains("xmanager") || adminNode.Url.Contains("PingServices")))
                        continue;

                    HtmlAnchor a = new HtmlAnchor();
                    a.HRef = adminNode.Url;

                    a.InnerHtml = "<span>" + Utils.Translate(adminNode.Title, adminNode.Title) + "</span>";//"<span>" + Utils.Translate(info.Name.Replace(".aspx", string.Empty)) + "</span>";
                    if (Request.RawUrl.IndexOf(adminNode.Url, StringComparison.OrdinalIgnoreCase) != -1)
                        a.Attributes["class"] = "current";

                    // if "page" has its own subfolder (comments, extensions) should
                    // select parent tab when navigating through child tabs
                    if (adminNode.Url.IndexOf("/admin/pages/", StringComparison.OrdinalIgnoreCase) == -1 && SubUrl(Request.RawUrl) == SubUrl(adminNode.Url))
                        a.Attributes["class"] = "current";

                    HtmlGenericControl li = new HtmlGenericControl("li");
                    li.Controls.Add(a);
                    ulMenu.Controls.Add(li);
                }
            }
        }

        if (!Request.RawUrl.ToUpperInvariant().Contains("/ADMIN/"))
            AddItem(Resources.labels.changePassword, Utils.RelativeWebRoot + "login.aspx");
    }
Ejemplo n.º 5
0
    private void BindMenu()
    {
        SiteMapNode root = SiteMap.Providers["SecuritySiteMap"].RootNode;
        if (root != null)
        {
            foreach (SiteMapNode adminNode in root.ChildNodes)
            {
                if (adminNode.IsAccessibleToUser(HttpContext.Current))
                {
                    if (!Request.RawUrl.ToUpperInvariant().Contains("/ADMIN/") && (adminNode.Url.Contains("xmanager") || adminNode.Url.Contains("PingServices")))
                        continue;

                    HtmlAnchor a = new HtmlAnchor();
                    a.HRef = adminNode.Url;

                    a.InnerHtml = "<span>" + Translate(adminNode.Title) + "</span>";//"<span>" + Translate(info.Name.Replace(".aspx", string.Empty)) + "</span>";
                    if (Request.RawUrl.EndsWith(adminNode.Url, StringComparison.OrdinalIgnoreCase))
                        a.Attributes["class"] = "current";
                    HtmlGenericControl li = new HtmlGenericControl("li");
                    li.Controls.Add(a);
                    ulMenu.Controls.Add(li);
                }
            }
        }

        if (!Request.RawUrl.ToUpperInvariant().Contains("/ADMIN/"))
            AddItem(Resources.labels.changePassword, Utils.RelativeWebRoot + "login.aspx");
    }
Ejemplo n.º 6
0
    public override void LoadWidget()
    {
        StringDictionary settings = GetSettings();
        XmlDocument doc = new XmlDocument();

        if (settings["content"] != null)
          doc.InnerXml = settings["content"];

        XmlNodeList links = doc.SelectNodes("//link");

        if (links.Count == 0)
        {
            ulLinks.Visible = false;
        }
        else
        {
            foreach (XmlNode node in links)
            {
                HtmlAnchor a = new HtmlAnchor();

                if (node.Attributes["url"] != null)
                    a.HRef = node.Attributes["url"].InnerText;

                if (node.Attributes["title"] != null)
                    a.InnerText = node.Attributes["title"].InnerText;

                if (node.Attributes["newwindow"] != null && node.Attributes["newwindow"].InnerText.Equals("true", StringComparison.OrdinalIgnoreCase))
                    a.Target = "_blank";

                HtmlGenericControl li = new HtmlGenericControl("li");
                li.Controls.Add(a);
                ulLinks.Controls.Add(li);
            }
        }
    }
Ejemplo n.º 7
0
 public void AddItem(string text, string url)
 {
     HtmlAnchor a = new HtmlAnchor();
     a.InnerHtml = "<span>" + text + "</span>";
     a.HRef = url;
     HtmlGenericControl li = new HtmlGenericControl("li");
     li.Controls.Add(a);
     ulMenu.Controls.Add(li);
 }
Ejemplo n.º 8
0
 public static string GetHtml(HtmlAnchor part, bool designMode)
 {
     StringBuilder sb = new StringBuilder();
     if (designMode)
         sb.Append(@"<span class=""label""><i class=""n2-icon-anchor""></i> ");
     sb.AppendFormat(@"<a name=""{0}"" />", part.Title);
     if (designMode)
         sb.Append("</span>");
     return sb.ToString();
 }
Ejemplo n.º 9
0
    public void AddItem(string text, string url, HtmlGenericControl uParent)
    {
        HtmlAnchor a = new HtmlAnchor();
        a.InnerHtml =   text ;
        a.HRef = url;

        HtmlGenericControl li = new HtmlGenericControl("li");
        li.Controls.Add(a);
        uParent.Controls.Add(li);
    }
Ejemplo n.º 10
0
	private void AddCategoryToMenu(string title)
	{
		HtmlAnchor a = new HtmlAnchor();
		a.InnerHtml = Server.HtmlEncode(title);
		a.HRef = "#" + Utils.RemoveIllegalCharacters(title);
		a.Attributes.Add("rel", "directory");

		HtmlGenericControl li = new HtmlGenericControl("li");
		li.Controls.Add(a);
		ulMenu.Controls.Add(li);
	}
Ejemplo n.º 11
0
	private void AddCategoryToMenu(string title)
	{
		HtmlAnchor a = new HtmlAnchor();
		a.InnerHtml = Server.HtmlEncode(title);
		a.HRef = string.Format("{0}archive{1}#cat-{2}", Blog.CurrentInstance.RelativeWebRoot, BlogConfig.FileExtension, Utils.RemoveIllegalCharacters(title));
		a.Attributes.Add("rel", "directory");

		HtmlGenericControl li = new HtmlGenericControl("li");
		li.Controls.Add(a);
		ulMenu.Controls.Add(li);
	}
Ejemplo n.º 12
0
    private void CreateAdminMenu()
    {
        foreach (Category cat in Category.Categories)
        {
          HtmlAnchor a = new HtmlAnchor();
          a.InnerHtml = cat.Title;
          a.HRef = "#" + SupportUtilities.RemoveIllegalCharacters(cat.Title);
          a.Attributes.Add("rel", "directory");

          HtmlGenericControl li = new HtmlGenericControl("li");
          li.Controls.Add(a);
          ulMenu.Controls.Add(li);
        }
    }
Ejemplo n.º 13
0
    private void BindPageList()
    {
        foreach (Page page in Thon.ZaszBlog.Support.CodedRepresentations.Page.Pages)
        {
            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);
            ulPages.Controls.Add(li);
        }

        divPages.Visible = true;
        aPages.InnerHtml = Thon.ZaszBlog.Support.CodedRepresentations.Page.Pages.Count + " Pages";
    }
Ejemplo n.º 14
0
    private static HtmlGenericControl CreateRowHeader(Guid id, string name, int count)
    {
        HtmlAnchor feed = new HtmlAnchor();
        feed.HRef = Utils.RelativeWebRoot + "category/syndication.axd?category=" + id.ToString();

        HtmlImage img = new HtmlImage();
        img.Src = Utils.RelativeWebRoot + "pics/rssbutton.gif";
        img.Alt = "RSS";

        feed.Controls.Add(img);

        HtmlGenericControl h2 = new HtmlGenericControl("h2");
        h2.Attributes["id"] = Utils.RemoveIllegalCharacters(name);
        h2.Controls.Add(feed);

        Control header = new LiteralControl(name + " (" + count + ")");
        h2.Controls.Add(header);
        return h2;
    }
Ejemplo n.º 15
0
    private static HtmlGenericControl CreateRowHeader(Category cat, string name, int count)
    {
        HtmlGenericControl h2 = new HtmlGenericControl("h2");
        h2.Attributes["id"] = "cat-" + Utils.RemoveIllegalCharacters(name);

        if (cat != null)
        {
            HtmlAnchor feed = new HtmlAnchor();
            feed.HRef = cat.FeedRelativeLink;

            HtmlImage img = new HtmlImage();
            img.Src = Utils.RelativeWebRoot + "pics/rssButton.png";
            img.Alt = "RSS";
            feed.Controls.Add(img);
            h2.Controls.Add(feed);
        }

        Control header = new LiteralControl(name + " (" + count + ")");
        h2.Controls.Add(header);
        return h2;
    }
    private void CreateSubMenu(List<SandlerWeb.MenuItem> items)
    {
        HtmlAnchor link;
        Literal pipeLiteral;

        foreach (SandlerWeb.MenuItem item in items)
        {
            if (item.IsVisible)
            {
                link = new HtmlAnchor();
                link.InnerText = item.Text;
                link.HRef = item.Link;
                pnlSubMenu.Controls.Add(link);
                if (items.Last() != item)
                {
                    pipeLiteral = new Literal();
                    pipeLiteral.Text = " | ";
                    pnlSubMenu.Controls.Add(pipeLiteral);
                }
            }
        }
    }
Ejemplo n.º 17
0
    protected void Page_Load(object sender, EventArgs e)
    {
        int count = 0;
        //at init , the caller assigne the categories
        // then this dude populates the category links dynamically
        if (Categories != null)
        {
            foreach (var item in Categories)
            {
                count++;
                //new link

                HtmlAnchor a = new HtmlAnchor();
                a.InnerText = item.Name;
                a.HRef = "../Default.aspx?categ=" + item.Id;
                if (count % 2 == 0)
                {
                    evenLinks.Controls.Add(a);
                }
                else
                    oddLinks.Controls.Add(a);
            }
        }
    }
Ejemplo n.º 18
0
 public static HtmlAnchor GetHtmlAnchor(string aTxtValue, string aLinkUrl, Dictionary<object, object> iDica)
 {
     HtmlAnchor oTmpLink = new HtmlAnchor();
     oTmpLink.InnerText = aTxtValue;
     oTmpLink.HRef = aLinkUrl;
     if (iDica != null)
     {
         if ((aLinkUrl.LastIndexOf("?") + 1) != aLinkUrl.Length)
         {
             oTmpLink.HRef = aLinkUrl + "?";
         }
         object[] linkKeys = new object[iDica.Keys.Count];
         iDica.Keys.CopyTo(linkKeys, 0);
         string sTmpUrlParameter = "";
         for (int i = 0; i < linkKeys.Length; i++)
         {
             object tmpParamValue = null;
             if (iDica.TryGetValue(linkKeys[i], out tmpParamValue))
             {
                 sTmpUrlParameter += string.Concat(linkKeys[i].ToString(), "=", tmpParamValue);
             }
             else
             {
                 throw new Exception();
             }
             if (i < linkKeys.Length - 1)
             {
                 sTmpUrlParameter += "&";
             }
         }
         oTmpLink.HRef += sTmpUrlParameter;
     }
     return oTmpLink;
     //Ht
     //oTmpLink.Controls.Add(
 }
 public static void ShowRefreshBtn(LinkButton coverBtn, HtmlAnchor refreshBtn)
 {
     refreshBtn.Attributes["class"] = refreshBtn.Attributes["class"].Replace("display-none", "");
     coverBtn.CssClass += " display-none";
 }
Ejemplo n.º 20
0
 public void MostrarTab(HtmlAnchor link, HtmlGenericControl controle)
 {
     link.Attributes.Remove("class");
     controle.Attributes.Remove("class");
     controle.Attributes.Add("class", "panel-collapse in");
 }
Ejemplo n.º 21
0
        private static string ParseImpl(XmlNode node, PageInfo pageInfo, ContextInfo contextInfo, HtmlAnchor stlAnchor, string type, string emptyText, string tipText, int wordNum, bool isKeyboard)
        {
            string parsedContent;

            string successTemplateString;
            string failureTemplateString;

            StlParserUtility.GetYesOrNoTemplateString(node, pageInfo, out successTemplateString, out failureTemplateString);

            if (string.IsNullOrEmpty(successTemplateString))
            {
                var nodeInfo = NodeManager.GetNodeInfo(pageInfo.PublishmentSystemId, contextInfo.ChannelId);

                if (type.ToLower().Equals(TypePreviousChannel.ToLower()) || type.ToLower().Equals(TypeNextChannel.ToLower()))
                {
                    var taxis         = nodeInfo.Taxis;
                    var isNextChannel = !StringUtils.EqualsIgnoreCase(type, TypePreviousChannel);
                    var siblingNodeId = DataProvider.NodeDao.GetNodeIdByParentIdAndTaxis(nodeInfo.ParentId, taxis, isNextChannel);
                    if (siblingNodeId != 0)
                    {
                        var siblingNodeInfo = NodeManager.GetNodeInfo(pageInfo.PublishmentSystemId, siblingNodeId);
                        var url             = PageUtility.GetChannelUrl(pageInfo.PublishmentSystemInfo, siblingNodeInfo);
                        if (url.Equals(PageUtils.UnclickedUrl))
                        {
                            stlAnchor.Target = string.Empty;
                        }
                        stlAnchor.HRef = url;

                        if (string.IsNullOrEmpty(node.InnerXml))
                        {
                            stlAnchor.InnerHtml = NodeManager.GetNodeName(pageInfo.PublishmentSystemId, siblingNodeId);
                            if (wordNum > 0)
                            {
                                stlAnchor.InnerHtml = StringUtils.MaxLengthText(stlAnchor.InnerHtml, wordNum);
                            }
                        }
                        else
                        {
                            contextInfo.ChannelId = siblingNodeId;
                            var innerBuilder = new StringBuilder(node.InnerXml);
                            StlParserManager.ParseInnerContent(innerBuilder, pageInfo, contextInfo);
                            stlAnchor.InnerHtml = innerBuilder.ToString();
                        }
                    }
                }
                else if (type.ToLower().Equals(TypePreviousContent.ToLower()) || type.ToLower().Equals(TypeNextContent.ToLower()))
                {
                    if (contextInfo.ContentId != 0)
                    {
                        var taxis            = contextInfo.ContentInfo.Taxis;
                        var isNextContent    = !StringUtils.EqualsIgnoreCase(type, TypePreviousContent);
                        var tableStyle       = NodeManager.GetTableStyle(pageInfo.PublishmentSystemInfo, contextInfo.ChannelId);
                        var tableName        = NodeManager.GetTableName(pageInfo.PublishmentSystemInfo, contextInfo.ChannelId);
                        var siblingContentId = BaiRongDataProvider.ContentDao.GetContentId(tableName, contextInfo.ChannelId, taxis, isNextContent);
                        if (siblingContentId != 0)
                        {
                            var siblingContentInfo = DataProvider.ContentDao.GetContentInfo(tableStyle, tableName, siblingContentId);
                            var url = PageUtility.GetContentUrl(pageInfo.PublishmentSystemInfo, siblingContentInfo);
                            if (url.Equals(PageUtils.UnclickedUrl))
                            {
                                stlAnchor.Target = string.Empty;
                            }
                            stlAnchor.HRef = url;

                            if (isKeyboard)
                            {
                                var keyCode       = isNextContent ? 39 : 37;
                                var scriptContent = new StringBuilder();
                                pageInfo.AddPageScriptsIfNotExists(PageInfo.Components.Jquery);
                                scriptContent.Append($@"<script language=""javascript"" type=""text/javascript""> 
      $(document).keydown(function(event){{
        if(event.keyCode=={keyCode}){{location = '{url}';}}
      }});
</script> 
");
                                var nextOrPrevious = isNextContent ? "nextContent" : "previousContent";
                                pageInfo.SetPageScripts(nextOrPrevious, scriptContent.ToString(), true);
                            }

                            if (string.IsNullOrEmpty(node.InnerXml))
                            {
                                stlAnchor.InnerHtml = siblingContentInfo.Title;
                                if (wordNum > 0)
                                {
                                    stlAnchor.InnerHtml = StringUtils.MaxLengthText(stlAnchor.InnerHtml, wordNum);
                                }
                            }
                            else
                            {
                                var innerBuilder = new StringBuilder(node.InnerXml);
                                contextInfo.ContentId = siblingContentId;
                                StlParserManager.ParseInnerContent(innerBuilder, pageInfo, contextInfo);
                                stlAnchor.InnerHtml = innerBuilder.ToString();
                            }
                        }
                    }
                }

                parsedContent = string.IsNullOrEmpty(stlAnchor.HRef) ? emptyText : ControlUtils.GetControlRenderHtml(stlAnchor);
            }
            else
            {
                var nodeInfo = NodeManager.GetNodeInfo(pageInfo.PublishmentSystemId, contextInfo.ChannelId);

                var isSuccess      = false;
                var theContextInfo = contextInfo.Clone();

                if (type.ToLower().Equals(TypePreviousChannel.ToLower()) || type.ToLower().Equals(TypeNextChannel.ToLower()))
                {
                    var taxis         = nodeInfo.Taxis;
                    var isNextChannel = !StringUtils.EqualsIgnoreCase(type, TypePreviousChannel);
                    var siblingNodeId = DataProvider.NodeDao.GetNodeIdByParentIdAndTaxis(nodeInfo.ParentId, taxis, isNextChannel);
                    if (siblingNodeId != 0)
                    {
                        isSuccess = true;
                        theContextInfo.ContextType = EContextType.Channel;
                        theContextInfo.ChannelId   = siblingNodeId;
                    }
                }
                else if (type.ToLower().Equals(TypePreviousContent.ToLower()) || type.ToLower().Equals(TypeNextContent.ToLower()))
                {
                    if (contextInfo.ContentId != 0)
                    {
                        var taxis            = contextInfo.ContentInfo.Taxis;
                        var isNextContent    = !StringUtils.EqualsIgnoreCase(type, TypePreviousContent);
                        var tableName        = NodeManager.GetTableName(pageInfo.PublishmentSystemInfo, contextInfo.ChannelId);
                        var siblingContentId = BaiRongDataProvider.ContentDao.GetContentId(tableName, contextInfo.ChannelId, taxis, isNextContent);
                        if (siblingContentId != 0)
                        {
                            isSuccess = true;
                            theContextInfo.ContextType = EContextType.Content;
                            theContextInfo.ContentId   = siblingContentId;
                            theContextInfo.ContentInfo = null;
                        }
                    }
                }

                parsedContent = isSuccess ? successTemplateString : failureTemplateString;

                if (!string.IsNullOrEmpty(parsedContent))
                {
                    var innerBuilder = new StringBuilder(parsedContent);
                    StlParserManager.ParseInnerContent(innerBuilder, pageInfo, theContextInfo);

                    parsedContent = innerBuilder.ToString();
                }
            }

            parsedContent = tipText + parsedContent;

            return(parsedContent);
        }
Ejemplo n.º 22
0
        protected override void AttachChildControls()
        {
            this.rptCartProducts = (VshopTemplatedRepeater)this.FindControl("rptCartProducts");
            this.rptCartProducts.ItemDataBound += new RepeaterItemEventHandler(this.rptCartProducts_ItemDataBound);
            this.rptCartPointProducts           = (VshopTemplatedRepeater)this.FindControl("rptCartPointProducts");
            this.litTotal      = (Literal)this.FindControl("litTotal");
            this.litTotalPoint = (Literal)this.FindControl("litTotalPoint");
            this.litStoreMoney = (Literal)this.FindControl("litStoreMoney");
            this.litExemption  = (Literal)this.FindControl("litExemption");
            this.litcount      = (Literal)this.FindControl("litcount");
            this.divShowTotal  = (HtmlGenericControl)this.FindControl("divShowTotal");
            this.aLink         = (HtmlAnchor)this.FindControl("aLink");
            this.Page.Session["stylestatus"] = "0";
            this.litExemption.Text           = "0.00";
            this.cart      = ShoppingCartProcessor.GetShoppingCartAviti(0);
            this.cartPoint = ShoppingCartProcessor.GetShoppingCartAviti(1);
            if (this.cart != null)
            {
                this.rptCartProducts.DataSource = this.cart;
                this.rptCartProducts.DataBind();
                int num = 0;
                for (int i = 0; i < this.cart.Count; i++)
                {
                    num += this.cart[i].LineItems.Count;
                }
                this.litcount.Text = num.ToString();
            }
            if (this.cartPoint != null)
            {
                this.rptCartPointProducts.DataSource = this.cartPoint;
                this.rptCartPointProducts.DataBind();
            }
            if ((this.cart != null) || (this.cartPoint != null))
            {
                this.aLink.HRef = "/Vshop/SubmmitOrder.aspx";
            }
            else
            {
                this.aLink.Attributes.Add("onclick", "alert_h('购物车中没有需要结算的商品!');");
            }
            decimal num3 = 0M;

            if (this.cart != null)
            {
                foreach (ShoppingCartInfo info in this.cart)
                {
                    num3 += info.GetAmount();
                }
            }
            int num4 = 0;

            if (this.cartPoint != null)
            {
                foreach (ShoppingCartInfo info2 in this.cartPoint)
                {
                    num4 += info2.GetTotalPoint();
                }
            }
            PageTitle.AddSiteNameTitle("购物车");
            this.litStoreMoney.Text = "¥" + num3.ToString("0.00");
            this.litTotal.Text      = "¥" + ((num3 - this.ReductionMoneyALL)).ToString("0.00");
            this.litTotalPoint.Text = num4.ToString();
        }
Ejemplo n.º 23
0
    protected void dlproduct_ItemDataBound(object sender, DataListItemEventArgs e)
    {
        if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem)
        {
            LinkButton lbcart          = e.Item.FindControl("lbaddcart") as LinkButton;
            HtmlAnchor lbindevisi      = (HtmlAnchor)e.Item.FindControl("indevisi");
            Label      ISINDI          = (Label)e.Item.FindControl("ISINDI");
            Label      LBPURPOSEOFPROC = (Label)e.Item.FindControl("LBPURPOSEOFPROC");
            if (dtCart.Rows.Count > 0)
            {
                HiddenField hf = (HiddenField)e.Item.FindControl("hfr");
                for (int i = 0; dtCart.Rows.Count > i; i++)
                {
                    if (dtCart.Rows[i]["ProductRefNo"].ToString() == hf.Value)
                    {
                        lbcart.Text = "Successfully Added";
                    }
                    lbcart.Attributes.Remove("Class");
                    lbcart.Attributes.Add("Class", "btn btn-success btn-sm btn-block");
                }
            }
            Label lblepold   = (Label)e.Item.FindControl("lblepold");
            Label lblepold17 = (Label)e.Item.FindControl("lblepold17");
            Label lblepold18 = (Label)e.Item.FindControl("lblepold18");
            Label lblepfu    = (Label)e.Item.FindControl("lblepfu");


            if (Encrypt.DecryptData(Request.QueryString["msort"].ToString()) == "2019-20")
            {
                lblepold.Visible   = true;
                lblepfu.Visible    = false;
                lblepold17.Visible = false;
                lblepold18.Visible = false;
            }
            else if (Encrypt.DecryptData(Request.QueryString["msort"].ToString()) == "2018-19")
            {
                lblepold.Visible   = false;
                lblepfu.Visible    = false;
                lblepold17.Visible = false;
                lblepold18.Visible = true;
            }
            else if (Encrypt.DecryptData(Request.QueryString["msort"].ToString()) == "2017-18")
            {
                lblepold.Visible   = false;
                lblepfu.Visible    = false;
                lblepold17.Visible = true;
                lblepold18.Visible = false;
            }
            else if (Encrypt.DecryptData(Request.QueryString["msort"].ToString()) == "2020-21")
            {
                lblepold.Visible   = false;
                lblepfu.Visible    = true;
                lblepold17.Visible = false;
                lblepold18.Visible = false;
            }
            if (LBPURPOSEOFPROC.Text == "58264" || LBPURPOSEOFPROC.Text == "58270")
            {
                lbcart.Enabled = false;
                lbcart.Text    = "View Only";
            }
            else
            {
                lbcart.Enabled = true;
            }
            if (ISINDI.Text == "Y")
            {
                lbindevisi.Visible = true;
                lbcart.Enabled     = false;
                lbcart.Text        = "View Only";
            }
            else
            {
                lbindevisi.Visible = false;
                lbcart.Enabled     = true;
            }
            lbcart.CssClass = "btn btn-sm btn-block text-white";
        }
    }
Ejemplo n.º 24
0
        public void TestMethod_editDImandatoryFields()
        {
            readData();

            CommonFunctions.Login(myManager, _username, _password, _url);

            myManager.ActiveBrowser.Window.Maximize();

            // -- End of Login ---

            ObjMenus menus = new ObjMenus(myManager);

            HtmlListItem system = menus.systemlink.As <HtmlListItem>();

            system.MouseHover();

            myManager.ActiveBrowser.RefreshDomTree();

            Thread.Sleep(2000);
            myManager.ActiveBrowser.RefreshDomTree();

            HtmlAnchor users = menus.userslink.As <HtmlAnchor>();

            users.MouseClick();

            Thread.Sleep(2000);
            myManager.ActiveBrowser.RefreshDomTree();

            Element bottomcontent = myManager.ActiveBrowser.Find.ByXPath("//*[@id='body']/div/div/table[2]/thead/tr[1]/th[2]");

            myManager.ActiveBrowser.Actions.ScrollToVisible(bottomcontent);

            Thread.Sleep(2000);
            myManager.ActiveBrowser.RefreshDomTree();

            // Search DI user to Edit

            ObjEditDIuser objeditdiuser = new ObjEditDIuser(myManager);

            HtmlTable DItable = objeditdiuser.ditable.As <HtmlTable>();

            HtmlInputText operid = objeditdiuser.searchoperatorid.As <HtmlInputText>();

            operid.Text = _searchoperatorid;

            myManager.Desktop.Mouse.Click(MouseClickType.LeftClick, operid.GetRectangle());
            myManager.Desktop.KeyBoard.KeyPress(System.Windows.Forms.Keys.Enter);

            Thread.Sleep(2000);
            myManager.ActiveBrowser.RefreshDomTree();

            // Select one DI user

            HtmlInputCheckBox firstrowcheck = objeditdiuser.row1.As <HtmlInputCheckBox>();

            firstrowcheck.Check(true);

            Element editbutton = objeditdiuser.editdibtn;

            myManager.ActiveBrowser.Actions.Click(editbutton);

            Thread.Sleep(2000);
            myManager.ActiveBrowser.RefreshDomTree();

            HtmlInputText  oprid = objeditdiuser.operatoridtxt.As <HtmlInputText>();
            HtmlInputText  fn    = objeditdiuser.firstnametxt.As <HtmlInputText>();
            HtmlInputText  ln    = objeditdiuser.lastnametxt.As <HtmlInputText>();
            HtmlInputEmail em    = objeditdiuser.emailtxt.As <HtmlInputEmail>();
            HtmlInputText  phn   = objeditdiuser.phonetxt.As <HtmlInputText>();

            oprid.Text = "";
            fn.Text    = "";
            ln.Text    = "";
            em.Text    = "";
            phn.Text   = "";

            Element oprMandatory = objeditdiuser.opridMandatoryMsg;

            Assert.IsTrue(oprMandatory.InnerText.Contains("Operator ID is mandatory."));

            Element fnMandatory = objeditdiuser.fnMandatoryMsg;

            Assert.IsTrue(fnMandatory.InnerText.Contains("First name is mandatory."));

            Element lnMandatory = objeditdiuser.lnMandatoryMsg;

            Assert.IsTrue(lnMandatory.InnerText.Contains("Last name is mandatory"));

            Element emailMandatory = objeditdiuser.emailMandatoryMsg;

            Assert.IsTrue(emailMandatory.InnerText.Contains("Email is mandatory"));

            Element phoneMandatory = objeditdiuser.phoneMandatoryMsg;

            Assert.IsTrue(phoneMandatory.InnerText.Contains("Phone number is mandatory"));

            Thread.Sleep(2000);
        }
Ejemplo n.º 25
0
    private void BindTags()
    {
        System.Collections.Generic.List<string> col = new System.Collections.Generic.List<string>();
        foreach (Post post in Post.Posts)
        {
            foreach (string tag in post.Tags)
            {
                if (!col.Contains(tag))
                    col.Add(tag);
            }
        }

        col.Sort(delegate(string s1, string s2) { return String.Compare(s1, s2); });

        foreach (string tag in col)
        {
            HtmlAnchor a = new HtmlAnchor();
            a.HRef = "javascript:void(0)";
            a.Attributes.Add("onclick", "AddTag(this)");
            a.InnerText = tag;
            phTags.Controls.Add(a);
        }
    }
Ejemplo n.º 26
0
    protected void Page_Load(object sender, EventArgs e)
    {  
		var id = Request.QueryString["id"];

    	var href = Request.QueryString["page"];
    	href = Regex.Replace(href, @"\(W\(\d+\)\)", "");
		
  
		var u = new Uri(href);
		var path = u.PathAndQuery.Split('?').First();
		//var filePath = HostingEnvironment.MapPath(path);
    	
    	var baseHref = "http://127.0.0.1:8081/?path=";
    	var cmd = Request.QueryString["cmd"];

    	var n = new PXCodeNavigator(path, id, cmd);
		
    	foreach (CodeLine codeLine in n.Result)
    	{

			if (codeLine.FilePath == null)
			{
				continue;

			}

			//this.MenuContainer.Controls.Add(new LiteralControl(codeLine.Description + " "));
    		var a = new HtmlAnchor
    		        	{
    		        		Target = "MenuAction",
							InnerText = codeLine.Description,
							Title = codeLine.Hint,
							HRef = baseHref + HttpUtility.UrlPathEncode(codeLine.FilePath)

    		        	};
			a.Attributes.Add("onclick", "window.parent.ClosePageInfo();");
			a.Attributes.Add("class", "PageInfoMenuItem");

			if(codeLine.Line.HasValue)
				a.HRef += "&line=" + codeLine.Line.Value;


			MenuContainer.Controls.Add(a);

			//this.MenuContainer.Controls.Add(new LiteralControl("<br/>"));
    	}



		
			

    }
Ejemplo n.º 27
0
        /// <summary>
        /// Format RSDN URLs to hyperlinks.
        /// Used in both, explicitly &amp; implicitly specified links.
        /// </summary>
        /// <param name="urlMatch">Regex match with URL address.</param>
        /// <param name="link">HtmlLink, initialized by default</param>
        /// <returns>true - processed by formatter itself, no further processing</returns>
        protected virtual bool FormatRsdnURLs(Match urlMatch, HtmlAnchor link)
        {
            var urlScheme = urlMatch.Groups["scheme"];
            var urlHostname = urlMatch.Groups["hostname"];
            var originalScheme = urlScheme.Success ? urlScheme.Value : Uri.UriSchemeHttp;

            Action<String> rsdnHostReplacer =
                delegate(string urlHost)
                    {
                        var schemeMatchStart = (urlScheme.Success ? urlScheme.Index : urlMatch.Index);
                        link.HRef =
                            (((HttpContext.Current != null) && HttpContext.Current.Request.IsSecureConnection)
                             	?
                             		Uri.UriSchemeHttps
                             	: originalScheme) + (urlScheme.Success ? null : "://") +
                            link.HRef.Substring(schemeMatchStart - urlMatch.Index + urlScheme.Length,
                                                urlHostname.Index - schemeMatchStart - urlScheme.Length) +
                            urlHost +
                            link.HRef.Substring(urlHostname.Index - urlMatch.Index + urlHostname.Length);
                    };

            IDictionary<string, ThreadStart> rsdnSchemesProcessing =
                new Dictionary<string, ThreadStart>(3, StringComparer.OrdinalIgnoreCase);

            // redirect rsdn svn
            rsdnSchemesProcessing["svn"] =
                (() => rsdnHostReplacer("svn.rsdn.ru"));

            // rebase only http or https links
            rsdnSchemesProcessing[Uri.UriSchemeHttp] =
                rsdnSchemesProcessing[Uri.UriSchemeHttps] =
                (() => rsdnHostReplacer(CanonicalRsdnHostName));

            if (rsdnSchemesProcessing.ContainsKey(originalScheme))
                rsdnSchemesProcessing[originalScheme]();

            AddClass(link, "m");
            if (_openRsdnLinksInNewWindow)
                link.Target = "_blank";

            return true;
        }
Ejemplo n.º 28
0
  private void AddLayerToLegend(string mapTabId, List<CommonLayer> configuredLayers, List<LayerProperties> layerProperties, HtmlGenericControl container, CommonLayer layer)
  {
    int i = configuredLayers.IndexOf(layer);

    if (i < 0)
    {
      return;
    }

    int tileWidth = AppSettings.SwatchTileWidth;
    int tileHeight = AppSettings.SwatchTileHeight;
    bool expanded = AppSettings.LegendExpanded;

    HtmlGenericControl legendEntry = new HtmlGenericControl("div");
    container.Controls.Add(legendEntry);
    legendEntry.Attributes["class"] = "LegendEntry";

    HtmlGenericControl legendHeader = new HtmlGenericControl("div");
    legendEntry.Controls.Add(legendHeader);
    legendHeader.Attributes["class"] = "LegendHeader";

    HtmlGenericControl expander = new HtmlGenericControl("span");
    legendHeader.Controls.Add(expander);
    expander.Attributes["class"] = "LegendExpander " + (expanded ? "Expanded" : "Collapsed");

    if (layerProperties[i].CheckMode != CheckMode.None)
    {
      HtmlGenericControl visibility = new HtmlGenericControl("span");
      legendHeader.Controls.Add(visibility);
      visibility.Attributes["class"] = "LegendVisibility";

      if (layerProperties[i].CheckMode != CheckMode.Empty)
      {
        HtmlControl check = null;

        if (layerProperties[i].IsExclusive)
        {
          HtmlInputRadioButton radio = new HtmlInputRadioButton();
          radio.Checked = layerProperties[i].CheckMode == CheckMode.Checked;
          radio.Name = String.Format("{0}_{1}", mapTabId, layer.Parent.ID);
          check = radio;
        }
        else
        {
          HtmlInputCheckBox checkBox = new HtmlInputCheckBox();
          checkBox.Checked = layerProperties[i].CheckMode == CheckMode.Checked;
          check = checkBox;
        }

        visibility.Controls.Add(check);
        check.Attributes["class"] = "LegendCheck";
        check.Attributes["data-layer"] = layerProperties[i].Tag;
      }
    }

    HtmlGenericControl name = new HtmlGenericControl("span");
    legendHeader.Controls.Add(name);
    name.Attributes["class"] = "LegendName";

    if (!String.IsNullOrEmpty(layerProperties[i].MetaDataUrl))
    {
      HtmlAnchor a = new HtmlAnchor();
      name.Controls.Add(a);
      a.HRef = layerProperties[i].MetaDataUrl;
      a.Target = "metadata";
      a.InnerText = layerProperties[i].Name;
      a.Attributes["class"] = "LegendMetadata";
    }
    else
    {
      name.InnerText = layerProperties[i].Name;
    }

    HtmlGenericControl content = new HtmlGenericControl("div");
    content.Attributes["class"] = "LegendContent";
    content.Style["display"] = expanded ? "block" : "none";

    switch (layer.Type)
    {
      case CommonLayerType.Group:
        if (layer.Children != null)
        {
          foreach (CommonLayer childLayer in layer.Children)
          {
            AddLayerToLegend(mapTabId, configuredLayers, layerProperties, content, childLayer);
          }
        }
        break;

      case CommonLayerType.Feature:
        int layerIndex = layer.DataFrame.Layers.IndexOf(layer);

        if (layer.Legend != null)
        {
          int n = 0;
          string escapedMapTabId = Server.UrlEncode(mapTabId);

          for (int g = 0; g < layer.Legend.Groups.Count; ++g)
          {
            int classCount = layer.Legend.Groups[g].Classes.Count;

            for (int c = 0; c < classCount; ++c)
            {
              if (!layer.Legend.Groups[g].Classes[c].ImageIsTransparent)
              {
                HtmlGenericControl legendClass = new HtmlGenericControl("div");
                content.Controls.Add(legendClass);
                legendClass.Attributes["class"] = "LegendClass";

                HtmlGenericControl legendSwatch = new HtmlGenericControl("span");
                legendClass.Controls.Add(legendSwatch);
                legendSwatch.Attributes["class"] = "LegendSwatch";
                legendSwatch.Style["background"] = String.Format("transparent url(CompiledSwatch.ashx?maptab={0}&c={1}) no-repeat scroll -{2}px -{3}px",
                  escapedMapTabId, AppContext.ConfigurationKey, tileWidth * layerIndex, tileHeight * n);

                using (MemoryStream stream = new MemoryStream(layer.Legend.Groups[g].Classes[c].Image))
                {
                  using (Bitmap swatch = new Bitmap(stream))
                  {
                    legendClass.Style["height"] = String.Format("{0}px", swatch.Height);
                    legendSwatch.Style["width"] = String.Format("{0}px", swatch.Width);
                    legendSwatch.Style["height"] = String.Format("{0}px", swatch.Height);
                  }
                }

                if (classCount > 1 || layer.Legend.Groups.Count > 1)
                {
                  HtmlGenericControl className = new HtmlGenericControl("span");
                  legendClass.Controls.Add(className);
                  className.Attributes["class"] = "LegendClassName";
                  className.InnerText = layer.Legend.Groups[g].Classes[c].Label;
                }
              }

              n += 1;
            }
          }
        }
        break;

      case CommonLayerType.Annotation:
        if (layer.Children != null)
        {
          foreach (CommonLayer childLayer in layer.Children)
          {
            AddLayerToLegend(mapTabId, configuredLayers, layerProperties, content, childLayer);
          }
        }
        break;
    }

    if (content.Controls.Count == 0)
    {
      expander.Attributes["class"] = "LegendExpander Empty";
    }
    else
    {
      legendEntry.Controls.Add(content);
    }
  }
Ejemplo n.º 29
0
    private void BindPageList(Curricula crl, HtmlGenericControl ulPages, HtmlGenericControl divPages, HtmlAnchor aPages)
    {
        foreach (CurriculaInfo info in crl.CurriculaInfos)
        {
            HtmlGenericControl li = new HtmlGenericControl("li");
            HtmlGenericControl span = new HtmlGenericControl("span");
            //HtmlAnchor a = new HtmlAnchor();
            //a.HRef = "?infoid=" + info.Id.ToString();
            //a.InnerHtml = info.StartDate.ToString("yyyy年MM月dd") + "-" + info.EndDate.ToString("dd日");

            span.InnerText = info.StartDate.ToString("yyyy年MM月dd日") + "-" + info.EndDate.ToString("MM月dd日") +
                " (" + info.CityTown + "  ¥" + info.Cast + ") ";
            span.Attributes.CssStyle.Add("color", "#F3660E");
            //span.Attributes.CssStyle.Add("",)
            //System.Web.UI.LiteralControl text = new System.Web.UI.LiteralControl
            //(" (<span style='color:#F3660E;'>" + info.CityTown + "  ¥" + info.Cast + "<span>) ");

            string deleteText = string.Format(labels.areYouSure, labels.delete.ToLower(), "课程安排"); ;
            HtmlAnchor delete = new HtmlAnchor();
            delete.InnerText = Resources.labels.delete;
            delete.Attributes["onclick"] = "if (confirm('" + deleteText + "')){location.href='?delete=" + info.Id + "'}";
            delete.HRef = "javascript:void(0);";
            delete.Style.Add(System.Web.UI.HtmlTextWriterStyle.FontWeight, "normal");

            li.Controls.Add(span);
            //li.Controls.Add(text);
            li.Controls.Add(delete);

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

            ulPages.Controls.Add(li);
        }

        divPages.Visible = true;
        aPages.InnerHtml = crl.CurriculaInfos.Count + " 课程安排";
    }
    protected object gridElem_OnExternalDataBound(object sender, string sourceName, object parameter)
    {
        if (!RequestHelper.IsPostBack())
        {
            return string.Empty;
        }

        // Handle the grid action first because it doesn't require access to VariantsStatisticsData
        if (sourceName == "selectwinner")
        {
            var gridViewRow = parameter as GridViewRow;
            if (gridViewRow != null)
            {
                var dataRowView = gridViewRow.DataItem as DataRowView;
                if (dataRowView != null)
                {
                    var img = sender as CMSGridActionButton;
                    if (img != null)
                    {
                        // Check permissions to select winner
                        if (!IsUserAuthorizedToManageTest)
                        {
                            img.Enabled = false;
                            img.ToolTip = GetString("abtesting.selectwinner.permission.tooltip");
                        }
                        else
                        {
                            var winner = GetTestWinner();
                            if (winner != null)
                            {
                                string variantName = (ValidationHelper.GetString(dataRowView["ABVariantName"], ""));
                                if (variantName == winner.ABVariantName)
                                {
                                    // Disable action image for the winning variant
                                    img.Enabled = false;
                                }
                                else
                                {
                                    // Hide action image for other variants
                                    img.Visible = false;
                                }
                            }
                        }
                    }
                }
            }
            return string.Empty;
        }

        string currentVariantName = parameter.ToString();

        if (String.IsNullOrEmpty(currentVariantName) || (OriginalVariant == null) || !VariantsStatisticsData.ContainsKey(currentVariantName))
        {
            return string.Empty;
        }

        var variantData = VariantsStatisticsData[currentVariantName];

        switch (sourceName)
        {
            case "name":
                var variant = ABVariants.FirstOrDefault(v => v.ABVariantName == currentVariantName);
                if (variant != null)
                {
                    var link = new HtmlAnchor();
                    link.InnerText = ResHelper.LocalizeString(variant.ABVariantDisplayName);
                    link.HRef = DocumentURLProvider.GetUrl(variant.ABVariantPath);
                    link.Target = "_blank";
                    return link;
                }
                break;

            case "conversionsovervisits":
                return variantData.ConversionsCount + " / " + variantData.Visits;

            case "chancetobeatoriginal":
                if ((currentVariantName != OriginalVariant.ABVariantName) && (VariantPerformanceCalculator != null) && (variantData.Visits > 0))
                {
                    double chanceToBeatOriginal = VariantPerformanceCalculator.GetChanceToBeatOriginal(variantData.ConversionsCount, variantData.Visits);

                    // Check whether the variant is most probably winning already and mark the row green
                    if ((chanceToBeatOriginal >= WINNING_VARIANT_MIN_CHANCETOBEAT) && (variantData.ConversionsCount >= WINNING_VARIANT_MIN_CONVERSIONS))
                    {
                        AddCSSToParentControl(sender as WebControl, "winning-variant-row");
                    }

                    return String.Format("{0:P2}", chanceToBeatOriginal);
                }
                break;

            case "conversionrate":
                if ((VariantPerformanceCalculator != null) && (variantData.Visits > 0)
                    && ABConversionRateIntervals.ContainsKey(currentVariantName) && ABConversionRateIntervals.ContainsKey(OriginalVariant.ABVariantName))
                {
                    // Render the picture representing how the challenger variant is performing against the original variant
                    return new ABConversionRateIntervalVisualizer(
                        mMinConversionRateLowerBound, mConversionRateRange, ABConversionRateIntervals[currentVariantName], ABConversionRateIntervals[OriginalVariant.ABVariantName]);
                }
                break;

            case "conversionvalue":
                return variantData.ConversionsValue;

            case "averageconversionvalue":
                return String.Format("{0:#.##}", variantData.AverageConversionValue);

            case "improvement":
                if ((currentVariantName != OriginalVariant.ABVariantName) && VariantsStatisticsData.ContainsKey(OriginalVariant.ABVariantName))
                {
                    var originalData = VariantsStatisticsData[OriginalVariant.ABVariantName];
                    switch (drpSuccessMetric.SelectedValue)
                    {
                        case "conversioncount":
                            if (!originalData.ConversionsCount.Equals(0))
                            {
                                return GetPercentageImprovementPanel((variantData.ConversionsCount / (double)originalData.ConversionsCount) - 1);
                            }
                            break;

                        case "conversionvalue":
                            if (!originalData.ConversionsValue.Equals(0))
                            {
                                return GetPercentageImprovementPanel((variantData.ConversionsValue / originalData.ConversionsValue) - 1);
                            }
                            break;

                        case "conversionrate":
                            if (!originalData.ConversionRate.Equals(0))
                            {
                                return GetPercentageImprovementPanel((variantData.ConversionRate / originalData.ConversionRate) - 1);
                            }
                            break;

                        case "averageconversionvalue":
                            if (!originalData.AverageConversionValue.Equals(0))
                            {
                                return GetPercentageImprovementPanel((variantData.AverageConversionValue / originalData.AverageConversionValue) - 1);
                            }
                            break;
                    }
                }
                break;
        }

        return string.Empty;
    }
Ejemplo n.º 31
0
        protected void listProduct_ItemDataBound(object sender, RepeaterItemEventArgs e)
        {
            if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem)
            {
                LineItemStatus lineItemStatus = (LineItemStatus)DataBinder.Eval(e.Item.DataItem, "Status");
                string         text           = (string)DataBinder.Eval(e.Item.DataItem, "StatusText");
                string         orderId        = (string)DataBinder.Eval(e.Item.DataItem, "OrderId");
                OrderInfo      orderInfo      = TradeHelper.GetOrderInfo(orderId);
                string         text2          = DataBinder.Eval(e.Item.DataItem, "SkuId").ToString();
                LineItemInfo   lineItemInfo   = orderInfo.LineItems[text2];
                if (lineItemStatus == LineItemStatus.Normal)
                {
                    text = TradeHelper.GetOrderItemSatusText(lineItemInfo.Status);
                }
                OrderStatus orderStatus = orderInfo.OrderStatus;
                DateTime    finishDate  = orderInfo.FinishDate;
                string      gateway     = orderInfo.Gateway;
                HtmlAnchor  htmlAnchor  = (HtmlAnchor)e.Item.FindControl("lkbtnAfterSalesApply");
                Label       label       = (Label)e.Item.FindControl("ItemLogistics");
                HtmlAnchor  htmlAnchor2 = (HtmlAnchor)e.Item.FindControl("lkbtnViewMessage");
                htmlAnchor.Attributes.Add("OrderId", orderInfo.OrderId);
                htmlAnchor.Attributes.Add("SkuId", text2);
                htmlAnchor.Attributes.Add("GateWay", gateway);
                ReplaceInfo replaceInfo = lineItemInfo.ReplaceInfo;
                ReturnInfo  returnInfo  = lineItemInfo.ReturnInfo;
                Literal     literal     = (Literal)e.Item.FindControl("litStatusText");
                if (literal != null && (replaceInfo != null || returnInfo != null))
                {
                    if (returnInfo != null)
                    {
                        if (returnInfo.AfterSaleType == AfterSaleTypes.OnlyRefund)
                        {
                            literal.Text = "<a href=\"UserReturnsApplyDetails?ReturnsId=" + returnInfo.ReturnId + "\" class=\"aslink\">" + EnumDescription.GetEnumDescription((Enum)(object)lineItemStatus, 3) + "</a>";
                        }
                        else
                        {
                            literal.Text = "<a href=\"UserReturnsApplyDetails?ReturnsId=" + returnInfo.ReturnId + "\" class=\"aslink\">" + EnumDescription.GetEnumDescription((Enum)(object)lineItemStatus, 2) + "</a>";
                        }
                    }
                    else
                    {
                        literal.Text = "<a href=\"UserReplaceApplyDetails?ReplaceId=" + replaceInfo.ReplaceId + "\" class=\"aslink\">" + EnumDescription.GetEnumDescription((Enum)(object)lineItemStatus, 2) + "</a>";
                    }
                }
                SiteSettings masterSettings = SettingsManager.GetMasterSettings();
                HtmlAnchor   htmlAnchor3    = htmlAnchor;
                int          visible;
                if (orderInfo.OrderType != OrderType.ServiceOrder)
                {
                    switch (orderStatus)
                    {
                    case OrderStatus.Finished:
                        visible = ((!orderInfo.IsServiceOver) ? 1 : 0);
                        break;

                    default:
                        visible = 0;
                        break;

                    case OrderStatus.SellerAlreadySent:
                        visible = 1;
                        break;
                    }
                }
                else
                {
                    visible = 0;
                }
                htmlAnchor3.Visible = ((byte)visible != 0);
                if (htmlAnchor.Visible)
                {
                    htmlAnchor.Visible = ((returnInfo == null || returnInfo.HandleStatus == ReturnStatus.Refused) && (replaceInfo == null || replaceInfo.HandleStatus == ReplaceStatus.Refused || replaceInfo.HandleStatus == ReplaceStatus.Replaced));
                }
            }
        }
Ejemplo n.º 32
0
        /// <summary>
        /// The bind menu.
        /// </summary>
        private void BindMenu()
        {
            var sitemap = SiteMap.Providers["SecuritySiteMap"];

            if (sitemap != null)
            {
                string adminRootFolder = string.Format("{0}admin", Utils.RelativeWebRoot);

                var root = sitemap.RootNode;
                if (root != null)
                {
                    foreach (
                        var adminNode in
                        root.ChildNodes.Cast <SiteMapNode>().Where(
                            adminNode => adminNode.IsAccessibleToUser(HttpContext.Current)).Where(
                            adminNode =>
                            Request.RawUrl.ToUpperInvariant().Contains("/ADMIN/") ||
                            (!adminNode.Url.Contains("xmanager") && !adminNode.Url.Contains("PingServices"))))
                    {
                        var a = new HtmlAnchor
                        {
                            // replace the RelativeWebRoot in adminNode.Url with the RelativeWebRoot of the current
                            // blog instance.  So a URL like /admin/Dashboard.aspx becomes /blog/admin/Dashboard.aspx.
                            HRef      = Utils.RelativeWebRoot + adminNode.Url.Substring(Utils.ApplicationRelativeWebRoot.Length),
                            InnerHtml =
                                string.Format("<span>{0}</span>", Utils.Translate(adminNode.Title, adminNode.Title))
                        };

                        // "<span>" + Utils.Translate(info.Name.Replace(".aspx", string.Empty)) + "</span>";
                        var startIndx = adminNode.Url.LastIndexOf("/admin/") > 0 ? adminNode.Url.LastIndexOf("/admin/") : 0;
                        var endIndx   = adminNode.Url.LastIndexOf(".") > 0 ? adminNode.Url.LastIndexOf(".") : adminNode.Url.Length;
                        var nodeDir   = adminNode.Url.Substring(startIndx, endIndx - startIndx);

                        if (Request.RawUrl.IndexOf(nodeDir, StringComparison.OrdinalIgnoreCase) != -1)
                        {
                            a.Attributes["class"] = "current";
                        }

                        // if "page" has its own subfolder (comments, extensions) should
                        // select parent tab when navigating through child tabs
                        if (!SubUrl(Request.RawUrl, true).Equals(adminRootFolder, StringComparison.OrdinalIgnoreCase) &&
                            SubUrl(Request.RawUrl, true) == SubUrl(adminNode.Url, false))
                        {
                            a.Attributes["class"] = "current";
                        }

                        var li = new HtmlGenericControl("li");
                        li.Controls.Add(a);
                        ulMenu.Controls.Add(li);
                    }
                }
            }

            if (!Request.RawUrl.ToUpperInvariant().Contains("/ADMIN/"))
            {
                AddItem(
                    labels.myProfile, string.Format("{0}admin/Users/Profile.aspx?id={1}", Utils.RelativeWebRoot, HttpUtility.UrlPathEncode(Security.CurrentUser.Identity.Name)));

                AddItem(
                    labels.changePassword, string.Format("{0}Account/change-password.aspx", Utils.RelativeWebRoot));
            }
        }
Ejemplo n.º 33
0
	private void BindPaging(int results, int page)
	{
        if (results <= PAGE_SIZE)
        {
            return;
        }

		decimal pages = Math.Ceiling((decimal)results / (decimal)PAGE_SIZE);

		HtmlGenericControl ul = new HtmlGenericControl("ul");
		ul.Attributes.Add("class", "paging");
        string q = Server.HtmlEncode(Request.QueryString["q"]);
        string comment = Request.QueryString["comment"];

		for (int i = 0; i < pages; i++)
		{
			HtmlGenericControl li = new HtmlGenericControl("li");
			if (i == page)
			{
				li.Attributes.Add("class", "active");
			}

			HtmlAnchor a = new HtmlAnchor();
			a.InnerHtml = (i + 1).ToString();

			string comm = comment;
			if (comm != null)
			{
				comm = "&amp;comment=true";
			}

            a.HRef = "?q=" + q + comm + "&amp;page=" + (i + 1);

			li.Controls.Add(a);
			ul.Controls.Add(li);
		}
		Paging.Controls.Add(ul);
	}
        protected void rptAgencies_ItemDataBound(object sender, RepeaterItemEventArgs e)
        {
            if (e.Item.DataItem is vAgency)
            {
                vAgency   agency  = (vAgency)e.Item.DataItem;
                HyperLink hplName = e.Item.FindControl("hplName") as HyperLink;
                if (hplName != null)
                {
                    hplName.Text        = agency.Name;
                    hplName.NavigateUrl = string.Format("AgencyView.aspx{0}&AgencyId={1}", GetBaseQueryString(), agency.Id);
                }

                HtmlAnchor aName = e.Item.FindControl("aName") as HtmlAnchor;
                if (aName != null)
                {
                    aName.InnerHtml = agency.Name;
                    aName.Attributes.CssStyle.Add("cursor", "pointer");

                    string script = string.Format("Done('{0}','{1}')", agency.Name.Replace("'", @"\'"), agency.Id);
                    aName.Attributes.Add("onclick", script);
                }

                HyperLink hplEdit = e.Item.FindControl("hplEdit") as HyperLink;
                if (hplEdit != null)
                {
                    hplEdit.NavigateUrl = string.Format("AgencyEdit.aspx{0}&AgencyId={1}", GetBaseQueryString(), agency.Id);
                }

                Literal litRole = e.Item.FindControl("litRole") as Literal;
                if (litRole != null)
                {
                    var hyperLink = e.Item.FindControl("hplPriceSetting") as HyperLink;
                    if (hyperLink != null)
                    {
                        if (agency.Role != null)
                        {
                            litRole.Text      = agency.Role.Name;
                            hyperLink.Visible = false;
                        }
                        else
                        {
                            litRole.Text      = "Customize Role";
                            hyperLink.Visible = true;
                        }
                    }
                    else
                    {
                        Debug.WriteLine("hplPriceSetting = null");
                    }
                }

                Literal litContract = e.Item.FindControl("litContract") as Literal;
                if (litContract != null)
                {
                    switch (agency.ContractStatus)
                    {
                    case 0:
                        litContract.Text = @"No contract";
                        break;

                    case 1:
                        litContract.Text = @"Expired";
                        break;

                    case 2:
                        litContract.Text = @"Contract in valid";
                        break;

                    case 3:
                        litContract.Text = @"Expire soon";
                        break;

                    case 4:
                        litContract.Text = @"Contract sent";
                        break;
                    }
                }

                var trItem = e.Item.FindControl("trItem") as HtmlTableRow;
                if (trItem != null)
                {
                    switch (agency.ContractStatus)
                    {
                    case 0:     // No contract
                        trItem.Attributes.Add("class", "danger");
                        break;

                    case 1:     // Contract expired
                        trItem.Attributes.Add("class", "active");
                        break;

                    case 2:     // Có hợp đồng và chưa hết hạn trong vòng 30 ngày
                        trItem.Attributes.Add("class", "success");
                        break;

                    case 3:     // Có hợp đồng nhưng sẽ hết hạn trong vòng 30 ngày
                        trItem.Attributes.Add("class", "warning");
                        break;

                    case 4:
                        trItem.Attributes.CssStyle.Add("background-color", "greenyellow");
                        break;
                    }
                }

                if (agency.ContractStatus != 0)
                {
                    if (string.IsNullOrEmpty(agency.Contract))
                    {
                        HyperLink hplContract = e.Item.FindControl("hplContract") as HyperLink;
                        if (hplContract != null)
                        {
                            hplContract.Visible = false;
                        }
                    }
                    else
                    {
                        HyperLink hplContract = e.Item.FindControl("hplContract") as HyperLink;
                        if (hplContract != null)
                        {
                            hplContract.Text        = @"[View]";
                            hplContract.NavigateUrl = agency.Contract;
                        }
                    }
                }

                ValueBinder.BindLiteral(e.Item, "litPayment", agency.PaymentPeriod);

                var litIndex = e.Item.FindControl("litIndex") as Literal;
                if (litIndex != null)
                {
                    litIndex.Text = (e.Item.ItemIndex + pagerBookings.PageSize * pagerBookings.CurrentPageIndex + 1) + ".";
                }

                var litSale = e.Item.FindControl("litSale") as Literal;
                if (litSale != null)
                {
                    if (agency.Sale != null)
                    {
                        litSale.Text = agency.Sale.UserName;
                    }
                }

                var hplPriceSetting = e.Item.FindControl("hplPriceSetting") as HyperLink;
                if (hplPriceSetting != null)
                {
                    hplPriceSetting.NavigateUrl =
                        string.Format("PriceConfiguration.aspx?NodeId={0}&SectionId={1}&agentid={2}", Node.Id, Section.Id,
                                      agency.Id);
                }

                HtmlTableCell tdLastBooking = e.Item.FindControl("tdLastBooking") as HtmlTableCell;
                if (tdLastBooking != null)
                {
                    if (agency.LastBooking.HasValue)
                    {
                        tdLastBooking.InnerHtml = string.Format("{0} (<a href='{1}'>list</a>) ",
                                                                agency.LastBooking.Value.ToString("dd/MM/yyyy"),
                                                                string.Format(
                                                                    "BookingList.aspx?NodeId={0}&SectionId={1}&ai={2}",
                                                                    Node.Id, Section.Id, agency.Id));
                    }
                    else
                    {
                        tdLastBooking.InnerText = "Never";
                    }
                }
            }
        }
Ejemplo n.º 35
0
 /// <summary>
 /// Process RSDN partneship links.
 /// </summary>
 /// <param name="urlMatch"></param>
 /// <param name="link"></param>
 protected static bool ProcessPartnerLink(Match urlMatch, HtmlAnchor link)
 {
     var uriBuilder = new UriBuilder(link.HRef);
     var queryBuilder = new QueryBuilder(uriBuilder.Query);
     var partnerRecord = _partnresIDs[uriBuilder.Host];
     queryBuilder[partnerRecord.QueryParameter] = partnerRecord.PartnerID;
     uriBuilder.Query = HttpUtility.HtmlEncode(queryBuilder.ToString());
     link.HRef = uriBuilder.Uri.AbsoluteUri;
     return false;
 }
Ejemplo n.º 36
0
        void rptrAddresses_ItemDataBound(object sender, RepeaterItemEventArgs e)
        {
            if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem)
            {
                var groupLocation = e.Item.DataItem as GroupLocation;
                if (groupLocation != null && groupLocation.Location != null)
                {
                    Location loc = groupLocation.Location;

                    HtmlAnchor aMap = e.Item.FindControl("aMap") as HtmlAnchor;
                    if (aMap != null)
                    {
                        aMap.HRef = loc.GoogleMapLink(Person.FullName);
                    }

                    LinkButton lbGeocode = e.Item.FindControl("lbGeocode") as LinkButton;
                    if (lbGeocode != null)
                    {
                        if (Rock.Address.GeocodeContainer.Instance.Components.Any(c => c.Value.Value.IsActive))
                        {
                            lbGeocode.Visible         = true;
                            lbGeocode.CommandName     = "geocode";
                            lbGeocode.CommandArgument = loc.Id.ToString();

                            if (loc.GeocodedDateTime.HasValue)
                            {
                                lbGeocode.ToolTip = string.Format("{0} {1}",
                                                                  loc.GeoPoint.Latitude,
                                                                  loc.GeoPoint.Longitude);
                            }
                            else
                            {
                                lbGeocode.ToolTip = "Geocode Address";
                            }
                        }
                        else
                        {
                            lbGeocode.Visible = false;
                        }
                    }

                    LinkButton lbStandardize = e.Item.FindControl("lbStandardize") as LinkButton;
                    if (lbStandardize != null)
                    {
                        if (Rock.Address.StandardizeContainer.Instance.Components.Any(c => c.Value.Value.IsActive))
                        {
                            lbStandardize.Visible         = true;
                            lbStandardize.CommandName     = "standardize";
                            lbStandardize.CommandArgument = loc.Id.ToString();

                            if (loc.StandardizedDateTime.HasValue)
                            {
                                lbStandardize.ToolTip = "Address Standardized";
                            }
                            else
                            {
                                lbStandardize.ToolTip = "Standardize Address";
                            }
                        }
                        else
                        {
                            lbStandardize.Visible = false;
                        }
                    }

                    if (!string.IsNullOrWhiteSpace(loc.Street2))
                    {
                        PlaceHolder phStreet2 = e.Item.FindControl("phStreet2") as PlaceHolder;
                        if (phStreet2 != null)
                        {
                            phStreet2.Controls.Add(new LiteralControl(string.Format("{0}</br>", loc.Street2)));
                        }
                    }
                }
            }
        }
Ejemplo n.º 37
0
    protected object gridElem_OnExternalDataBound(object sender, string sourceName, object parameter)
    {
        if (!RequestHelper.IsPostBack())
        {
            return(string.Empty);
        }

        // Handle the grid action first because it doesn't require access to VariantsStatisticsData
        if (sourceName == "selectwinner")
        {
            var gridViewRow = parameter as GridViewRow;
            if (gridViewRow != null)
            {
                var dataRowView = gridViewRow.DataItem as DataRowView;
                if (dataRowView != null)
                {
                    var img = sender as CMSGridActionButton;
                    if (img != null)
                    {
                        // Check permissions to select winner
                        if (!IsUserAuthorizedToManageTest)
                        {
                            img.Enabled = false;
                            img.ToolTip = GetString("abtesting.selectwinner.permission.tooltip");
                        }
                        else
                        {
                            var winner = GetTestWinner();
                            if (winner != null)
                            {
                                string variantName = (ValidationHelper.GetString(dataRowView["ABVariantName"], ""));
                                if (variantName == winner.ABVariantName)
                                {
                                    // Disable action image for the winning variant
                                    img.Enabled = false;
                                }
                                else
                                {
                                    // Hide action image for other variants
                                    img.Visible = false;
                                }
                            }
                        }
                    }
                }
            }
            return(string.Empty);
        }

        string currentVariantName = parameter.ToString();

        if (String.IsNullOrEmpty(currentVariantName) || (OriginalVariant == null) || !VariantsStatisticsData.ContainsKey(currentVariantName))
        {
            return(string.Empty);
        }

        var variantData = VariantsStatisticsData[currentVariantName];

        switch (sourceName)
        {
        case "name":
            var variant = ABVariants.FirstOrDefault(v => v.ABVariantName == currentVariantName);
            if (variant != null)
            {
                var link = new HtmlAnchor();
                link.InnerText = ResHelper.LocalizeString(variant.ABVariantDisplayName);
                link.HRef      = DocumentURLProvider.GetUrl(variant.ABVariantPath);
                link.Target    = "_blank";
                return(link);
            }
            break;

        case "conversionsovervisits":
            return(variantData.ConversionsCount + " / " + variantData.Visits);

        case "chancetobeatoriginal":
            if ((currentVariantName != OriginalVariant.ABVariantName) && (VariantPerformanceCalculator != null) && (variantData.Visits > 0))
            {
                double chanceToBeatOriginal = VariantPerformanceCalculator.GetChanceToBeatOriginal(variantData.ConversionsCount, variantData.Visits);

                // Check whether the variant is most probably winning already and mark the row green
                if ((chanceToBeatOriginal >= WINNING_VARIANT_MIN_CHANCETOBEAT) && (variantData.ConversionsCount >= WINNING_VARIANT_MIN_CONVERSIONS))
                {
                    AddCSSToParentControl(sender as WebControl, "winning-variant-row");
                }

                return(String.Format("{0:P2}", chanceToBeatOriginal));
            }
            break;

        case "conversionrate":
            if ((VariantPerformanceCalculator != null) && (variantData.Visits > 0) &&
                ABConversionRateIntervals.ContainsKey(currentVariantName) && ABConversionRateIntervals.ContainsKey(OriginalVariant.ABVariantName))
            {
                // Render the picture representing how the challenger variant is performing against the original variant
                return(new ABConversionRateIntervalVisualizer(
                           mMinConversionRateLowerBound, mConversionRateRange, ABConversionRateIntervals[currentVariantName], ABConversionRateIntervals[OriginalVariant.ABVariantName]));
            }
            break;

        case "conversionvalue":
            return(variantData.ConversionsValue);

        case "averageconversionvalue":
            return(String.Format("{0:#.##}", variantData.AverageConversionValue));

        case "improvement":
            if ((currentVariantName != OriginalVariant.ABVariantName) && VariantsStatisticsData.ContainsKey(OriginalVariant.ABVariantName))
            {
                var originalData = VariantsStatisticsData[OriginalVariant.ABVariantName];
                switch (drpSuccessMetric.SelectedValue)
                {
                case "conversioncount":
                    if (!originalData.ConversionsCount.Equals(0))
                    {
                        return(GetPercentageImprovementPanel((variantData.ConversionsCount / (double)originalData.ConversionsCount) - 1));
                    }
                    break;

                case "conversionvalue":
                    if (!originalData.ConversionsValue.Equals(0))
                    {
                        return(GetPercentageImprovementPanel((variantData.ConversionsValue / originalData.ConversionsValue) - 1));
                    }
                    break;

                case "conversionrate":
                    if (!originalData.ConversionRate.Equals(0))
                    {
                        return(GetPercentageImprovementPanel((variantData.ConversionRate / originalData.ConversionRate) - 1));
                    }
                    break;

                case "averageconversionvalue":
                    if (!originalData.AverageConversionValue.Equals(0))
                    {
                        return(GetPercentageImprovementPanel((variantData.AverageConversionValue / originalData.AverageConversionValue) - 1));
                    }
                    break;
                }
            }
            break;
        }

        return(string.Empty);
    }
Ejemplo n.º 38
0
        protected override void AttachChildControls()
        {
            this.litShipTo       = (Literal)this.FindControl("litShipTo");
            this.litCellPhone    = (Literal)this.FindControl("litCellPhone");
            this.litAddress      = (Literal)this.FindControl("litAddress");
            this.litShowMes      = (Literal)this.FindControl("litShowMes");
            this.GetUserCoupons  = MemberProcessor.GetUserCoupons();
            this.rptCartProducts = (VshopTemplatedRepeater)this.FindControl("rptCartProducts");
            this.rptCartProducts.ItemDataBound += new RepeaterItemEventHandler(this.rptCartProducts_ItemDataBound);
            this.litOrderTotal         = (Literal)this.FindControl("litOrderTotal");
            this.litPointNumber        = (Literal)this.FindControl("litPointNumber");
            this.litDisplayPointNumber = (Literal)this.FindControl("litDisplayPointNumber");
            this.aLinkToShipping       = (HtmlAnchor)this.FindControl("aLinkToShipping");
            this.groupbuyHiddenBox     = (HtmlInputControl)this.FindControl("groupbuyHiddenBox");
            this.rptAddress            = (VshopTemplatedRepeater)this.FindControl("rptAddress");

            //显示调用支付方式控件
            this.paymentTypeSel = (Common_PaymentTypeSelect)this.FindControl("paymenttypesel");
            paymentTypeSel.wid  = this.wid;

            this.selectShipTo  = (HtmlInputHidden)this.FindControl("selectShipTo");
            this.regionId      = (HtmlInputHidden)this.FindControl("regionId");
            this.litAddAddress = (Literal)this.FindControl("litAddAddress");



            IList <ShippingAddressInfo> shippingAddresses = MemberProcessor.GetShippingAddresses();

            this.rptAddress.DataSource = from item in shippingAddresses
                                         orderby item.IsDefault
                                         select item;

            this.rptAddress.DataBind();
            ShippingAddressInfo info = shippingAddresses.FirstOrDefault <ShippingAddressInfo>(item => item.IsDefault);

            if (info == null)
            {
                info = (shippingAddresses.Count > 0) ? shippingAddresses[0] : null;
            }
            if (info != null)
            {
                this.litShipTo.Text    = info.ShipTo;
                this.litCellPhone.Text = info.CellPhone;
                this.litAddress.Text   = info.Address;
                this.selectShipTo.SetWhenIsNotNull(info.ShippingId.ToString());
                this.regionId.SetWhenIsNotNull(info.RegionId.ToString());
            }
            this.litAddAddress.Text = " href='/Vshop/AddShippingAddress.aspx?returnUrl=" + Globals.UrlEncode(HttpContext.Current.Request.Url.ToString()) + "'";
            if ((shippingAddresses == null) || (shippingAddresses.Count == 0))
            {
                this.Page.Response.Redirect(Globals.ApplicationPath + "/Vshop/AddShippingAddress.aspx?returnUrl=" + Globals.UrlEncode(HttpContext.Current.Request.Url.ToString()));
            }
            else
            {
                this.aLinkToShipping.HRef = Globals.ApplicationPath + "/Vshop/ShippingAddresses.aspx?returnUrl=" + Globals.UrlEncode(HttpContext.Current.Request.Url.ToString());
                List <ShoppingCartInfo> listShoppingCart = new List <ShoppingCartInfo>();
                if (((int.TryParse(this.Page.Request.QueryString["buyAmount"], out this.buyAmount) && !string.IsNullOrEmpty(this.Page.Request.QueryString["productSku"])) && !string.IsNullOrEmpty(this.Page.Request.QueryString["from"])) && ((this.Page.Request.QueryString["from"] == "signBuy") || (this.Page.Request.QueryString["from"] == "groupBuy")))
                {
                    this.productSku  = this.Page.Request.QueryString["productSku"];
                    listShoppingCart = ShoppingCartProcessor.GetListShoppingCart(this.productSku, this.buyAmount);
                }
                else
                {
                    listShoppingCart = ShoppingCartProcessor.GetOrderSummitCart();
                }
                if (listShoppingCart == null)
                {
                    this.ShowMessage("没有需要结算的订单!", false);
                }
                else
                {
                    if (listShoppingCart.Count > 1)
                    {
                        this.litShowMes.Text = "<div style=\"color: #F60; \"><img  src=\"/Utility/pics/u77.png\">您所购买的商品不支持同一个物流规则发货,系统自动拆分成多个子订单处理</div>";
                    }
                    if (listShoppingCart != null)
                    {
                        this.rptCartProducts.DataSource = listShoppingCart;
                        this.rptCartProducts.DataBind();
                        decimal num  = 0M;
                        decimal num2 = 0M;
                        decimal num3 = 0M;
                        int     num4 = 0;
                        foreach (ShoppingCartInfo info2 in listShoppingCart)
                        {
                            num4 += info2.GetPointNumber;
                            num  += info2.Total;
                            num2 += info2.Exemption;
                            num3 += info2.ShipCost;
                        }
                        decimal num5 = num2;
                        this.litOrderTotal.Text = (num - num5).ToString("F2");
                        if (num4 == 0)
                        {
                            this.litDisplayPointNumber.Text = "style=\"display:none;\"";
                        }
                        this.litPointNumber.Text = num4.ToString();
                    }
                    else
                    {
                        this.Page.Response.Redirect("/Vshop/ShoppingCart.aspx");
                    }
                    PageTitle.AddSiteNameTitle("订单确认");
                }
            }
        }
Ejemplo n.º 39
0
        /// <summary>
        /// Handles the ItemDataBound event of the lvAttachments control.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="ListViewItemEventArgs"/> instance containing the event data.</param>
        protected void lvAttachments_ItemDataBound(object sender, ListViewItemEventArgs e)
        {
            if (e.Item.ItemType == ListViewItemType.DataItem)
            {
                dynamic media = e.Item.DataItem as dynamic;

                if (media.FileExtension == "HYPERLINK")//If it is a hyperlink,load hyperlink specific content.
                {
                    HtmlGenericControl divDocAttachments = (HtmlGenericControl)e.Item.FindControl("divDocAttachments");
                    divDocAttachments.Visible = false;
                    HtmlGenericControl divLinks = (HtmlGenericControl)e.Item.FindControl("divLinks");
                    divLinks.Visible = true;
                    HtmlAnchor link            = (HtmlAnchor)e.Item.FindControl("lblLinkURL");
                    LinkButton hyperlinkButton = (LinkButton)e.Item.FindControl("HyperLinkLinkButton");

                    hyperlinkButton.Enabled = !IsReadOnly;

                    hyperlinkButton.CommandArgument = media.DocumentMediaId.ToString();
                    string labelTxt = string.Empty;
                    if (media.Name != null && media.Name != string.Empty)
                    {
                        labelTxt  = media.Name;
                        link.HRef = media.Description;
                    }
                    else
                    {
                        labelTxt  = media.Description;
                        link.HRef = media.Description;
                    }

                    Label lblType       = (Label)e.Item.FindControl("lblType");
                    Label lblLinkedDate = (Label)e.Item.FindControl("lblLinkedDate");
                    Label lblLinkedBy   = (Label)e.Item.FindControl("lblLinkedBy");
                    HtmlGenericControl divDescription   = (HtmlGenericControl)e.Item.FindControl("divDescription");
                    HtmlGenericControl divLinkBlock     = (HtmlGenericControl)e.Item.FindControl("divLinkBlock");
                    HtmlGenericControl extraLinkDetails = (HtmlGenericControl)e.Item.FindControl("extraLinkDetails");

                    switch (Mode)  //Display and hide extra fields based on the mode
                    {
                    case DisplayMode.ItemBrief:
                        link.InnerText           = Support.TruncateString(labelTxt, 60);
                        link.Title               = labelTxt;
                        extraLinkDetails.Visible = false;
                        divDescription.Visible   = true;
                        break;

                    case DisplayMode.Project:
                        extraLinkDetails.Visible = true;
                        link.InnerText           = Support.TruncateString(labelTxt, 30);
                        link.Title             = labelTxt;
                        lblLinkedDate.Text     = string.Concat("Uploaded: ", Utils.FormatDate(media.LastUpdatedDate));
                        lblLinkedBy.Text       = Support.TruncateString(string.Concat("By: ", media.LastUpdatedBy), 35);
                        divDescription.Visible = false;
                        divLinks.Style.Add("Width", "400px");
                        divLinkBlock.Style.Add("Width", "200px");
                        break;
                    }
                }
                else
                {
                    ImageDisplay thumbAttachment = (ImageDisplay)e.Item.FindControl("thumbAttachment");
                    thumbAttachment.ImageTitle      = media.Name;
                    thumbAttachment.DocumentMediaId = media.DocumentMediaId;
                    thumbAttachment.IsThumbnail     = true;
                    LinkButton lnkbtnAttachment = (LinkButton)e.Item.FindControl("lnkbtnAttachment");
                    lnkbtnAttachment.Enabled         = false;
                    lnkbtnAttachment.CommandArgument = media.DocumentMediaId.ToString();

                    Label lblAttachmentName = (Label)e.Item.FindControl("lblAttachmentName");

                    Literal litAttachmentType = (Literal)e.Item.FindControl("litAttachmentType");
                    litAttachmentType.Text = media.FileExtension;

                    Label lblUploadedDate = (Label)e.Item.FindControl("lblUploadedDate");
                    Label lblUploadedBy   = (Label)e.Item.FindControl("lblUploadedBy");
                    HtmlGenericControl divAttachmentBlock = (HtmlGenericControl)e.Item.FindControl("divAttachmentBlock");
                    HtmlGenericControl divDocAttachments  = (HtmlGenericControl)e.Item.FindControl("divDocAttachments");
                    HtmlGenericControl extraDetails       = (HtmlGenericControl)e.Item.FindControl("extraDetails");
                    switch (Mode)
                    {
                    case DisplayMode.ItemBrief:
                        lblAttachmentName.Text = Support.TruncateString(media.Name, 50);
                        if (!string.IsNullOrEmpty(media.Name) && media.Name.Length > 50)
                        {
                            lblAttachmentName.ToolTip = media.Name;
                        }
                        CheckBox chkInclude = (CheckBox)e.Item.FindControl("chkInclude");
                        chkInclude.Enabled = !IsReadOnly && this.GetBL <InventoryBL>().CanEditIteminItemBrief(RelatedId);
                        if (media.SourceTable == "Item")
                        {
                            chkInclude.Enabled = false;
                            chkInclude.ToolTip = "These attachments are connected to this Item in the Inventory so they cannot be changed or removed";
                        }

                        chkInclude.Visible             = IsItemAllreadyExist;
                        chkInclude.Checked             = media.ItemBriefItemDocumentMediaId > 0;
                        thumbAttachment.FunctionPrefix = (media.SourceTable == "Item") ? "ReadOnlyModeDP" : "EditModeModeDP";
                        extraDetails.Visible           = false;
                        break;

                    case DisplayMode.Project:
                        lblAttachmentName.Text = Support.TruncateString(media.Name, 35);
                        if (!string.IsNullOrEmpty(media.Name) && media.Name.Length > 35)
                        {
                            lblAttachmentName.ToolTip = media.Name;
                        }
                        divDocAttachments.Style.Add("Width", "400px");
                        divAttachmentBlock.Style.Add("Width", "200px");
                        HtmlGenericControl divCheckInclude = (HtmlGenericControl)e.Item.FindControl("divCheckInclude");
                        divCheckInclude.Visible        = false;
                        extraDetails.Visible           = true;
                        lblUploadedDate.Text           = string.Concat("Uploaded: ", Utils.FormatDate(media.LastUpdatedDate));
                        lblUploadedBy.Text             = Support.TruncateString(string.Concat("By: ", media.LastUpdatedBy), 35);
                        thumbAttachment.FunctionPrefix = "EditModeModeDP";
                        break;
                    }
                }
            }
        }
Ejemplo n.º 40
0
        protected void rptList_ItemDataBound(object sender, RepeaterItemEventArgs e)
        {
            if ((e.Item.ItemType == ListItemType.Item) || (e.Item.ItemType == ListItemType.AlternatingItem))
            {
                Repeater  repeater  = (Repeater)e.Item.FindControl("rptSubList");
                OrderInfo orderInfo = OrderHelper.GetOrderInfo(DataBinder.Eval(e.Item.DataItem, "OrderID").ToString());
                if ((orderInfo != null) && (orderInfo.LineItems.Count > 0))
                {
                    repeater.DataSource = orderInfo.LineItems.Values;
                    repeater.DataBind();
                }
                OrderStatus status = (OrderStatus)DataBinder.Eval(e.Item.DataItem, "OrderStatus");
                string      str    = "";
                if (!(DataBinder.Eval(e.Item.DataItem, "Gateway") is DBNull))
                {
                    str = (string)DataBinder.Eval(e.Item.DataItem, "Gateway");
                }
                int             num     = (DataBinder.Eval(e.Item.DataItem, "GroupBuyId") != DBNull.Value) ? ((int)DataBinder.Eval(e.Item.DataItem, "GroupBuyId")) : 0;
                HtmlInputButton button  = (HtmlInputButton)e.Item.FindControl("btnModifyPrice");
                HtmlInputButton button2 = (HtmlInputButton)e.Item.FindControl("btnSendGoods");
                Button          button3 = (Button)e.Item.FindControl("btnPayOrder");
                Button          button4 = (Button)e.Item.FindControl("btnConfirmOrder");
                HtmlInputButton button5 = (HtmlInputButton)e.Item.FindControl("btnCloseOrderClient");
                HtmlAnchor      anchor  = (HtmlAnchor)e.Item.FindControl("lkbtnCheckRefund");
                HtmlAnchor      anchor2 = (HtmlAnchor)e.Item.FindControl("lkbtnCheckReturn");
                HtmlAnchor      anchor3 = (HtmlAnchor)e.Item.FindControl("lkbtnCheckReplace");
                switch (status)
                {
                case OrderStatus.WaitBuyerPay:
                    button.Visible = true;
                    button.Attributes.Add("onclick", "DialogFrame('../trade/EditOrder.aspx?OrderId=" + DataBinder.Eval(e.Item.DataItem, "OrderID") + "&reurl='+ encodeURIComponent(goUrl),'修改订单价格',900,450)");
                    button5.Attributes.Add("onclick", "CloseOrderFun('" + DataBinder.Eval(e.Item.DataItem, "OrderID") + "')");
                    button5.Visible = true;
                    if (str != "hishop.plugins.payment.podrequest")
                    {
                        button3.Visible = true;
                    }
                    break;

                case OrderStatus.ApplyForRefund:
                    anchor.Visible = true;
                    break;

                case OrderStatus.ApplyForReturns:
                    anchor2.Visible = true;
                    break;

                case OrderStatus.ApplyForReplacement:
                    anchor3.Visible = true;
                    break;
                }
                if (num > 0)
                {
                    GroupBuyStatus status2 = (GroupBuyStatus)DataBinder.Eval(e.Item.DataItem, "GroupBuyStatus");
                    button2.Visible = (status == OrderStatus.BuyerAlreadyPaid) && (status2 == GroupBuyStatus.Success);
                }
                else
                {
                    button2.Visible = (status == OrderStatus.BuyerAlreadyPaid) || ((status == OrderStatus.WaitBuyerPay) && (str == "hishop.plugins.payment.podrequest"));
                }
                button2.Attributes.Add("onclick", "DialogFrame('../trade/SendOrderGoods.aspx?OrderId=" + DataBinder.Eval(e.Item.DataItem, "OrderID") + "&reurl='+ encodeURIComponent(goUrl),'订单发货',750,220)");
                button4.Visible = status == OrderStatus.SellerAlreadySent;
            }
        }
Ejemplo n.º 41
0
        internal HtmlGenericControl GetPager()
        {
            if (this.PageSize.Equals(0))
            {
                this.PageSize = this.BlockCount;
            }

            this.TotalPages = (int)Decimal.Ceiling(Decimal.Divide(this.TotalRecords, this.PageSize));

            int start = 1 + (int)Decimal.Ceiling(Decimal.Divide(this.CurrentPage, this.BlockCount) - 1) * this.BlockCount;
            int end   = start + this.BlockCount - 1;

            if (end > this.TotalPages)
            {
                end = this.TotalPages;
            }


            using (HtmlGenericControl paginationMenu = new HtmlGenericControl("div"))
            {
                paginationMenu.Attributes.Add("class", this.CssClass);

                paginationMenu.Controls.Add(this.FirstItem());
                paginationMenu.Controls.Add(this.PreviousItem());
                paginationMenu.Controls.Add(this.GetAnchor(1));


                //The previous page block
                string title;
                if (start - this.BlockCount > 0)
                {
                    using (HtmlAnchor anchor = this.GetIconAnchor("icon item", "", start - 1))
                    {
                        title = string.Format(Thread.CurrentThread.CurrentCulture, Titles.PageN, start - 1);
                        anchor.Attributes.Add("title", title);

                        anchor.InnerText = "...";
                        paginationMenu.Controls.Add(anchor);
                    }
                }

                //Paged items
                for (int i = start; i <= end; i++)
                {
                    //Do not create the first and last page
                    //because we will create them explicitly
                    //which will be followed/led
                    //by next/previous page blocks
                    if (i.Equals(1) || i.Equals(this.TotalPages))
                    {
                        continue;
                    }

                    paginationMenu.Controls.Add(this.GetAnchor(i));
                }


                //The next page block
                if (start + this.BlockCount < this.TotalPages)
                {
                    using (HtmlAnchor anchor = this.GetIconAnchor("icon item", "", end + 1))
                    {
                        title = string.Format(Thread.CurrentThread.CurrentCulture, Titles.PageN, end + 1);
                        anchor.Attributes.Add("title", title);

                        anchor.InnerText = "...";
                        paginationMenu.Controls.Add(anchor);
                    }
                }

                paginationMenu.Controls.Add(this.GetAnchor(this.TotalPages));
                paginationMenu.Controls.Add(this.NextItem());
                paginationMenu.Controls.Add(this.LastItem());


                return(paginationMenu);
            }
        }
Ejemplo n.º 42
0
        public static string Parse(string stlElement, XmlNode node, PageInfo pageInfo, ContextInfo contextInfoRef)
        {
            string parsedContent;
            var    contextInfo = contextInfoRef.Clone();

            try
            {
                var stlAnchor  = new HtmlAnchor();
                var type       = TypeNextContent;
                var emptyText  = string.Empty;
                var tipText    = string.Empty;
                var wordNum    = 0;
                var isDynamic  = false;
                var isKeyboard = false;

                var ie = node.Attributes?.GetEnumerator();
                if (ie != null)
                {
                    while (ie.MoveNext())
                    {
                        var attr = (XmlAttribute)ie.Current;

                        if (StringUtils.EqualsIgnoreCase(attr.Name, AttributeType))
                        {
                            type = attr.Value;
                        }
                        else if (StringUtils.EqualsIgnoreCase(attr.Name, AttributeEmptyText))
                        {
                            emptyText = attr.Value;
                        }
                        else if (StringUtils.EqualsIgnoreCase(attr.Name, AttributeTipText))
                        {
                            tipText = attr.Value;
                        }
                        else if (StringUtils.EqualsIgnoreCase(attr.Name, AttributeWordNum))
                        {
                            wordNum = TranslateUtils.ToInt(attr.Value);
                        }
                        else if (StringUtils.EqualsIgnoreCase(attr.Name, AttributeIsDynamic))
                        {
                            isDynamic = TranslateUtils.ToBool(attr.Value);
                        }
                        else if (StringUtils.EqualsIgnoreCase(attr.Name, AttributeIsKeyboard))
                        {
                            isKeyboard = TranslateUtils.ToBool(attr.Value);
                        }
                        else
                        {
                            ControlUtils.AddAttributeIfNotExists(stlAnchor, attr.Name, attr.Value);
                        }
                    }
                }

                parsedContent = isDynamic ? StlDynamic.ParseDynamicElement(stlElement, pageInfo, contextInfo) : ParseImpl(node, pageInfo, contextInfo, stlAnchor, type, emptyText, tipText, wordNum, isKeyboard);
            }
            catch (Exception ex)
            {
                parsedContent = StlParserUtility.GetStlErrorMessage(ElementName, ex);
            }

            return(parsedContent);
        }
Ejemplo n.º 43
0
 /// <summary>
 /// Add css class to HtmlAnchor
 /// </summary>
 /// <param name="link"></param>
 /// <param name="className"></param>
 /// <returns></returns>
 protected static HtmlAnchor AddClass(HtmlAnchor link, string className)
 {
     var cssClass = link.Attributes["class"];
     if (!string.IsNullOrEmpty(cssClass))
         cssClass += " ";
     link.Attributes["class"] = cssClass + className;
     return link;
 }
Ejemplo n.º 44
0
 public void EsconderTab(HtmlAnchor link, HtmlGenericControl controle)
 {
     link.Attributes.Add("class", "collapsed");
     controle.Attributes.Remove("class");
     controle.Attributes.Add("class", "panel-collapse collapse");
 }
Ejemplo n.º 45
0
        /// <summary>
        /// Load the navigation for the photos
        /// </summary>
        /// <param name="galleryName"></param>
        public Int32 LoadPhotosNav(string galleryName, string galleriesPath, ContentInfoLoader cil)
        {
            string[] photoList = new string[1];
            if (galleriesPath != "")
            {
                photoList = cil.GetPhotoList(galleryName, Server.MapPath(galleriesPath));
            }
            if (photoList != null && photoList.Length != 0)
            {
                HtmlGenericControl blstPhotos = new HtmlGenericControl("ul");
                blstPhotos.Attributes.Add("id", "navlist_b");

                foreach (string iPhotoName in photoList)
                {
                    string photoName;
                    photoName = iPhotoName.Substring(iPhotoName.LastIndexOf("\\") + 1);
                    HtmlGenericControl photoListItem     = new HtmlGenericControl("li");
                    HtmlAnchor         photoAnchor       = new HtmlAnchor();
                    string             originalPhotoName = photoName;
                    char[]             charSeparators    = new char[] { '~', '.' };
                    string             photoTitle        = "";
                    if (photoName.Contains("~"))
                    {
                        photoTitle = photoName.Split(charSeparators)[1];
                        photoName  = photoName.Split(charSeparators)[0] + ".JPG";
                    }

                    if (Request["photo"] != "" && Request["photo"] != null)
                    {
                        // if a photo has been selected then we need to show that square as gray otherwise clickable and mouseover effects.
                        if (Request["photo"].ToUpper() != photoName.ToUpper())
                        {
                            if (Directory.Exists(Server.MapPath(galleriesPath + galleryName + "/thumbs/")))
                            {
                                photoAnchor.Attributes.Add("onMouseOver", "ddrivetip('<img src=\\'" + ResolveUrl(galleriesPath) + galleryName + "/thumbs/" + photoName + "\\' /><br>" + photoTitle.Replace("_", "&nbsp;") + "', " + photoTitle.Length + ")");
                            }
                            else
                            {
                                if (photoTitle != "")
                                {
                                    photoAnchor.Attributes.Add("onMouseOver", "ddrivetip('" + photoTitle.Replace("_", "&nbsp;") + "', " + photoTitle.Length + ")");
                                }
                                else
                                {
                                    photoAnchor.Attributes.Add("onMouseOver", "ddrivetip('" + photoName + "', " + photoName.Length + ")");
                                }
                            }

                            photoAnchor.Attributes.Add("onMouseOut", "hideddrivetip()");
                            photoAnchor.HRef      = "PicViewer.aspx?gallery=" + galleryName + "&photo=" + originalPhotoName;
                            photoAnchor.InnerHtml = "<em></em>";
                        }
                        else
                        {
                            photoAnchor.Disabled  = true;
                            photoAnchor.InnerHtml = "<em style='border-top:0.5em solid #696969'></em>";
                        }
                    }
                    else
                    {
                        if (Directory.Exists(Server.MapPath(galleriesPath + galleryName + "/thumbs/")))
                        {
                            photoAnchor.Attributes.Add("onMouseOver", "ddrivetip('<img src=\\'" + ResolveUrl(galleriesPath) + galleryName + "/thumbs/" + photoName + "\\' /><br>" + photoTitle.Replace("_", "&nbsp;") + "', " + photoTitle.Length + ")");
                        }
                        else
                        {
                            if (photoTitle != "")
                            {
                                photoAnchor.Attributes.Add("onMouseOver", "ddrivetip('" + photoTitle.Replace("_", "&nbsp;") + "', " + photoTitle.Length + ")");
                            }
                            else
                            {
                                photoAnchor.Attributes.Add("onMouseOver", "ddrivetip('" + photoName + "', " + photoName.Length + ")");
                            }
                        }

                        photoAnchor.Attributes.Add("onMouseOut", "hideddrivetip()");
                        photoAnchor.HRef      = "PicViewer.aspx?gallery=" + galleryName + "&photo=" + originalPhotoName;
                        photoAnchor.InnerHtml = "<em></em>";
                    }
                    photoListItem.Controls.Add(photoAnchor);
                    blstPhotos.Controls.Add(photoListItem);
                }
                galleryPlaceholder.Controls.Add(blstPhotos);
                return(photoList.Length);
            }
            else
            {
                return(0);
            }
        }
Ejemplo n.º 46
0
        /// <summary>
        /// ItemDataBound
        /// </summary>
        protected void rptResult_ItemDataBound(object sender, RepeaterItemEventArgs e)
        {
            if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem)
            {
                string        img, alt, publishedTask;
                HtmlTableRow  tr  = (HtmlTableRow)e.Item.FindControl("trList");
                HtmlInputText txt = null;
                if (e.Item.ItemIndex % 2 == 0)
                {
                    tr.Attributes.Add("class", "even");
                }
                else
                {
                    tr.Attributes.Add("class", "old");
                }

                try
                {
                    PNK_Product data = (PNK_Product)e.Item.DataItem;

                    //Role
                    Literal ltr = null;
                    ltr      = (Literal)e.Item.FindControl("ltrchk");
                    ltr.Text = string.Format(@"<INPUT class='txt' TYPE='checkbox' ID='cb{0}' NAME='cid[]' value='{1}' onclick='isChecked(this.checked);' >",
                                             e.Item.ItemIndex, data.Id);

                    //ltrNewsCategory
                    ltr      = (Literal)e.Item.FindControl("ltrNewsCategory");
                    ltr.Text = data.CategoryNameDesc;

                    //Sort
                    ltr = (Literal)e.Item.FindControl("ltrSort");
                    string strOrder = string.Empty;
                    string onclick  = string.Empty;

                    //orderDown
                    if (indexItem < this.pager.ItemCount - 1)
                    {
                        onclick   = string.Format("onclick=\"listItemTask('cb{0}', 'orderdown')\"", e.Item.ItemIndex);
                        strOrder += string.Format("<a title='{0}' {1} runat='server' class=\"center-block text-center\" style='cursor:pointer;color:#3C8DBC'><i class=\"fa fa-long-arrow-down\"></i></a> ", Constant.UI.admin_Down, onclick);
                    }
                    //orderUp
                    if (indexItem > 0)
                    {
                        onclick   = string.Format("onclick=\"listItemTask('cb{0}', 'orderup')\"", e.Item.ItemIndex);
                        strOrder += string.Format("<a title='{0}' {1} runat='server' class=\"center-block text-center\" style='cursor:pointer;color:#3C8DBC'><i class=\"fa fa-long-arrow-up\"></i> </a> ", Constant.UI.admin_Up, onclick);
                    }
                    indexItem++;
                    ltr.Text = strOrder;

                    //publish
                    if (data.Published == "1")
                    {
                        img           = "tick.png";
                        alt           = LocalizationUtility.GetText(ltrAdminPublish.Text);
                        publishedTask = "unpublish";
                    }
                    else
                    {
                        img           = "publish_x.png";
                        alt           = LocalizationUtility.GetText(ltrAminUnPublish.Text);
                        publishedTask = "publish";
                    }

                    //Id
                    HtmlInputButton btId = (HtmlInputButton)e.Item.FindControl("btId");
                    btId.Value = DBConvert.ParseString(data.Id);

                    //Base img
                    HtmlImage baseImage = (HtmlImage)e.Item.FindControl("baseImage");
                    baseImage.Src = WebUtils.GetUrlImage(ConfigurationManager.AppSettings["ProductUpload"], data.Image);
                    HtmlAnchor hypBaseImage = (HtmlAnchor)e.Item.FindControl("hypBaseImage");

                    //set link
                    HyperLink hdflink = new HyperLink();
                    hdflink           = (HyperLink)e.Item.FindControl("hdflink");
                    hypBaseImage.HRef = hdflink.NavigateUrl = template_path + LinkHelper.GetAdminLink("edit_product", data.CategoryId.ToString(), data.Id.ToString());
                    //HtmlTableCell td = (HtmlTableCell)e.Item.FindControl("tdName");
                    //td.Attributes.Add("onclick", string.Format("listItemTask('cb{0}', 'edit')", e.Item.ItemIndex));
                    //td = (HtmlTableCell)e.Item.FindControl("trUpdateDate");
                    //td.Attributes.Add("onclick", string.Format("listItemTask('cb{0}', 'edit')", e.Item.ItemIndex));
                    ImageButton imgctr = (ImageButton)e.Item.FindControl("btnPublish");
                    imgctr.ImageUrl = string.Format("/Admin/images/{0}", img);
                    imgctr.Attributes.Add("alt", alt);
                    HtmlTableCell btn = (HtmlTableCell)e.Item.FindControl("tdbtn");
                    btn.Attributes.Add("onclick", string.Format(" return listItemTask('cb{0}', '{1}')", e.Item.ItemIndex, publishedTask));

                    //Name
                    ltr = (Literal)e.Item.FindControl("ltrName");
                    hypBaseImage.Attributes["title"] = baseImage.Alt = baseImage.Attributes["title"] = ltr.Text = data.ProductDesc.Title;
                    //Server.HtmlDecode(getScmplit(data.Lvl) + "&bull; | " + data.Lvl + " | " + data.ProductCategoryDesc.Name);
                }
                catch { }
            }
        }
Ejemplo n.º 47
0
        /// <summary>
        /// ItemDataBound
        /// </summary>
        protected void rptResult_ItemDataBound(object sender, RepeaterItemEventArgs e)
        {
            if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem)
            {
                string        img, alt, publishedTask;
                HtmlTableRow  tr  = (HtmlTableRow)e.Item.FindControl("trList");
                HtmlInputText txt = null;
                if (e.Item.ItemIndex % 2 == 0)
                {
                    tr.Attributes.Add("class", "even");
                }
                else
                {
                    tr.Attributes.Add("class", "old");
                }

                try
                {
                    PNK_ContentStatic data = (PNK_ContentStatic)e.Item.DataItem;

                    //Role
                    Literal ltr = null;
                    ltr      = (Literal)e.Item.FindControl("ltrchk");
                    ltr.Text = string.Format(@"<INPUT class='txt' TYPE='checkbox' ID='cb{0}' NAME='cid[]' value='{1}' onclick='isChecked(this.checked);' >",
                                             e.Item.ItemIndex, data.Id);

                    //ltrNewsCategory
                    ltr = (Literal)e.Item.FindControl("ltrNewsCategory");


                    //image
                    if (data.Published == "1")
                    {
                        img           = "tick.png";
                        alt           = LocalizationUtility.GetText(ltrAdminPublish.Text);
                        publishedTask = "unpublish";
                    }
                    else
                    {
                        img           = "publish_x.png";
                        alt           = LocalizationUtility.GetText(ltrAdminPublish.Text);
                        publishedTask = "publish";
                    }

                    //Order
                    txt       = (HtmlInputText)e.Item.FindControl("txtOrder");
                    txt.Value = DBConvert.ParseString(data.Ordering);

                    //Id
                    HtmlInputButton btId = (HtmlInputButton)e.Item.FindControl("btId");
                    btId.Value = DBConvert.ParseString(data.Id);

                    //Base img
                    HtmlImage Image = (HtmlImage)e.Item.FindControl("Image");
                    Image.Src = WebUtils.GetUrlImage(ConfigurationManager.AppSettings["ContentStaticUpload"], data.Image);
                    HtmlAnchor hypImage = (HtmlAnchor)e.Item.FindControl("hypImage");

                    //set link
                    HyperLink hdflink = new HyperLink();
                    hdflink       = (HyperLink)e.Item.FindControl("hdflink");
                    hypImage.HRef = hdflink.NavigateUrl = template_path + LinkHelper.GetAdminLink("edit_contentstatic", data.Id);
                    ImageButton imgctr = (ImageButton)e.Item.FindControl("btnPublish");
                    imgctr.ImageUrl = string.Format("/Admin/images/{0}", img);
                    imgctr.Attributes.Add("alt", alt);
                    HtmlTableCell btn = (HtmlTableCell)e.Item.FindControl("tdbtn");
                    btn.Attributes.Add("onclick", string.Format(" return listItemTask('cb{0}', '{1}')", e.Item.ItemIndex, publishedTask));

                    //Name
                    ltr            = (Literal)e.Item.FindControl("ltrName");
                    hypImage.Title = ltr.Text = data.ContentStaticDesc.Title;
                }
                catch { }
            }
        }
Ejemplo n.º 48
0
        protected void listOrders_ItemDataBound(object sender, RepeaterItemEventArgs e)
        {
            if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem)
            {
                OrderStatus orderStatus = (OrderStatus)DataBinder.Eval(e.Item.DataItem, "OrderStatus");
                string      text        = DataBinder.Eval(e.Item.DataItem, "OrderId").ToString();
                OrderInfo   orderInfo   = TradeHelper.GetOrderInfo(text);
                if (orderInfo != null)
                {
                    if (orderInfo.PreSaleId > 0)
                    {
                        Literal literal = (Literal)e.Item.FindControl("litPresale");
                        literal.Text    = "(预售)";
                        literal.Visible = true;
                    }
                    OrderItemStatus itemStatus = orderInfo.ItemStatus;
                    DateTime        dateTime   = (DataBinder.Eval(e.Item.DataItem, "FinishDate") == DBNull.Value) ? DateTime.Now.AddYears(-1) : ((DateTime)DataBinder.Eval(e.Item.DataItem, "FinishDate"));
                    string          text2      = "";
                    if (DataBinder.Eval(e.Item.DataItem, "Gateway") != null && !(DataBinder.Eval(e.Item.DataItem, "Gateway") is DBNull))
                    {
                        text2 = (string)DataBinder.Eval(e.Item.DataItem, "Gateway");
                    }
                    HyperLink       hyperLink        = (HyperLink)e.Item.FindControl("hplinkorderreview");
                    HtmlAnchor      htmlAnchor       = (HtmlAnchor)e.Item.FindControl("hlinkPay");
                    ImageLinkButton imageLinkButton  = (ImageLinkButton)e.Item.FindControl("lkbtnConfirmOrder");
                    ImageLinkButton imageLinkButton2 = (ImageLinkButton)e.Item.FindControl("lkbtnCloseOrder");
                    HtmlAnchor      htmlAnchor2      = (HtmlAnchor)e.Item.FindControl("lkbtnApplyForRefund");
                    HtmlAnchor      htmlAnchor3      = (HtmlAnchor)e.Item.FindControl("lkbtnUserRealNameVerify");
                    HyperLink       hyperLink2       = (HyperLink)e.Item.FindControl("hlinkOrderDetails");
                    Repeater        repeater         = (Repeater)e.Item.FindControl("rpProduct");
                    Repeater        repeater2        = (Repeater)e.Item.FindControl("rpGift");
                    Label           label            = (Label)e.Item.FindControl("Logistics");
                    HtmlAnchor      htmlAnchor4      = (HtmlAnchor)e.Item.FindControl("lkbtnViewMessage");
                    HtmlAnchor      htmlAnchor5      = (HtmlAnchor)e.Item.FindControl("lkbtnRefundDetail");
                    htmlAnchor2.Attributes.Add("OrderId", text);
                    htmlAnchor2.Attributes.Add("SkuId", "");
                    htmlAnchor2.Attributes.Add("GateWay", text2);
                    OrderStatusLabel orderStatusLabel = (OrderStatusLabel)e.Item.FindControl("lblOrderStatus");
                    Literal          literal2         = (Literal)e.Item.FindControl("lblGiftTitle");
                    orderStatusLabel.order = orderInfo;
                    if (orderInfo.LineItems.Count <= 0)
                    {
                        Literal literal3 = literal2;
                        literal3.Text += "(礼)";
                    }
                    if (hyperLink != null)
                    {
                        if (orderInfo.GetGiftQuantity() > 0 && orderInfo.LineItems.Count() == 0)
                        {
                            hyperLink.Visible = false;
                        }
                        else
                        {
                            HyperLink hyperLink3 = hyperLink;
                            int       visible;
                            switch (orderStatus)
                            {
                            case OrderStatus.Closed:
                                visible = ((orderInfo.OnlyReturnedCount == orderInfo.LineItems.Count) ? 1 : 0);
                                break;

                            default:
                                visible = 0;
                                break;

                            case OrderStatus.Finished:
                                visible = 1;
                                break;
                            }
                            hyperLink3.Visible = ((byte)visible != 0);
                            if (hyperLink.Visible)
                            {
                                DataTable    productReviewAll = ProductBrowser.GetProductReviewAll(orderInfo.OrderId);
                                LineItemInfo lineItemInfo     = new LineItemInfo();
                                int          num  = 0;
                                int          num2 = 0;
                                int          num3 = 0;
                                bool         flag = false;
                                foreach (KeyValuePair <string, LineItemInfo> lineItem in orderInfo.LineItems)
                                {
                                    flag         = false;
                                    lineItemInfo = lineItem.Value;
                                    for (int i = 0; i < productReviewAll.Rows.Count; i++)
                                    {
                                        if (lineItemInfo.ProductId.ToString() == productReviewAll.Rows[i][0].ToString() && lineItemInfo.SkuId.ToString().Trim() == productReviewAll.Rows[i][1].ToString().Trim())
                                        {
                                            flag = true;
                                        }
                                    }
                                    if (!flag)
                                    {
                                        num2++;
                                    }
                                    else
                                    {
                                        num3++;
                                    }
                                }
                                if (num + num2 == orderInfo.LineItems.Count)
                                {
                                    hyperLink.Text = "查看评论";
                                }
                                else
                                {
                                    SiteSettings masterSettings = SettingsManager.GetMasterSettings();
                                    if (masterSettings != null)
                                    {
                                        if (masterSettings.ProductCommentPoint <= 0)
                                        {
                                            hyperLink.Text = "评价";
                                        }
                                        else
                                        {
                                            hyperLink.Text = $"评价得{num3 * masterSettings.ProductCommentPoint}积分";
                                        }
                                    }
                                }
                            }
                        }
                    }
                    if (orderInfo.PreSaleId > 0)
                    {
                        FormatedMoneyLabel formatedMoneyLabel = (FormatedMoneyLabel)e.Item.FindControl("FormatedMoneyLabel2");
                        formatedMoneyLabel.Money = orderInfo.Deposit + orderInfo.FinalPayment;
                        formatedMoneyLabel.Text  = (orderInfo.Deposit + orderInfo.FinalPayment).F2ToString("f2");
                        if (orderStatus == OrderStatus.WaitBuyerPay && text2 != "hishop.plugins.payment.podrequest" && text2 != "hishop.plugins.payment.bankrequest" && orderInfo.PaymentTypeId != -3)
                        {
                            if (!orderInfo.DepositDate.HasValue)
                            {
                                htmlAnchor.Visible = true;
                            }
                            else if (orderInfo.DepositDate.HasValue)
                            {
                                ProductPreSaleInfo productPreSaleInfo = ProductPreSaleHelper.GetProductPreSaleInfo(orderInfo.PreSaleId);
                                if (productPreSaleInfo.PaymentStartDate <= DateTime.Now && DateTime.Now <= productPreSaleInfo.PaymentEndDate)
                                {
                                    htmlAnchor.Visible = true;
                                }
                                else
                                {
                                    htmlAnchor.Visible = false;
                                }
                            }
                            else
                            {
                                htmlAnchor.Visible = false;
                            }
                        }
                        else
                        {
                            htmlAnchor.Visible = false;
                        }
                    }
                    else
                    {
                        htmlAnchor.Visible = (orderStatus == OrderStatus.WaitBuyerPay && text2 != "hishop.plugins.payment.podrequest" && text2 != "hishop.plugins.payment.bankrequest" && orderInfo.PaymentTypeId != -3);
                    }
                    imageLinkButton.Visible = (orderStatus == OrderStatus.SellerAlreadySent && itemStatus == OrderItemStatus.Nomarl);
                    if (orderInfo.PreSaleId > 0)
                    {
                        imageLinkButton2.Visible = (orderStatus == OrderStatus.WaitBuyerPay && itemStatus == OrderItemStatus.Nomarl && !orderInfo.DepositDate.HasValue);
                    }
                    else
                    {
                        imageLinkButton2.Visible = (orderStatus == OrderStatus.WaitBuyerPay && itemStatus == OrderItemStatus.Nomarl);
                    }
                    RefundInfo refundInfo = TradeHelper.GetRefundInfo(text);
                    htmlAnchor2.Visible = ((orderInfo.FightGroupId > 0 && VShopHelper.IsFightGroupCanRefund(orderInfo.FightGroupId) && orderInfo.IsCanRefund) || (orderInfo.FightGroupId <= 0 && orderInfo.IsCanRefund));
                    htmlAnchor3.Visible = (HiContext.Current.SiteSettings.IsOpenCertification && orderInfo.IDStatus == 0 && orderInfo.IsincludeCrossBorderGoods);
                    if (htmlAnchor3.Visible)
                    {
                        htmlAnchor3.Attributes.Add("OrderId", text);
                    }
                    if (repeater != null && repeater2 != null)
                    {
                        repeater.ItemDataBound += this.listProduct_ItemDataBound;
                        IList <NewLineItemInfo> list = new List <NewLineItemInfo>();
                        foreach (LineItemInfo value in orderInfo.LineItems.Values)
                        {
                            NewLineItemInfo newLineItemInfo = this.GetNewLineItemInfo(value, orderInfo.OrderId);
                            list.Add(newLineItemInfo);
                        }
                        if (list == null || list.Count == 0)
                        {
                            repeater.Visible = false;
                            DataTable dataTable = (DataTable)(repeater2.DataSource = TradeHelper.GetOrderGiftsThumbnailsUrl(((DataRowView)e.Item.DataItem).Row["OrderId"].ToString()));
                            repeater2.DataBind();
                            repeater2.Visible = true;
                        }
                        else
                        {
                            repeater.DataSource = list;
                            repeater.DataBind();
                            repeater2.Visible = false;
                            repeater.Visible  = true;
                        }
                    }
                    if (refundInfo != null && orderInfo.ItemStatus == OrderItemStatus.Nomarl && (orderInfo.OrderStatus == OrderStatus.ApplyForRefund || orderInfo.OrderStatus == OrderStatus.RefundRefused || orderInfo.OrderStatus == OrderStatus.Closed))
                    {
                        htmlAnchor5.HRef    = "/user/UserRefundApplyDetails/" + refundInfo.RefundId;
                        htmlAnchor5.Visible = true;
                    }
                    hyperLink2.NavigateUrl = "/user/OrderDetails/" + orderInfo.OrderId;
                    if ((orderStatus == OrderStatus.SellerAlreadySent || orderStatus == OrderStatus.Finished) && !string.IsNullOrEmpty(orderInfo.ExpressCompanyAbb) && !string.IsNullOrEmpty(orderInfo.ShipOrderNumber) && orderInfo.ShippingModeId != -2)
                    {
                        label.Attributes.Add("action", "order");
                        label.Attributes.Add("orderId", text);
                        label.Visible = true;
                    }
                    if (orderInfo.FightGroupId > 0)
                    {
                        FightGroupInfo fightGroup = VShopHelper.GetFightGroup(orderInfo.FightGroupId);
                        htmlAnchor2.Visible = (fightGroup.Status != 0 && orderInfo.GetPayTotal() > decimal.Zero && (refundInfo == null || refundInfo.HandleStatus == RefundStatus.Refused) && orderInfo.OrderStatus == OrderStatus.BuyerAlreadyPaid);
                    }
                    if (orderInfo.OrderStatus == OrderStatus.BuyerAlreadyPaid || orderInfo.OrderStatus == OrderStatus.Finished || orderInfo.OrderStatus == OrderStatus.WaitReview || orderInfo.OrderStatus == OrderStatus.History)
                    {
                        WeiXinRedEnvelopeInfo openedWeiXinRedEnvelope = WeiXinRedEnvelopeProcessor.GetOpenedWeiXinRedEnvelope();
                        bool flag2 = false;
                        if (openedWeiXinRedEnvelope != null && openedWeiXinRedEnvelope.EnableIssueMinAmount <= orderInfo.GetPayTotal() && orderInfo.OrderDate >= openedWeiXinRedEnvelope.ActiveStartTime && orderInfo.OrderDate <= openedWeiXinRedEnvelope.ActiveEndTime)
                        {
                            flag2 = true;
                        }
                        if (flag2)
                        {
                            Image image = (Image)e.Item.FindControl("imgRedEnvelope");
                            image.ImageUrl = "../../../../common/images/SendRedEnvelope.png";
                            image.Attributes.Add("class", "ztitle_RedEnvelope");
                            image.Attributes.Add("onclick", "GetRedEnvelope(" + orderInfo.OrderId + ")");
                            image.Visible = true;
                        }
                    }
                    if (orderInfo.OrderStatus != OrderStatus.WaitBuyerPay || !(orderInfo.ParentOrderId == "-1") || !orderInfo.OrderId.Contains("P"))
                    {
                        Label label2 = (Label)e.Item.FindControl("lblsupplier");
                        if (label2 != null)
                        {
                            string empty = string.Empty;
                            if (HiContext.Current.SiteSettings.OpenMultStore && orderInfo.StoreId > 0 && !string.IsNullOrWhiteSpace(orderInfo.StoreName))
                            {
                                label2.Text = orderInfo.StoreName;
                                empty       = "mtitle_1";
                            }
                            else if (orderInfo.StoreId == 0 && HiContext.Current.SiteSettings.OpenSupplier && orderInfo.SupplierId > 0)
                            {
                                label2.Text = orderInfo.ShipperName;
                                empty       = "stitle_1";
                            }
                            else
                            {
                                label2.Text = "平台";
                                empty       = "ztitle_1_new";
                            }
                            label2.Attributes.Add("style", string.IsNullOrWhiteSpace(label2.Text) ? "display:none" : "display:inline");
                            label2.Attributes.Add("class", empty);
                            label2.Visible = true;
                        }
                    }
                }
            }
        }
Ejemplo n.º 49
0
        private static string ParseImpl(XmlNode node, PageInfo pageInfo, ContextInfo contextInfo, string separator, string target, string linkClass, int wordNum, StringDictionary attributes)
        {
            if (!string.IsNullOrEmpty(node.InnerXml))
            {
                separator = node.InnerXml;
            }

            var nodeInfo = NodeManager.GetNodeInfo(pageInfo.PublishmentSystemId, contextInfo.ChannelID);

            var builder = new StringBuilder();

            var parentsPath  = nodeInfo.ParentsPath;
            var parentsCount = nodeInfo.ParentsCount;

            if (parentsPath.Length != 0)
            {
                var nodePath        = parentsPath + "," + contextInfo.ChannelID;
                var nodeIDArrayList = TranslateUtils.StringCollectionToStringList(nodePath);
                foreach (string nodeIDStr in nodeIDArrayList)
                {
                    var currentID       = int.Parse(nodeIDStr);
                    var currentNodeInfo = NodeManager.GetNodeInfo(pageInfo.PublishmentSystemId, currentID);
                    if (currentID == pageInfo.PublishmentSystemId)
                    {
                        var stlAnchor = new HtmlAnchor();
                        if (!string.IsNullOrEmpty(target))
                        {
                            stlAnchor.Target = target;
                        }
                        if (!string.IsNullOrEmpty(linkClass))
                        {
                            stlAnchor.Attributes.Add("class", linkClass);
                        }
                        var url = PageUtility.GetIndexPageUrl(pageInfo.PublishmentSystemInfo);
                        if (url.Equals(PageUtils.UnclickedUrl))
                        {
                            stlAnchor.Target = string.Empty;
                        }
                        stlAnchor.HRef      = url;
                        stlAnchor.InnerHtml = StringUtils.MaxLengthText(currentNodeInfo.NodeName, wordNum);

                        ControlUtils.AddAttributesIfNotExists(stlAnchor, attributes);

                        builder.Append(ControlUtils.GetControlRenderHtml(stlAnchor));

                        if (parentsCount > 0)
                        {
                            builder.Append(separator);
                        }
                    }
                    else if (currentID == contextInfo.ChannelID)
                    {
                        var stlAnchor = new HtmlAnchor();
                        if (!string.IsNullOrEmpty(target))
                        {
                            stlAnchor.Target = target;
                        }
                        if (!string.IsNullOrEmpty(linkClass))
                        {
                            stlAnchor.Attributes.Add("class", linkClass);
                        }
                        var url = PageUtility.GetChannelUrl(pageInfo.PublishmentSystemInfo, currentNodeInfo);
                        if (url.Equals(PageUtils.UnclickedUrl))
                        {
                            stlAnchor.Target = string.Empty;
                        }
                        stlAnchor.HRef      = url;
                        stlAnchor.InnerHtml = StringUtils.MaxLengthText(currentNodeInfo.NodeName, wordNum);

                        ControlUtils.AddAttributesIfNotExists(stlAnchor, attributes);

                        builder.Append(ControlUtils.GetControlRenderHtml(stlAnchor));
                    }
                    else
                    {
                        var stlAnchor = new HtmlAnchor();
                        if (!string.IsNullOrEmpty(target))
                        {
                            stlAnchor.Target = target;
                        }
                        if (!string.IsNullOrEmpty(linkClass))
                        {
                            stlAnchor.Attributes.Add("class", linkClass);
                        }
                        var url = PageUtility.GetChannelUrl(pageInfo.PublishmentSystemInfo, currentNodeInfo);
                        if (url.Equals(PageUtils.UnclickedUrl))
                        {
                            stlAnchor.Target = string.Empty;
                        }
                        stlAnchor.HRef      = url;
                        stlAnchor.InnerHtml = StringUtils.MaxLengthText(currentNodeInfo.NodeName, wordNum);

                        ControlUtils.AddAttributesIfNotExists(stlAnchor, attributes);

                        builder.Append(ControlUtils.GetControlRenderHtml(stlAnchor));

                        if (parentsCount > 0)
                        {
                            builder.Append(separator);
                        }
                    }
                }
            }

            return(builder.ToString());
        }
Ejemplo n.º 50
0
    protected void Repeater_ItemDataBound(object sender, RepeaterItemEventArgs e)
    {
        DataRowView row         = (DataRowView)e.Item.DataItem;
        CheckBox    cb          = (CheckBox)e.Item.FindControl("ItemSelect");
        HtmlAnchor  requestLink = (HtmlAnchor)e.Item.FindControl("requestLink");

        WebFormUtils.LoadKeys(db, row, cb);
        cb.Checked = false;
        cb.Visible = false;

        EEmpRequest obj = new EEmpRequest();

        EEmpRequest.db.toObject(((DataRowView)e.Item.DataItem).Row, obj);

        // resolve Request Type --> Description
        Label lblEmpRequestType = (Label)e.Item.FindControl("EmpRequestType");

        switch (obj.EmpRequestType)
        {
        case EEmpRequest.TYPE_EELEAVEAPP:
            lblEmpRequestType.Text = "Leave Application";
            break;

        case EEmpRequest.TYPE_EELEAVECANCEL:
            lblEmpRequestType.Text = "Leave Application Cancellation";
            break;

        case EEmpRequest.TYPE_EEOTCLAIM:
            lblEmpRequestType.Text = "CL Requisition";
            break;

        case EEmpRequest.TYPE_EEOTCLAIMCANCEL:
            lblEmpRequestType.Text = "CL Requisition Cancel";
            break;

        // Start 0000112, Miranda, 2014-12-10
        case EEmpRequest.TYPE_EELATEWAIVE:
            lblEmpRequestType.Text = "Late Waive";
            break;

        case EEmpRequest.TYPE_EELATEWAIVECANCEL:
            lblEmpRequestType.Text = "Late Waive Cancel";
            break;

        // End 0000112, Miranda, 2014-12-10
        case EEmpRequest.TYPE_EEPROFILE:
            lblEmpRequestType.Text = "Personal Information";
            break;

        default:
            lblEmpRequestType.Text = obj.EmpRequestType;
            break;
        }


        requestLink.HRef = HROne.Common.WebUtility.URLwithEncryptQueryString(Session, "~/ESS_EmpRequestDetail.aspx?TargetEmpID=" + obj.EmpID + "&EmpRequestRecordID=" + obj.EmpRequestRecordID + "&EmpRequestID=" + obj.EmpRequestID);
        //requestLink.InnerText = row["EmpNo"].ToString();
        requestLink.Title = generateToolTipMessage(obj);
        ESSAuthorizationProcess authorization       = new ESSAuthorizationProcess(dbConn);
        ArrayList workFlowDetailList                = authorization.GetAuthorizationWorkFlowDetailList(obj.EmpID, obj.EmpRequestType);
        EAuthorizationWorkFlowDetail workFlowDetail = authorization.GetCurrentWorkFlowDetailObject(workFlowDetailList, obj.EmpRequestLastAuthorizationWorkFlowIndex, CurID);

        if (workFlowDetail != null)
        {
            ArrayList authorizerList = workFlowDetail.GetActualAutorizerObjectList(dbConn, CurID);
            foreach (EAuthorizer authorizer in authorizerList)
            {
                if (!authorizer.AuthorizerIsReadOnly)
                {
                    cb.Visible = true;
                }
            }
        }
    }
Ejemplo n.º 51
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);
        }
    }
Ejemplo n.º 52
0
        public void TestMethod_DragDroColumns()
        {
            readData();

            CommonFunctions.Login(myManager, _username, _password, _url);

            myManager.ActiveBrowser.Window.Maximize();

            ObjMenus menus = new ObjMenus(myManager);

            HtmlListItem system = menus.systemlink.As <HtmlListItem>();

            system.MouseHover();

            myManager.ActiveBrowser.RefreshDomTree();

            Thread.Sleep(2000);
            myManager.ActiveBrowser.RefreshDomTree();

            HtmlAnchor users = menus.userslink.As <HtmlAnchor>();

            users.MouseClick();

            Thread.Sleep(2000);
            myManager.ActiveBrowser.RefreshDomTree();

            ObjTableLayout objtablelayout = new ObjTableLayout(myManager);

            Element layouttablebtn = objtablelayout.editlayoutBtn;

            myManager.ActiveBrowser.Actions.Click(layouttablebtn);

            Thread.Sleep(1000);
            myManager.ActiveBrowser.RefreshDomTree();

            Element idrowclick = objtablelayout.id;

            myManager.ActiveBrowser.Actions.Click(idrowclick);

            HtmlTableCell dragitem = objtablelayout.drag.As <HtmlTableCell>();

            HtmlTableCell dropitem = objtablelayout.drop.As <HtmlTableCell>();

            myManager.ActiveBrowser.WaitUntilReady();
            myManager.ActiveBrowser.RefreshDomTree();

            //HtmlTable teblw = objtablelayout.editlayouttable.As<HtmlTable>();

            HtmlDiv   sadsa = myManager.ActiveBrowser.Find.ByXPath("/html/body/div[3]/div/div").As <HtmlDiv>();
            HtmlTable teblw = sadsa.Find.AllByTagName("table")[0].As <HtmlTable>();

            HtmlTableRow dragitem1 = teblw.Rows[1];
            HtmlTableRow drop      = teblw.Rows[3];

            teblw.Refresh();

            dragitem1.DragTo(drop);

            Thread.Sleep(1000);
            myManager.ActiveBrowser.RefreshDomTree();
        }
Ejemplo n.º 53
0
        /// <summary>
        /// Called by the ASP.NET page framework to notify server controls that use composition-based implementation to create any child controls they contain in preparation for posting back or rendering.
        /// </summary>
        protected override void CreateChildControls()
        {
            //_hfBinaryFileId = new HiddenField();
            base.CreateChildControls();
            Controls.Clear();
            RockControlHelper.CreateChildControls(this, Controls);

            Controls.Add(_hfBinaryFileId);
            _hfBinaryFileId.ID    = this.ID + "_hfBinaryFileId";
            _hfBinaryFileId.Value = "0";

            _hfOriginalBinaryFileId.ID = this.ID + "_hfOriginalBinaryFileId";
            Controls.Add(_hfOriginalBinaryFileId);

            _hfCropBinaryFileId.ID = this.ID + "_hfCropBinaryFileId";
            Controls.Add(_hfCropBinaryFileId);

            _hfBinaryFileTypeGuid.ID = this.ID + "_hfBinaryFileTypeGuid";
            Controls.Add(_hfBinaryFileTypeGuid);

            _aRemove           = new HtmlAnchor();
            _aRemove.ID        = "rmv";
            _aRemove.InnerHtml = "<i class='fa fa-times'></i>";
            Controls.Add(_aRemove);

            _lbShowModal                  = new LinkButton();
            _lbShowModal.ID               = this.ID + "_lbShowModal";
            _lbShowModal.CssClass         = this.ButtonCssClass;
            _lbShowModal.Text             = this.ButtonText;
            _lbShowModal.ToolTip          = this.ButtonToolTip;
            _lbShowModal.Click           += _lbShowModal_Click;
            _lbShowModal.CausesValidation = false;
            Controls.Add(_lbShowModal);

            // If we are not showing the delete button then
            // only the UploadImage button should be active.
            if (!ShowDeleteButton)
            {
                _aRemove.Visible     = false;
                _lbShowModal.Visible = false;
            }

            _lbUploadImage                  = new LinkButton();
            _lbUploadImage.ID               = this.ID + "_lbUploadImage";
            _lbUploadImage.CssClass         = this.ButtonCssClass;
            _lbUploadImage.Text             = this.ButtonText;
            _lbUploadImage.ToolTip          = this.ButtonToolTip;
            _lbUploadImage.CausesValidation = false;
            Controls.Add(_lbUploadImage);

            _lSaveStatus          = new Label();
            _lSaveStatus.ID       = this.ID + "_lSaveStatus";
            _lSaveStatus.CssClass = "fa fa-2x fa-check-circle-o text-success";
            _lSaveStatus.Style.Add("vertical-align", "bottom");
            _lSaveStatus.Visible = false;
            Controls.Add(_lSaveStatus);

            _fileUpload    = new FileUpload();
            _fileUpload.ID = this.ID + "_fu";
            Controls.Add(_fileUpload);

            _mdImageDialog = new ModalDialog();
            _mdImageDialog.ValidationGroup = "vg_mdImageDialog";
            _mdImageDialog.ID             = this.ID + "_mdImageDialog";
            _mdImageDialog.Title          = "Image";
            _mdImageDialog.SaveButtonText = "Crop";
            _mdImageDialog.SaveClick     += _mdImageDialog_SaveClick;

            _pnlCropContainer                   = new Panel();
            _pnlCropContainer.CssClass          = "crop-container image-editor-crop-container clearfix";
            _nbImageWarning                     = new NotificationBox();
            _nbImageWarning.ID                  = this.ID + "_nbImageWarning";
            _nbImageWarning.NotificationBoxType = NotificationBoxType.Warning;
            _nbImageWarning.Text                = "SVG image cropping is not supported.";

            _nbErrorMessage    = new NotificationBox();
            _nbErrorMessage.ID = this.ID + "_nbErrorMessage";
            _nbErrorMessage.NotificationBoxType = NotificationBoxType.Danger;
            _nbErrorMessage.Text    = "File Type is not supported.";
            _nbErrorMessage.Visible = false;

            _imgCropSource          = new Image();
            _imgCropSource.ID       = this.ID + "_imgCropSource";
            _imgCropSource.CssClass = "image-editor-crop-source";

            _pnlCropContainer.Controls.Add(_imgCropSource);

            _mdImageDialog.Content.Controls.Add(_nbImageWarning);
            _mdImageDialog.Content.Controls.Add(_pnlCropContainer);

            _hfCropCoords    = new HiddenField();
            _hfCropCoords.ID = this.ID + "_hfCropCoords";
            _pnlCropContainer.Controls.Add(_hfCropCoords);

            Controls.Add(_mdImageDialog);

            RequiredFieldValidator.InitialValue      = "0";
            RequiredFieldValidator.ControlToValidate = _hfBinaryFileId.ID;
            RequiredFieldValidator.Display           = ValidatorDisplay.Dynamic;
        }
Ejemplo n.º 54
0
    private string RenderComments(List<Comment> comments, StringDictionary settings)
    {
        if (comments.Count == 0)
        {
            //HttpRuntime.Cache.Insert("widget_recentcomments", "<p>" + Resources.labels.none + "</p>");
            return "<p>" + Resources.labels.none + "</p>";
        }

        HtmlGenericControl ul = new HtmlGenericControl("ul");
        ul.Attributes.Add("class", "recentComments");
        ul.ID = "recentComments";

        foreach (Comment comment in comments)
        {
            if (comment.IsApproved)
            {
                HtmlGenericControl li = new HtmlGenericControl("li");

                // The post title
                HtmlAnchor title = new HtmlAnchor();
                title.HRef = comment.Parent.RelativeLink.ToString();
                title.InnerText = comment.Parent.Title;
                title.Attributes.Add("class", "postTitle");
                li.Controls.Add(title);

                // The comment count on the post
                LiteralControl count = new LiteralControl(" (" + ((Post)comment.Parent).ApprovedComments.Count + ")<br />");
                li.Controls.Add(count);

                // The author
                if (comment.Website != null)
                {
                    HtmlAnchor author = new HtmlAnchor();
                    author.Attributes.Add("rel", "nofollow");
                    author.HRef = comment.Website.ToString();
                    author.InnerHtml = comment.Author;
                    li.Controls.Add(author);

                    LiteralControl wrote = new LiteralControl(" " + Resources.labels.wrote + ": ");
                    li.Controls.Add(wrote);
                }
                else
                {
                    LiteralControl author = new LiteralControl(comment.Author + " " + Resources.labels.wrote + ": ");
                    li.Controls.Add(author);
                }

                // The comment body
                string commentBody = Regex.Replace(comment.Content, @"\[(.*?)\]", "");
                int bodyLength = Math.Min(commentBody.Length, 50);

                commentBody = commentBody.Substring(0, bodyLength);
                if (commentBody.Length > 0)
                {
                    if (commentBody[commentBody.Length - 1] == '&')
                    {
                        commentBody = commentBody.Substring(0, commentBody.Length - 1);
                    }
                }
                commentBody += comment.Content.Length <= 50 ? " " : "... ";
                LiteralControl body = new LiteralControl(commentBody);
                li.Controls.Add(body);

                // The comment link
                HtmlAnchor link = new HtmlAnchor();
                link.HRef = comment.Parent.RelativeLink + "#id_" + comment.Id;
                link.InnerHtml = "[" + Resources.labels.more + "]";
                link.Attributes.Add("class", "moreLink");
                li.Controls.Add(link);

                ul.Controls.Add(li);
            }
        }

        StringWriter sw = new StringWriter();
        ul.RenderControl(new HtmlTextWriter(sw));

        string ahref = "<a href=\"{0}syndication.axd?comments=true\">Comment RSS <img src=\"{0}pics/rssButton.gif\" alt=\"\" /></a>";
        string rss = string.Format(ahref, Utils.RelativeWebRoot);
        sw.Write(rss);
        return sw.ToString();
        //HttpRuntime.Cache.Insert("widget_recentcomments", sw.ToString());
    }
        public void TestMethod_addStandardActivityPage()
        {
            readData();

            CommonFunctions.Login(myManager, _username, _password, _Url);

            myManager.ActiveBrowser.Window.Maximize();

            // -- End of Login ---
            ObjMenus menus = new ObjMenus(myManager);

            HtmlAnchor process = menus.processlink.As <HtmlAnchor>();

            process.MouseHover();

            myManager.ActiveBrowser.RefreshDomTree();

            Thread.Sleep(1000);
            myManager.ActiveBrowser.RefreshDomTree();

            HtmlAnchor standardactivity = menus.standardactivitylink.As <HtmlAnchor>();

            standardactivity.MouseClick();

            Thread.Sleep(2000);
            myManager.ActiveBrowser.RefreshDomTree();

            ObjAddStandardActivity objaddstandardactivity = new ObjAddStandardActivity(myManager);

            Element addbutton = objaddstandardactivity.addactivitybtn;

            myManager.ActiveBrowser.Actions.Click(addbutton);

            Thread.Sleep(2000);
            myManager.ActiveBrowser.RefreshDomTree();

            Element verifypage = objaddstandardactivity.addpagetitle;

            Assert.IsTrue(verifypage.InnerText.Contains("Activity Details"));

            Element namelbl = objaddstandardactivity.namelabel;

            Assert.IsTrue(namelbl.InnerText.Contains("Name *"));

            Element freetxtlbl = objaddstandardactivity.freetextlabel;

            Assert.IsTrue(freetxtlbl.InnerText.Contains("Free Text"));

            Element grouplbl = objaddstandardactivity.grouplabel;

            Assert.IsTrue(grouplbl.InnerText.Contains("Group"));

            Element poslbl = objaddstandardactivity.poslabel;

            Assert.IsTrue(poslbl.InnerText.Contains("Pos"));

            Element postlbl = objaddstandardactivity.postlabel;

            Assert.IsTrue(postlbl.InnerText.Contains("Post"));

            Element oplbl = objaddstandardactivity.oplabel;

            Assert.IsTrue(oplbl.InnerText.Contains("Op"));

            Element activitytypelbl = objaddstandardactivity.activitytypelabel;

            Assert.IsTrue(activitytypelbl.InnerText.Contains("Activity Type"));

            Element weslbl = objaddstandardactivity.weslabel;

            Assert.IsTrue(weslbl.InnerText.Contains("Wes"));

            Element variantlbl = objaddstandardactivity.variantlabel;

            Assert.IsTrue(variantlbl.InnerText.Contains("Variant String *"));

            Element memolbl = objaddstandardactivity.memolabel;

            Assert.IsTrue(memolbl.InnerText.Contains("Memo"));

            Element additionalmemolbl = objaddstandardactivity.additionalmemolabel;

            Assert.IsTrue(additionalmemolbl.InnerText.Contains("Additional Memo"));

            Thread.Sleep(3000);
            myManager.ActiveBrowser.RefreshDomTree();
        }
Ejemplo n.º 56
0
    public void setproduct()
    {
        products  pr   = new products();
        DataTable dt   = new DataTable();
        category  cat  = new category();
        brand     brnd = new brand();

        if (Request.QueryString["cat_id"] == null && Request.QueryString["brand_id"] == null)
        {
            dt = pr.getproduct();
        }
        else if (Request.QueryString["cat_id"] != null && Request.QueryString["brand_id"] == null)
        {
            dt = pr.getproduct_cat(Request.QueryString["cat_id"].ToString());
            list_footer_menu.InnerHtml += "<li><span class=\"icon-chevron-left\"></span></li>";

            string cat_name = cat.getcategory(Request.QueryString["cat_id"].ToString()).Rows[0]["name"].ToString();
            list_footer_menu.InnerHtml += "<li><a href=\"shop.aspx?cat_id=" + Request.QueryString["cat_id"].ToString() + "\">" + cat_name + "</a> </li>";
            tourStep2.InnerHtml         = "";
        }
        else if (Request.QueryString["cat_id"] == null && Request.QueryString["brand_id"] != null)
        {
            dt = pr.getproduct_brand(Request.QueryString["brand_id"].ToString());
            list_footer_menu.InnerHtml += "<li><span class=\"icon-chevron-left\"></span></li>";

            string brand_name = brnd.getbrandbyid(Request.QueryString["brand_id"].ToString()).Rows[0]["name"].ToString();
            list_footer_menu.InnerHtml += "<li><a href=\"shop.aspx?brand_id=" + Request.QueryString["brand_id"].ToString() + "\">" + brand_name + "</a> </li>";
            tourStep3.InnerHtml         = "";
        }


        foreach (DataRow list in dt.Rows)
        {
            DataTable pname     = pr.getonepic(Convert.ToInt32(list["id"]));
            string    catname   = cat.getcategory(list["cat_id"].ToString()).Rows[0]["name"].ToString();
            string    brandname = brnd.getbrandbyid(list["brand_id"].ToString()).Rows[0]["name"].ToString();

            //Response.Write(catname);
            //Response.Write("-");
            //Response.Write(pname["name"].ToString());
            //Response.Write("-");

            HtmlGenericControl div = new HtmlGenericControl("div");
            // div.Attributes.Add("id", "p-item" + list["id"].ToString());
            div.Attributes.Add("class", "span3 filter--cat_id" + list["cat_id"]);
            div.Attributes.Add("data-price", list["price"].ToString());
            div.Attributes.Add("data-popularity", "2");
            div.Attributes.Add("data-size", "xs|s|m|xl");
            div.Attributes.Add("data-color", "pink");
            div.Attributes.Add("data-brand", "brand_id" + list["brand_id"].ToString());
            //div.Attributes.Add("runat", "server");


            HtmlGenericControl divproduct = new HtmlGenericControl("div");
            //div2.Attributes.Add("id", "p-item2-" + list["id"].ToString());
            divproduct.Attributes.Add("class", "product");


            HtmlGenericControl divproductimg = new HtmlGenericControl("div");
            // div3.Attributes.Add("id", "p-item3-" + list["id"].ToString());
            divproductimg.Attributes.Add("class", "product-img");


            HtmlGenericControl divpicture = new HtmlGenericControl("div");
            //div4.Attributes.Add("id", "p-item4-" + list["id"].ToString());
            divpicture.Attributes.Add("class", "picture");


            HtmlGenericControl imgpicture = new HtmlGenericControl("img");
            imgpicture.Attributes.Add("id", "p-img" + list["id"].ToString());
            //img1.Attributes.Add("runat", "server");
            imgpicture.Attributes.Add("width", "540");
            imgpicture.Attributes.Add("height", "374");
            imgpicture.Attributes.Add("alt", "");
            // img1.Attributes.Add("src", (Server.MapPath("~/images/Ppic/").ToString())+list["id"].ToString()+".jpg");
            //imgpicture.Attributes.Add("src", "images/Ppic/" + pname.Rows[0]["name"].ToString() + ".jpg");
            string picname = null;
            if (pname.Rows.Count != 0)
            {
                //imgpicture.Attributes.Add("src", "images/Ppic/" + pname.Rows[0]["name"].ToString() + ".jpg");
                picname = "images/Ppic/" + pname.Rows[0]["name"].ToString() + ".jpg";
            }
            else
            {
                //imgpicture.Attributes.Add("src", "images/Ppic/noimage.jpg");
                picname = "images/Ppic/noimage.jpg";
            }
            imgpicture.Attributes.Add("src", picname);

            divpicture.Controls.Add(imgpicture);

            HtmlGenericControl divimgoverlay = new HtmlGenericControl("div");
            //div5.Attributes.Add("id", "p-div5" + list["id"].ToString());
            divimgoverlay.Attributes.Add("class", "img-overlay");


            //HtmlGenericControl br1 = new HtmlGenericControl("br");
            //div2.Controls.Add(br1);

            HtmlGenericControl aimgoverlay = new HtmlGenericControl("a");
            ///a1.Attributes.Add("id", "a1" + list["id"].ToString());
            aimgoverlay.Attributes.Add("href", "product.aspx?id=" + list["id"].ToString());
            aimgoverlay.Attributes.Add("class", "btn more btn-primary");
            aimgoverlay.InnerText = "توضیحات بیشتر";
            divimgoverlay.Controls.Add(aimgoverlay);

            HtmlAnchor aimgoverlay2 = new HtmlAnchor();
            aimgoverlay2.ID           = "addtocart" + list["id"].ToString();
            aimgoverlay2.HRef         = "#";
            aimgoverlay2.Name         = list["id"].ToString() + "," + list["price"].ToString() + "," + picname + "," + catname + " - " + brandname + " - " + list["name"].ToString();
            aimgoverlay2.ServerClick += new System.EventHandler(addtocart_click);
            aimgoverlay2.Attributes.Add("class", "btn buy btn-danger");
            aimgoverlay2.Attributes.Add("onclick", "addtocart('" + "p-img" + list["id"].ToString() + "');");
            aimgoverlay2.InnerText = "اضافه به سبد خرید";

            UpdatePanel up = new UpdatePanel();
            up.ContentTemplateContainer.Controls.Add(aimgoverlay2);
            divimgoverlay.Controls.Add(up);
            divimgoverlay.Controls.Add(aimgoverlay);
            //divimgoverlay.Controls.Add(aimgoverlay2);
            divpicture.Controls.Add(divimgoverlay);
            divproductimg.Controls.Add(divpicture);
            divproduct.Controls.Add(divproductimg);
            //HtmlGenericControl a2 = new HtmlGenericControl("a");
            //// a2.Attributes.Add("id", "a2" + list["id"].ToString());
            //a2.Attributes.Add("href", "#");
            //a2.Attributes.Add("class", "btn buy btn-danger");
            //
            //div5.Controls.Add(a2);

            //                    <!-- Sub Text -->
            HtmlGenericControl divmaintitle = new HtmlGenericControl("div");
            // div6.Attributes.Add("id", "p-div6" + list["id"].ToString());
            divmaintitle.Attributes.Add("class", "main-titles no-margin");


            HtmlGenericControl h4maintitle = new HtmlGenericControl("h4");
            h4maintitle.Attributes.Add("class", "title");
            h4maintitle.InnerText = catname + " - " + brandname + " - " + list["name"].ToString();
            divmaintitle.Controls.Add(h4maintitle);

            HtmlGenericControl h5maintitle = new HtmlGenericControl("h5");
            h5maintitle.Attributes.Add("class", "no-margin isotope--title");
            h5maintitle.InnerText = String.Format("{0:#,##0}", list["price"]) + " ریال";
            divmaintitle.Controls.Add(h5maintitle);
            divproduct.Controls.Add(divmaintitle);
            div.Controls.Add(divproduct);
            isotopeContainer.Controls.Add(div);
        }
    }
Ejemplo n.º 57
0
        protected void lstItem_ItemDataBound(object sender, DataListItemEventArgs e)
        {
            if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem)
            {
                DataRowView dr = (DataRowView)e.Item.DataItem;

                HtmlInputCheckBox chkList = (HtmlInputCheckBox)e.Item.FindControl("chkList");
                chkList.Value = dr["TransferInItemID"].ToString();

                HyperLink lnkDescription = (HyperLink)e.Item.FindControl("lnkDescription");
                lnkDescription.Text        = dr["Description"].ToString();
                lnkDescription.NavigateUrl = Constants.ROOT_DIRECTORY + "/MasterFiles/_Product/Default.aspx?task=" + Common.Encrypt("det", Session.SessionID) + "&id=" + Common.Encrypt(dr["ProductID"].ToString(), Session.SessionID);

                HyperLink lnkMatrixDescription = (HyperLink)e.Item.FindControl("lnkMatrixDescription");
                if (dr["MatrixDescription"].ToString() == string.Empty || dr["MatrixDescription"].ToString() == null)
                {
                    lnkMatrixDescription.Text = "_";
                }
                else
                {
                    lnkMatrixDescription.Text        = dr["MatrixDescription"].ToString();
                    lnkMatrixDescription.NavigateUrl = Constants.ROOT_DIRECTORY + "/MasterFiles/_Product/_VariationsMatrix/Default.aspx?task=" + Common.Encrypt("det", Session.SessionID) + "&prodid=" + Common.Encrypt(dr["ProductID"].ToString(), Session.SessionID) + "&id=" + Common.Encrypt(dr["VariationMatrixID"].ToString(), Session.SessionID);
                }

                Label lblQuantity = (Label)e.Item.FindControl("lblQuantity");
                lblQuantity.Text = Convert.ToDecimal(dr["Quantity"].ToString()).ToString("#,##0.#0");

                Label lblProductUnitID = (Label)e.Item.FindControl("lblProductUnitID");
                lblProductUnitID.Text = dr["ProductUnitID"].ToString();

                Label lblProductUnitCode = (Label)e.Item.FindControl("lblProductUnitCode");
                lblProductUnitCode.Text = dr["ProductUnitCode"].ToString();

                Label lblUnitCost = (Label)e.Item.FindControl("lblUnitCost");
                lblUnitCost.Text = Convert.ToDecimal(dr["UnitCost"].ToString()).ToString("#,##0.#0");

                Label lblDiscountApplied = (Label)e.Item.FindControl("lblDiscountApplied");
                lblDiscountApplied.Text = Convert.ToDecimal(dr["DiscountApplied"].ToString()).ToString("#,##0.#0");

                DiscountTypes DiscountType = (DiscountTypes)Enum.Parse(typeof(DiscountTypes), dr["DiscountType"].ToString());
                if (DiscountType == DiscountTypes.Percentage)
                {
                    Label lblPercent = (Label)e.Item.FindControl("lblPercent");
                    lblPercent.Visible = true;
                }

                Label lblAmount = (Label)e.Item.FindControl("lblAmount");
                lblAmount.Text = Convert.ToDecimal(dr["Amount"].ToString()).ToString("#,##0.#0");

                Label lblVAT = (Label)e.Item.FindControl("lblVAT");
                lblVAT.Text = Convert.ToDecimal(dr["VAT"].ToString()).ToString("#,##0.#0");

                Label lblEVAT = (Label)e.Item.FindControl("lblEVAT");
                lblEVAT.Text = Convert.ToDecimal(dr["EVAT"].ToString()).ToString("#,##0.#0");

                Label lblisVATInclusive = (Label)e.Item.FindControl("lblisVATInclusive");
                lblisVATInclusive.Text = Convert.ToBoolean(Convert.ToInt16(dr["isVATInclusive"].ToString())).ToString();

                Label lblLocalTax = (Label)e.Item.FindControl("lblLocalTax");
                lblLocalTax.Text = Convert.ToDecimal(dr["LocalTax"].ToString()).ToString("#,##0.#0");

                Label lblRemarks = (Label)e.Item.FindControl("lblRemarks");
                lblRemarks.Text = dr["Remarks"].ToString();

                //For anchor
                HtmlGenericControl divExpCollAsst = (HtmlGenericControl)e.Item.FindControl("divExpCollAsst");

                HtmlAnchor anchorDown = (HtmlAnchor)e.Item.FindControl("anchorDown");
                anchorDown.HRef = "javascript:ToggleDiv('" + divExpCollAsst.ClientID + "')";
            }
        }
Ejemplo n.º 58
0
        /// <summary>
        /// Evento ItemDataBound del repeater RepeaterElaboratiTecnici per ElaboratiTecnici
        /// </summary>
        /// <param name="Sender"></param>
        /// <param name="e"></param>
        protected void RepeaterElaboratiTecnici_ItemDataBound(Object Sender, RepeaterItemEventArgs e)
        {
            if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem)
            {
                HtmlAnchor href = new HtmlAnchor();
                //string script="javascript:opendoc('var_doc=" + DataBinder.Eval(e.Item.DataItem, "var_doc") +  ".pdf');";
                //Context.Items.Add("var_doc",DataBinder.Eval(e.Item.DataItem, "var_doc").ToString());
                string script = "javascript:opendoc('var_doc=" + DataBinder.Eval(e.Item.DataItem, "var_doc") + "');";

                href.HRef      = script;
                href.InnerText = DataBinder.Eval(e.Item.DataItem, "var_file_name").ToString();
                ((PlaceHolder)e.Item.FindControl("placercontrols")).Controls.Add(href);
            }

//
//				if ((DataBinder.Eval(e.Item.DataItem, "var_file_pdf")!=System.DBNull.Value)
//					&& (DataBinder.Eval(e.Item.DataItem, "var_file_pdf").ToString()!=""))
//				{
//					HtmlAnchor href= new HtmlAnchor();
//					//string script="javascript:opendoc('var_doc=" + DataBinder.Eval(e.Item.DataItem, "var_doc") +  ".pdf');";
//					//Context.Items.Add("var_doc",DataBinder.Eval(e.Item.DataItem, "var_doc").ToString());
//					string script="javascript:opendoc('var_doc=" + DataBinder.Eval(e.Item.DataItem, "var_doc") +  "');";
//					href.HRef=script;
//					href.InnerText =DataBinder.Eval(e.Item.DataItem, "var_file_name").ToString();
//					((PlaceHolder)e.Item.FindControl("placercontrols")).Controls.Add(href);
//				}
//				else
//				{
//					PlaceHolder Place=(PlaceHolder)e.Item.FindControl("placercontrols");
//					Literal lite=new Literal();
//					lite.Text=DataBinder.Eval(e.Item.DataItem, "var_file_name").ToString();
//					Place.Controls.Add(lite);
//
//					if ((DataBinder.Eval(e.Item.DataItem, "var_file_dwf")!=System.DBNull.Value)
//						&& (DataBinder.Eval(e.Item.DataItem, "var_file_dwf").ToString()!=""))
//						{
//							HtmlImage img=new HtmlImage();
//							img.Src="../Images/dwf.jpg";
//							img.Border=0;
//							img.Alt="Visualizza Schema";
//
//							HtmlAnchor href= new HtmlAnchor();
//							string script="javascript:opendoc('var_afm_dwgs_dwg_name=" +  DataBinder.Eval(e.Item.DataItem, "var_file_name") + ".dwf');";
//							href.HRef=script;
//
//		                    href.Controls.Add(img);
//							Place.Controls.Add(href);
//						}
//
//						if ((DataBinder.Eval(e.Item.DataItem, "var_file_jpg")!=System.DBNull.Value)
//							&& (DataBinder.Eval(e.Item.DataItem, "var_file_jpg").ToString()!=""))
//						{
//							HtmlImage img=new HtmlImage();
//							img.Src="../Images/img.gif";
//							img.Border=0;
//							img.Alt="Visualizza Immagine";
//
//							HtmlAnchor href= new HtmlAnchor();
//							string script="javascript:opendoc('var_afm_dwgs_dwg_name=" +  DataBinder.Eval(e.Item.DataItem, "var_file_name") + ".jpg');";
//							href.HRef=script;
//
//							href.Controls.Add(img);
//							Place.Controls.Add(href);
//						}

            //}//end if

            //}end if
        }
Ejemplo n.º 59
0
        protected void rptTourListItemCreated(object sender, RepeaterItemEventArgs e)
        {
            if (e.Item.ItemIndex != -1)
            {
                EyouSoft.Model.NewTourStructure.MShopRoute RouteModel = e.Item.DataItem as EyouSoft.Model.NewTourStructure.MShopRoute;
                if (RouteModel != null)
                {
                    Literal ltr = e.Item.FindControl("ltrTuiGuang") as Literal;
                    if (ltr != null)
                    {
                        ltr.Text = GetRecommendType(((int)RouteModel.RecommendType).ToString());
                    }

                    HtmlAnchor a = e.Item.FindControl("linkTour") as HtmlAnchor;
                    if (a != null)
                    {
                        a.HRef = Utils.GenerateShopPageUrl2("/TourDetail_" + RouteModel.RouteId, this.Master.CompanyId);
                    }

                    Literal litRouteName = e.Item.FindControl("LitRouteName") as Literal;
                    if (litRouteName != null)
                    {
                        litRouteName.Text = RouteModel.RouteName;
                    }

                    if (RouteModel.RouteSource == EyouSoft.Model.NewTourStructure.RouteSource.地接社添加)
                    {
                        // 班次
                        ltr = e.Item.FindControl("ltrCurrentTour") as Literal;
                        if (ltr != null)
                        {
                            ltr.Text = "暂无";
                        }
                        //市场价
                        ltr = e.Item.FindControl("ltrPrices") as Literal;
                        if (ltr != null)
                        {
                            ltr.Text = "电询";
                        }
                    }
                    else
                    {
                        IList <EyouSoft.Model.NewTourStructure.MPowderList> PowerList = EyouSoft.BLL.NewTourStructure.BPowderList.CreateInstance().GetList(RouteModel.RouteId);
                        if (PowerList != null && PowerList.Count > 0)
                        {
                            ltr = e.Item.FindControl("ltrCurrentTour") as Literal;
                            if (ltr != null)
                            {
                                ltr.Text = RouteModel.TeamPlanDes;
                            }
                            ltr = e.Item.FindControl("ltrPrices") as Literal;
                            if (ltr != null)
                            {
                                ltr.Text = string.Format("门市价:{0}起",
                                                         RouteModel.RetailAdultPrice.ToString("F0"));
                            }
                        }
                        else
                        {
                            ltr = e.Item.FindControl("ltrCurrentTour") as Literal;
                            if (ltr != null)
                            {
                                ltr.Text = "暂无";
                            }
                            ltr = e.Item.FindControl("ltrPrices") as Literal;
                            if (ltr != null)
                            {
                                ltr.Text = "电询";
                            }
                        }
                    }


                    //¥200/150 单房差
                    ltr = e.Item.FindControl("ltrDanFangCha") as Literal;
                    if (ltr != null)
                    {
                        ltr.Text = RouteModel.StartCityName;
                    }

                    ltr = e.Item.FindControl("linkMQ") as Literal;
                    if (ltr != null)
                    {
                        ltr.Text = Utils.GetMQ(this.Master.CompanyId);
                    }
                }
            }
        }