コード例 #1
0
        private void Bind()
        {
            if (!Id.Equals(Guid.Empty))
            {
                Page.Title = "编辑内容";

                ContentDetail bll   = new ContentDetail();
                var           model = bll.GetModelByJoin(Id);
                if (model != null)
                {
                    hId.Value       = Id.ToString();
                    txtTitle.Value  = model.Title;
                    txtParent.Value = model.ContentTypeId.ToString();
                    string pictureUrl = "";
                    if (!string.IsNullOrWhiteSpace(model.FileDirectory))
                    {
                        pictureUrl = PictureUrlHelper.GetMPicture(model.FileDirectory, model.RandomFolder, model.FileExtension);
                    }
                    imgPicture.Src            = string.IsNullOrWhiteSpace(pictureUrl) ? "/sw/Images/nopic.gif" : "/sw/" + pictureUrl;
                    hPictureId.Value          = model.PictureId.ToString();
                    txtaDescr.Value           = model.Descr;
                    txtContent.Value          = model.ContentText;
                    txtVirtualViewCount.Value = model.VirtualViewCount.ToString();
                    txtSort.Value             = model.Sort.ToString();
                    var li = rbtnlIsDisable.Items.FindByValue(model.IsDisable.ToString().ToLower());
                    if (li != null)
                    {
                        li.Selected = true;
                    }
                }
            }
        }
コード例 #2
0
        private void Bind()
        {
            Guid adItemId = Guid.Empty;

            if (!string.IsNullOrWhiteSpace(Request.QueryString["adItemId"]))
            {
                Guid.TryParse(Request.QueryString["adItemId"], out adItemId);
            }
            if (!adItemId.Equals(Guid.Empty))
            {
                ddlActionType.Enabled = false;

                AdItem bll   = new AdItem();
                var    model = bll.GetModelByJoin(adItemId);
                if (model == null)
                {
                    MessageBox.Messager(this.Page, MessageContent.GetString(MessageContent.Submit_Data_NotExists, "广告项ID【" + adItemId + "】"), MessageContent.AlertTitle_Ex_Error, "error");
                    return;
                }
                hAdItemId.Value     = model.Id.ToString();
                hImgPictureId.Value = model.PictureId.ToString();
                imgPicture.Src      = PictureUrlHelper.GetMPicture(model.FileDirectory, model.RandomFolder, model.FileExtension);
                var li = ddlActionType.Items.FindByValue(model.ActionTypeId.ToString());
                if (li != null)
                {
                    li.Selected = true;
                }
                txtSort.Value       = model.Sort.ToString();
                cbIsDisable.Checked = model.IsDisable;

                ltrMyOldData.Text = "<span id=\"myOldData\" style=\"display:none;\">{\"PictureId\":\"" + model.PictureId + "\",\"ActionTypeId\":\"" + model.ActionTypeId + "\",\"Sort\":\"" + model.Sort + "\",\"IsDisable\":\"" + model.IsDisable + "\"}</span>";
            }
        }
コード例 #3
0
        private void Bind()
        {
            if (!Id.Equals(Guid.Empty))
            {
                ServiceLink bll   = new ServiceLink();
                var         model = bll.GetModelByJoin(Id);
                if (model != null)
                {
                    hServiceLinkId.Value       = model.Id.ToString();
                    txtNamed_ServiceLink.Value = model.Named;

                    string pictureUrl = "";
                    if (!string.IsNullOrWhiteSpace(model.FileDirectory))
                    {
                        pictureUrl = PictureUrlHelper.GetMPicture(model.FileDirectory, model.RandomFolder, model.FileExtension);
                    }

                    imgPicture_ServiceLink.Src           = string.IsNullOrWhiteSpace(pictureUrl) ? "../../Images/nopic.gif" : pictureUrl;
                    hPictureId_ServiceLink.Value         = model.PictureId.ToString();
                    txtUrl_ServiceLink.Value             = model.Url;
                    txtEnableStartTime_ServiceLink.Value = model.EnableStartTime == DateTime.MinValue ? "" : model.EnableStartTime.ToString("yyyy-MM-dd HH:mm:ss");
                    txtEnableEndTime_ServiceLink.Value   = model.EnableStartTime == DateTime.MinValue ? "" : model.EnableStartTime.ToString("yyyy-MM-dd HH:mm:ss");
                    var li = rbtnList_ServiceLink.Items.FindByValue(model.IsDisable.ToString().ToLower());
                    if (li != null)
                    {
                        li.Selected = true;
                    }

                    myDataAppend.Append("<div code=\"myDataForModel\">[{\"Id\":\"" + model.Id + "\",\"ServiceItemId\":\"" + model.ServiceItemId + "\",\"ServiceItemName\":\"" + model.ServiceItemName + "\",\"Sort\":\"" + model.Sort + "\"}]</div>");
                }
            }
        }
