Exemplo n.º 1
0
    private void Bind()
    {
        Mod_Information dto = new Mod_Information();

        if (id != 0)
        {
            dto = BInformation.GetModel(string.Format("ID={0} AND WebSiteID={1}", id, AdminManage.WebSiteID));
            if (dto != null)
            {
                txtTitle.Text        = dto.Title;
                txtContent.Text      = dto.Content1;
                txtImage.Text        = dto.Image;
                txtVideo.Text        = dto.FileURL;
                txtIntroduction.Text = dto.Introduction;

                //绑定图片集
                rptPicList.DataSource = BPicList.GetList(0, string.Format("ProductID={0} AND WebSiteID={1} AND Model='XWXC' and State=1 ", id, AdminManage.WebSiteID), " OrderBy asc,ID asc ");
                rptPicList.DataBind();
            }
            else
            {
                MessageBox.ShowRedirect(this, "信息已删除或不存在!", "Column/Default/Index.aspx");
            }
        }
    }
Exemplo n.º 2
0
    private void Bind()
    {
        if (IsType == 1)
        {
            ddlBaseType.Attributes.Add("datatype", "no0");
        }
        if (IsBrowseCount == 1)
        {
            txtBrowseCount.Attributes.Add("datatype", "n");
        }
        if (IsAddDate == 1)
        {
            txtAddDate.Attributes.Add("datatype", "datetime");
        }

        txtAddDate.Value  = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
        CommendDate.Value = DateTime.Now.ToString("yyyy-MM-dd");
        Mod_Information dto = new Mod_Information();

        if (id != 0)
        {
            dto = BInformation.GetModel(string.Format("ID={0} AND WebSiteID={1}", id, AdminManage.WebSiteID));
            if (dto != null)
            {
                txtTitle.Text             = dto.Title;
                txtSubTitle.Text          = dto.SubTitle;
                ddlBaseType.SelectedValue = dto.TypeID.ToString();



                txtImage.Text         = dto.Image;
                txtVideo.Text         = dto.FileURL;
                txtCitationTitle.Text = dto.CitationTitle;

                txtContent1.Text = dto.Content1;
                txtOrderBy.Text  = dto.OrderBy.ToString();

                foreach (ListItem item in cblShow.Items)
                {
                    switch (item.Value)
                    {
                    case "1":
                        item.Selected = (dto.State == 1);
                        break;

                    case "2":
                        item.Selected = (dto.IsTop == 1);
                        break;

                    case "3":
                        item.Selected = (dto.IsCommend == 1);
                        break;
                    }
                }

                txtOrderBy.Text     = dto.OrderBy.ToString();
                txtBrowseCount.Text = dto.BrowseCount.ToString();
                txtAddDate.Value    = DateTime.Parse(dto.AddDate.ToString()).ToString("yyyy-MM-dd HH:mm:ss");
                CommendDate.Value   = DateTime.Parse(dto.CommendDate.ToString()).ToString("yyyy-MM-dd");
                txtSource.Text      = dto.Source;
                txtAuthor.Text      = dto.Author;


                lbIntroduction.SelectedValue = dto.Introduction.ToString();
                lbLink.SelectedValue         = dto.Link.ToString();


                //foreach (ListItem item in lbIntroduction.Items)
                //{
                //    if (dto.Introduction.IndexOf(item.Value) > -1)
                //    {
                //        item.Selected = true;
                //    }
                //}

                //foreach (ListItem item in lbLink.Items)
                //{
                //    if (dto.Link.IndexOf(item.Value) > -1)
                //    {
                //        item.Selected = true;
                //    }
                //}



                //绑定图片集
                rptPicList.DataSource = BPicList.GetList(0, string.Format("ProductID={0} AND WebSiteID={1} AND Model='XWXC' and State=1 ", id, AdminManage.WebSiteID), " OrderBy asc,ID asc ");
                rptPicList.DataBind();

                //绑定文件集
                rptFileList.DataSource = BPicList.GetList(0, string.Format("ProductID={0} AND WebSiteID={1} AND Model='XTWJ' and State=1 ", id, AdminManage.WebSiteID), " OrderBy asc,ID asc ");
                rptFileList.DataBind();
            }
            else
            {
                MessageBox.ShowRedirect(this, "信息已删除或不存在!", "Column/Download/List.aspx?" + StringHelper.DelUrlParameter("ID"));
            }
        }
        else
        {
            int TypeID = DNTRequest.GetQueryInt("TypeID", 0);
            ddlBaseType.SelectedValue = TypeID.ToString();
        }
    }