Ejemplo n.º 1
0
        private void Bind()
        {
            ShareSiteMapProvider ssmp = new ShareSiteMapProvider();
            var currNode = ssmp.FindSiteMapNode(HttpContext.Current);
            var bll      = new ContentDetail();
            var model    = bll.GetModelByTitle(currNode.Title);

            if (model == null)
            {
                MessageBox.Messager(this.Page, MC.Submit_Data_NotExists, MC.AlertTitle_Ex_Error, "error");
                return;
            }

            StringBuilder sb = new StringBuilder();

            sb.Append(model.ContentText);

            string picUrl     = PictureUrlHelper.GetUrl(model.FileDirectory, model.RandomFolder, model.FileExtension, EnumData.PictureType.OriginalPicture, EnumData.Platform.PC);
            var    picFullPth = Server.MapPath("~" + picUrl + "");
            int    width      = 0;
            int    height     = 0;

            if (File.Exists(picFullPth))
            {
                var img = System.Drawing.Image.FromFile(picFullPth);
                width  = img.Width;
                height = img.Height;
            }
            sb.AppendFormat(@"<div id=""myDataAppend"" style=""display:none;"">{{""banner"":""{0}"",""width"":""{1}"",""height"":""{2}""}}</div>", picUrl.Replace("/Files/", "/sw/Files/"), width, height);

            ltrMyData.Text = sb.ToString();
        }
Ejemplo n.º 2
0
        private void Bind()
        {
            if (!Id.Equals(Guid.Empty))
            {
                Page.Title = "编辑广告";

                Advertisement bll = new Advertisement();

                var model = bll.GetModelByJoin(Id);
                if (model != null)
                {
                    hId.Value                 = Id.ToString();
                    txtTitle.Value            = model.Title;
                    txtTimeout.Value          = model.Timeout.ToString();
                    txtSort.Value             = model.Sort.ToString();
                    txtStartTime.Value        = model.StartTime.ToString("yyyy-MM-dd HH:mm:ss");
                    txtEndTime.Value          = model.EndTime.ToString("yyyy-MM-dd HH:mm:ss");
                    txtVirtualViewCount.Value = model.VirtualViewCount.ToString();
                    txtaDescr.Value           = model.Descr;
                    txtContent.Value          = model.ContentText;

                    string            imgContentPictureHtml = "";
                    AdvertisementLink alBll = new AdvertisementLink();
                    var picList             = alBll.GetDsByAdId(Id);
                    if (picList != null && picList.Tables.Count > 0 && picList.Tables[0].Rows.Count > 0)
                    {
                        string adTemplateText = File.ReadAllText(Server.MapPath("~/Templates/PartialAdvertisement.txt"));

                        DataRowCollection drc = picList.Tables[0].Rows;
                        foreach (DataRow dr in drc)
                        {
                            string currTemplateText = adTemplateText;

                            string dir       = dr["FileDirectory"] == null ? "" : dr["FileDirectory"].ToString().Trim();
                            string fileEx    = dr["FileExtension"] == null ? "" : dr["FileExtension"].ToString().Trim();
                            string rndCode   = dr["RandomFolder"] == null ? "" : dr["RandomFolder"].ToString().Trim();
                            string sMPicture = "";
                            if (!string.IsNullOrWhiteSpace(dir) && !string.IsNullOrWhiteSpace(fileEx) && !string.IsNullOrWhiteSpace(rndCode))
                            {
                                EnumData.PictureType picType  = EnumData.PictureType.MPicture;
                                EnumData.Platform    platform = EnumData.Platform.Android;
                                sMPicture = PictureUrlHelper.GetUrl(dir, rndCode, fileEx, picType, platform);
                            }

                            imgContentPictureHtml += string.Format(currTemplateText, sMPicture, dr["ContentPictureId"], dr["ActionTypeId"], dr["Url"], dr["Sort"], dr["IsDisable"], dr["Id"]);
                        }

                        ltrImgItem.Text = imgContentPictureHtml;
                    }

                    myDataAppend += "<div id=\"myDataForModel\">[{\"SiteFunId\":\"" + model.SiteFunId + "\",\"LayoutPositionId\":\"" + model.LayoutPositionId + "\",\"IsDisable\":\"" + model.IsDisable + "\"}]</div>";
                }
            }
        }
        private void Bind()
        {
            var bll   = new ContentDetail();
            var model = bll.GetModelByTypeCode(EnumData.MenuRoot.ProductAgreement.ToString());

            if (model != null)
            {
                ltrEditorContent.Text = model.ContentText;
            }

            string picUrl = PictureUrlHelper.GetUrl(model.FileDirectory, model.RandomFolder, model.FileExtension, EnumData.PictureType.OriginalPicture, EnumData.Platform.PC);

            agreementContainer.Style.Add("background-image", "url('" + picUrl + "')");
        }
Ejemplo n.º 4
0
        private void Bind()
        {
            ShareSiteMapProvider ssmp = new ShareSiteMapProvider();
            var currNode = ssmp.FindSiteMapNode(HttpContext.Current);

            this.Page.Title = currNode.Title;

            var aId = Guid.Empty;

            if (!string.IsNullOrWhiteSpace(Request.QueryString["aId"]))
            {
                Guid.TryParse(Request.QueryString["aId"], out aId);
            }
            if (!aId.Equals(Guid.Empty))
            {
                if (phUc.FindControl("UCRArticleDetail") == null)
                {
                    Control ctl = this.LoadControl("~/WebUserControls/UCRArticleDetail.ascx");
                    ctl.ID = "UCRArticleDetail";
                    phUc.Controls.Clear();
                    phUc.Controls.Add(ctl);
                }
            }
            else
            {
                BindUc(currNode.Title);
            }

            var bll   = new ContentDetail();
            var model = bll.GetModelByTitle(currNode.Title);

            if (model == null)
            {
                MessageBox.Messager(this.Page, MC.Submit_Data_NotExists, MC.AlertTitle_Ex_Error, "error");
                return;
            }

            StringBuilder sb = new StringBuilder();

            sb.Append(model.ContentText);

            string picUrl = PictureUrlHelper.GetUrl(model.FileDirectory, model.RandomFolder, model.FileExtension, EnumData.PictureType.OriginalPicture, EnumData.Platform.PC);
            int    width  = 0;
            int    height = 0;

            sb.AppendFormat(@"<div id=""myDataAppend"" style=""display:none;"">{{""banner"":""{0}"",""width"":""{1}"",""height"":""{2}""}}</div>", picUrl.Replace("/Files/", "/sw/Files/"), width, height);

            ltrMyData.Text = sb.ToString();
        }