コード例 #4
0
 private void Bind()
 {
     if (!string.IsNullOrWhiteSpace(Request.QueryString["productItemId"]))
     {
         Guid productItemId = Guid.Empty;
         Guid.TryParse(Request.QueryString["productItemId"], out productItemId);
         if (!productItemId.Equals(Guid.Empty))
         {
             ProductSizePicture bll = new ProductSizePicture();
             var model = bll.GetModelByJoin(productId, productItemId);
             if (model != null)
             {
                 hAction_ProductSizePicture.Value = Request.QueryString["action"];
                 txtName.Value = model.Named;
                 string pictureUrl = "";
                 if (!string.IsNullOrWhiteSpace(model.FileDirectory))
                 {
                     pictureUrl = PictureUrlHelper.GetMPicture(model.FileDirectory, model.RandomFolder, model.FileExtension);
                 }
                 imgProductSizePicture.Src      = string.IsNullOrWhiteSpace(pictureUrl) ? "../../Images/nopic.gif" : pictureUrl;
                 hImgProductSizePictureId.Value = model.PictureId.ToString();
                 var li = ddlProductItem_ProductSizePicture.Items.FindByValue(model.ProductItemId.ToString());
                 if (li != null)
                 {
                     li.Selected = true;
                 }
             }
         }
     }
 }
コード例 #5
0
        private void Bind()
        {
            if (!Id.Equals(Guid.Empty))
            {
                Page.Title = "编辑商品";

                Product piBll = new Product();
                var     model = piBll.GetModelByJoin(Id);
                if (model != null)
                {
                    txtName.Value = model.Named;
                    txtSort.Value = model.Sort.ToString();

                    string pictureUrl = "";
                    if (!string.IsNullOrWhiteSpace(model.FileDirectory))
                    {
                        pictureUrl = PictureUrlHelper.GetMPicture(model.FileDirectory, model.RandomFolder, model.FileExtension);
                    }
                    imgProductPicture.Src      = string.IsNullOrWhiteSpace(pictureUrl) ? "../../Images/nopic.gif" : pictureUrl;
                    hImgProductPictureId.Value = model.PictureId.ToString();
                    txtEnableStartTime.Value   = model.EnableStartTime.ToString("yyyy-MM-dd HH:mm:ss");
                    txtEnableEndTime.Value     = model.EnableEndTime.ToString("yyyy-MM-dd HH:mm:ss");
                    hId.Value = Id.ToString();

                    if (myDataAppend == null)
                    {
                        myDataAppend = new StringBuilder();
                    }
                    myDataAppend.Append("<div id=\"myDataForModel\">[");
                    myDataAppend.Append("{\"IsEnable\":\"" + model.IsEnable.ToString().ToLower() + "\",\"IsDisable\":\"" + model.IsDisable.ToString().ToLower() + "\",\"CategoryId\":\"" + model.CategoryId + "\",\"BrandId\":\"" + model.BrandId + "\",\"MenuId\":\"" + model.MenuId.ToString().Replace(Guid.Empty.ToString(), "") + "\"}");
                    myDataAppend.Append("]</div>");
                }
            }
        }
