Пример #1
0
    protected void Page_Load(object sender, EventArgs e)
    {
        ModelInfo = PageCommon.GetModelInformation(id);

        ModelBaseType = PageCommon.GetModelType(ModelInfo.TypeID);
        string ObjIDPath = ModelBaseType.IDPath;

        TopNavigation1.ObjIDPath = ObjIDPath;
        ucLeft1.TypeId           = ObjIDPath.Split(',')[1].ToString();
        ucLeft1.ParentId         = ObjIDPath.Split(',')[0].ToString();

        MBaseType = PageCommon.GetModelType(int.Parse(ObjIDPath.Split(',')[0].ToString()));
        //if (ModelBaseType.Image != "")
        //{
        //    MBaseType.Image = ModelBaseType.Image;
        //}
        _ucheader1.ParentID = ObjIDPath.Split(',')[0].ToString();
        _ucheader1.TypeId   = ModelBaseType.ID.ToString();

        //统计浏览量
        OperateHelper.SetInformationClick(ModelInfo.ID);


        Bll_PicList BPicList = new Bll_PicList();

        //绑定图片集
        PicList = BPicList.GetModelList("Model='XWXC' and ProductID=" + id + " and State=1 AND WebSiteID=" + PageCommon.LanguageID + " ORDER BY OrderBy asc,ID asc ");


        //上一页下一页
        Mod_Information dto2 = GetInfo.GetLastInfo(ModelInfo, "OrderBy desc,AddDate DESC", string.Format("TypeID={0} And Model='{1}' and WebSiteID={2}", ModelInfo.TypeID, ModelInfo.Model, PageCommon.LanguageID));

        if (dto2 != null)
        {
            LastInfo = "<div><strong>上一篇:</strong><a href=\"NewsInfo.aspx?id=" + dto2.ID + "\"  class=\"els\">" + dto2.Title + "</a></div>";
        }
        else
        {
            LastInfo = "<div><strong>上一篇:</strong><a class=\"els\">没有了</a></div>";
        }

        Mod_Information dto3 = GetInfo.GetNextInfo(ModelInfo, "OrderBy desc,AddDate DESC", string.Format("TypeID={0} And Model='{1}' and WebSiteID={2}", ModelInfo.TypeID, ModelInfo.Model, PageCommon.LanguageID));

        if (dto3 != null)
        {
            NextInfo = "<div><strong>下一篇:</strong><a href=\"NewsInfo.aspx?id=" + dto3.ID + "\"  class=\"els\">" + dto3.Title + "</a></div>";
        }
        else
        {
            NextInfo = "<div><strong>下一篇:</strong><a class=\"els\">没有了</a></div>";
        }
        LinkBind();
    }
