Example #1
0
    /// <summary>
    /// 获取分类信息
    /// </summary>
    /// <param name="TypeId"></param>
    /// <returns></returns>
    public static WebSite.Model.Mod_BaseType GetModelType(object TypeId)
    {
        WebSite.BLL.Bll_BaseType bll_BaseType = new WebSite.BLL.Bll_BaseType();

        return(bll_BaseType.GetModel(string.Format(" ID ={0} AND WebSiteID={1}", TypeId, PageCommon.LanguageID)));
    }
Example #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"));
    }