コード例 #6
0
        private void Bind()
        {
            Dictionary <string, string> dicPicture = new Dictionary <string, string>();

            if (!productItemId.Equals(Guid.Empty))
            {
                ProductImage bll   = new ProductImage();
                var          model = bll.GetModel(productItemId);
                if (model != null)
                {
                    var li = ddlProductItem_ProductImage.Items.FindByValue(model.ProductItemId.ToString());
                    if (li != null)
                    {
                        li.Selected = true;
                    }

                    XElement xel = XElement.Parse(model.PictureAppend);
                    var      q   = from x in xel.Descendants("Add")
                                   select new { pictureId = x.Attribute("PictureId").Value };

                    StringBuilder sbInIds = new StringBuilder(1000);

                    foreach (var item in q)
                    {
                        sbInIds.AppendFormat("'{0}',", item.pictureId);
                    }

                    PictureProduct ppBll       = new PictureProduct();
                    var            pictureList = ppBll.GetListInIds(sbInIds.ToString().Trim(','));
                    if (pictureList != null && pictureList.Count > 0)
                    {
                        foreach (var picModel in pictureList)
                        {
                            dicPicture.Add(picModel.Id.ToString(), PictureUrlHelper.GetMPicture(picModel.FileDirectory, picModel.RandomFolder, picModel.FileExtension));
                        }
                    }
                }
            }

            if (dicPicture.Count == 0)
            {
                dicPicture.Add("", "../../Images/nopic.gif");
            }

            rpData.DataSource = dicPicture;
            rpData.DataBind();
        }
コード例 #7
0
        private void BindEdit()
        {
            Guid Id = Guid.Empty;

            if (!string.IsNullOrWhiteSpace(Request.QueryString["Id"]))
            {
                Guid.TryParse(Request.QueryString["Id"], out Id);
            }
            if (!Id.Equals(Guid.Empty))
            {
                ServiceItem bll   = new ServiceItem();
                var         model = bll.GetModelByJoin(Id);
                if (model != null)
                {
                    hId.Value = model.Id.ToString();
                    if (!string.IsNullOrWhiteSpace(model.ParentName))
                    {
                        lbParent.InnerText = model.ParentName;
                        hParentId.Value    = model.ParentId.ToString();
                    }
                    else
                    {
                        lbParent.InnerText = "分类根";
                        hParentId.Value    = Guid.Empty.ToString();
                    }

                    txtName.Value = model.Named;

                    string pictureUrl = "";
                    if (!string.IsNullOrWhiteSpace(model.FileDirectory))
                    {
                        pictureUrl = PictureUrlHelper.GetMPicture(model.FileDirectory, model.RandomFolder, model.FileExtension);
                    }
                    imgServicePicture.Src      = string.IsNullOrWhiteSpace(pictureUrl) ? "../../Images/nopic.gif" : pictureUrl;
                    hImgServicePictureId.Value = model.PictureId.ToString();
                    txtSort.Value            = model.Sort.ToString();
                    txtEnableStartTime.Value = model.EnableStartTime == DateTime.MinValue ? "" : model.EnableStartTime.ToString("yyyy-MM-dd HH:mm:ss");
                    txtEnableEndTime.Value   = model.EnableEndTime == DateTime.MinValue ? "" : model.EnableStartTime.ToString("yyyy-MM-dd HH:mm:ss");
                    var li = rbtnList.Items.FindByValue(model.IsDisable.ToString().ToLower());
                    if (li != null)
                    {
                        li.Selected = true;
                    }
                }
            }
        }
コード例 #8
0
        private void InitEdit(Guid Id)
        {
            Category bll   = new Category();
            var      model = bll.GetModelByJoin(Id);

            if (model != null)
            {
                hId.Value       = model.Id.ToString();
                hParentId.Value = model.ParentId.ToString();
                txtName.Value   = model.CategoryName;
                txtCode.Value   = model.CategoryCode;
                txtSort.Value   = model.Sort.ToString();
                txtRemark.Value = model.Remark;
                string pictureUrl = "";
                if (!string.IsNullOrWhiteSpace(model.FileDirectory))
                {
                    pictureUrl = PictureUrlHelper.GetMPicture(model.FileDirectory, model.RandomFolder, model.FileExtension);
                }
                imgCategoryPicture.Src   = string.IsNullOrWhiteSpace(pictureUrl) ? "../../Images/nopic.gif" : pictureUrl;
                hCategoryPictureId.Value = model.PictureId.ToString();
            }
        }