Пример #2
0
    protected void btnEdit_Click(object sender, EventArgs e)
    {
        if (txtTitle.Text.Trim() == "")
        {
            MessageBox.Show(this, "请填写完整信息再提交保存");
            return;
        }
        Mod_AdminMenu dto         = new Mod_AdminMenu();
        string        ParentIDStr = string.Empty;
        string        IDPathStr   = string.Empty;
        string        strtype     = string.Empty;

        if (id != 0)
        {
            dto         = BAdmin_Menu.GetModel(id);
            strtype     = dto.TypeName;
            ParentIDStr = dto.ParentID.ToString();
            IDPathStr   = dto.IDPath;
        }
        dto.Title    = txtTitle.Text.Trim();
        dto.ParentID = int.Parse(ddlMenu.SelectedValue);
        dto.State    = int.Parse(rblState.SelectedValue);
        dto.IsCopy   = int.Parse(rblIsCopy.SelectedValue);

        dto.Url       = txtUrl.Text.Trim();
        dto.OrderBy   = int.Parse(txtOrderBy.Text.Trim());
        dto.WebSiteID = int.Parse(ddlWebSite.SelectedValue);

        dto.FunctionModel = FunctionModel.Text;
        dto.TypeName      = ddlstTypeName.SelectedValue;
        dto.WebSiteManage = ddlWebSiteManage.SelectedValue;
        dto.Attributes    = GetChecked(this.cblShow, ",");

        string parameter = string.Empty;

        for (int i = 0; i < cblShow.Items.Count; i++)
        {
            if (cblShow.Items[i].Selected)
            {
                parameter += "&" + cblShow.Items[i].Value + "=1";
            }
        }

        if (id != 0)
        {
            string strHref = string.Empty;
            switch (ddlWebSiteManage.SelectedValue)
            {
            case "Type":     //分类管理
                strHref = "Column/BaseType/List.aspx?Model={0}&IsAdd=1" + parameter;
                dto.Url = string.Format(strHref, FunctionModel.Text);
                break;

            case "About":    //单篇文章
                if (strtype != dto.TypeName)
                {
                    strHref = "Column/About/Edit.aspx?ID={1}" + parameter;
                    WebSite.BLL.Bll_BaseType      BBaseType    = new WebSite.BLL.Bll_BaseType();
                    WebSite.BLL.Bll_Information   BInformation = new WebSite.BLL.Bll_Information();
                    WebSite.Model.Mod_Information MInformation = new WebSite.Model.Mod_Information();
                    WebSite.Model.Mod_BaseType    MBaseType    = new WebSite.Model.Mod_BaseType();

                    MBaseType = BBaseType.GetModel(string.Format("ID={0} AND WebSiteID={1}", this.ddlstTypeName.SelectedValue, AdminManage.WebSiteID));

                    MInformation.Title     = MBaseType.Title;
                    MInformation.TypeID    = int.Parse(ddlstTypeName.SelectedItem.Value);
                    MInformation.State     = 1;
                    MInformation.Content1  = MBaseType.Title;
                    MInformation.Model     = MBaseType.Model.ToString();
                    MInformation.WebSiteID = AdminManage.WebSiteID;
                    MInformation.AddDate   = DateTime.Now;
                    int flag = BInformation.Add(MInformation);
                    MInformation.ID = flag;
                    BInformation.Update(MInformation);
                    dto.Url = string.Format(strHref, MInformation.Model, flag);
                }
                else
                {
                    dto.Url = dto.Url.Split('&')[0] + parameter;
                }
                break;

            case "News":    //文字新闻
                strHref = "Column/Information/List.aspx?Model={0}&managetype={1}" + parameter;
                dto.Url = string.Format(strHref, FunctionModel.Text, ddlstTypeName.SelectedValue);
                break;

            case "Link":     //友情链接
                strHref = "Column/Link/List.aspx?Model={0}" + parameter;
                dto.Url = string.Format(strHref, FunctionModel.Text);
                break;
            }
            BAdmin_Menu.Update(dto, true);
        }
        else
        {
            string strHref = string.Empty;
            switch (ddlWebSiteManage.SelectedValue)
            {
            case "Type":     //分类管理
                strHref = "Column/BaseType/List.aspx?Model={0}&IsAdd=1" + parameter;
                dto.Url = string.Format(strHref, FunctionModel.Text);
                break;

            case "About":    //单篇文章
                strHref = "Column/About/Edit.aspx?ID={1}" + parameter;
                WebSite.BLL.Bll_BaseType      BBaseType    = new WebSite.BLL.Bll_BaseType();
                WebSite.BLL.Bll_Information   BInformation = new WebSite.BLL.Bll_Information();
                WebSite.Model.Mod_Information MInformation = new WebSite.Model.Mod_Information();
                WebSite.Model.Mod_BaseType    MBaseType    = new WebSite.Model.Mod_BaseType();

                MBaseType              = BBaseType.GetModel(string.Format("ID={0} AND WebSiteID={1}", this.ddlstTypeName.SelectedValue, AdminManage.WebSiteID));
                MInformation.Title     = MBaseType.Title;
                MInformation.TypeID    = int.Parse(ddlstTypeName.SelectedItem.Value);
                MInformation.State     = 1;
                MInformation.Content1  = MBaseType.Title;
                MInformation.Model     = MBaseType.Model.ToString();
                MInformation.WebSiteID = AdminManage.WebSiteID;
                MInformation.AddDate   = DateTime.Now;
                int flag = BInformation.Add(MInformation);
                MInformation.ID = flag;
                BInformation.Update(MInformation);
                dto.Url = string.Format(strHref, MInformation.Model, flag);
                break;

            case "News":    //文字新闻
                strHref = "Column/Information/List.aspx?Model={0}&managetype={1}" + parameter;
                dto.Url = string.Format(strHref, FunctionModel.Text, ddlstTypeName.SelectedValue);
                break;

            case "Link":     //友情链接
                strHref = "Column/Link/List.aspx?Model={0}" + parameter;
                dto.Url = string.Format(strHref, FunctionModel.Text);
                break;
            }

            BAdmin_Menu.Add(dto, true);
        }

        MessageBox.ShowRedirect(this, "信息(" + txtTitle.Text.Trim() + ")保存成功!", "Column/Admin_Menu/List.aspx?" + StringHelper.DelUrlParameter("ID"));
    }