Example #1
0
 private void doPost()
 {
     light.BLL.news bll = new light.BLL.news();
     model = bll.GetModel(int.Parse(ViewState["nid"].ToString()));
     model.categoryid =int.Parse(Request["categoryid"].ToString());
     model.description =Request["description"];
     if(Request["isopen"]=="on")
     {
         model.isopen =1;
     }
     else
     {
         model.isopen = 0;
     }
             if(Request["isrecommend"]=="on")
     {
         model.isrecommend =1;
     }
     else
     {
         model.isrecommend = 0;
     }
     model.title = Request["title"];
     bll.Update(model);
     Response.Redirect("edit.aspx?nid=" + ViewState["nid"].ToString());
 }
Example #2
0
 private void doPost()
 {
     light.Model.news model = new light.Model.news();
     model.addtime = DateTime.Now;
     model.categoryid =int.Parse(Request["categoryid"].ToString());
     model.description =Request["description"];
     if(Request["isopen"]=="on")
     {
         model.isopen =1;
     }
     else
     {
         model.isopen = 0;
     }
             if(Request["isrecommend"]=="on")
     {
         model.isrecommend =1;
     }
     else
     {
         model.isrecommend = 0;
     }
     model.title = Request["title"];
     light.BLL.news bll = new light.BLL.news();
     bll.Add(model);
     light.Common.WebMessageBox.ShowMessageBox("添加成功", this);
 }
Example #3
0
    protected string bindlist(int cateid)
    {
        string strWhere=" 1=1 ";
        if (cateid != 0)
            strWhere = " categoryid="+cateid.ToString()+" ";
        DataTable dt = new light.BLL.news().GetList(strWhere).Tables[0];
        StringBuilder sb = new StringBuilder();
        foreach (DataRow dr in dt.Rows)
        {

            sb.AppendLine(@" <tr>");
            sb.AppendLine(@"                                <td align=""center"">");
            sb.AppendLine(@"                                    "+dr["id"].ToString());
            sb.AppendLine(@"                                </td>");
            sb.AppendLine(@"");
            sb.AppendLine(@"                                <td width=""*"">");
            sb.AppendLine(@"                                    "+light.Common.Utility.CutString(dr["title"].ToString(),0,15));
            sb.AppendLine(@"                                </td>");
            sb.AppendLine(@"                                <td width=""20%"" align=""center"">");
            sb.AppendLine(@"                                    "+ new light.BLL.newscategory().GetModel(int.Parse(dr["categoryid"].ToString())).cname);
            sb.AppendLine(@"                                </td>");
            sb.AppendLine(@"                                <td align=""center"">");
            sb.AppendLine(@"                                    <a style=""cursor: pointer;"" href='edit.aspx?nid="+dr["id"].ToString() +"'>修改</a>&nbsp;");
            sb.AppendLine(@"                                    <a style=""cursor: pointer;"" onclick='del("+dr["id"].ToString()+");'>删除</a>");
            sb.AppendLine(@"                                </td>");
            sb.AppendLine(@"                            </tr>");
        }
        return sb.ToString();
    }
Example #4
0
    private void showinfo(int id)
    {
        switch (UserState.lng)
        {
            case "cn":
                pageVal = 1;
                break;
            case "kr":
                pageVal = 2;
                break;
            case "en":
                pageVal = 3;
                break;
        }

        List<light.Model.news> models = new light.BLL.news().GetModelList(" categoryid=" + id.ToString());
        StringBuilder sb = new StringBuilder();

        light.Model.newscategory model = new light.BLL.newscategory().GetModel(id);

        string title = string.Empty;
        string list = string.Empty;

        if (pageVal == 1)
        {
            title = model.cname;
        }
        else if (pageVal == 2)
        {
            title = model.ename.Split('|')[1];
        }
        else
        {
            title = model.ename.Split('|')[0];
        }
        list = base.newsCategory(pageVal);
        description =base.newsCategoryById(id);

        sb.AppendLine(@" <table style=""z-index: 100"" border=""0"" cellspacing=""0"" cellpadding=""0"" width=""100%"">");
        sb.AppendLine(@"                            <tbody>");

        sb.AppendLine(@"                                <tr>");
        sb.AppendLine(@"                                    <td style=""padding-left: 45px; color: #ffffff; font-size: 14px; font-weight: bold""");

        sb.AppendLine(@"                                        height=""39"" background=""/images/title.jpg"">" + title);
        sb.AppendLine(@"                                    </td>");
        sb.AppendLine(@"                                </tr>");
        sb.AppendLine(@"                                <tr>");
        sb.AppendLine(@"                                    <td style=""padding-bottom: 2px; padding-left: 5px; padding-right: 5px; padding-top: 2px""");
        sb.AppendLine(@"                                        valign=""top"">");
        sb.AppendLine(@"                                        " + list);
        sb.AppendLine(@"                                    </td>");
        sb.AppendLine(@"                                </tr>");
        sb.AppendLine(@"                            </tbody>");
        sb.AppendLine(@"                        </table>");

        leftString = sb.ToString();
    }
Example #5
0
    protected void Page_Load(object sender, EventArgs e)
    {
        int nid = light.Common.DNTRequest.GetQueryInt("nid", 0);
        if (nid > 0)
        {
            light.BLL.news bll = new light.BLL.news();
            bll.safe(nid);
            light.Common.WebMessageBox.ShowMessageBox("恢复成功", this);

        }
    }
Example #6
0
 protected void Page_Load(object sender, EventArgs e)
 {
     int nid = light.Common.DNTRequest.GetQueryInt("nid", 0);
     if (nid > 0)
     {
         light.BLL.news bll = new light.BLL.news();
         bll.Delete(nid);
         light.Common.WebMessageBox.ShowMessageBox("删除成功", this);
     }
     if (!Page.IsPostBack)
     {
         bindcategory();
         newlist = bindlist(0);
     }
 }
Example #7
0
    public string newsCategoryById(int id)
    {
        StringBuilder myStringBuilder = new StringBuilder();

        myStringBuilder.AppendLine("<table width='100%' class='Board_Tab' border='0' cellspacing='0' cellpadding='0'>");

        DataTable dt = new light.BLL.news().GetList(" categoryid= " + id).Tables[0];
        foreach (DataRow dr in dt.Rows)
        {
            myStringBuilder.AppendLine("<tr>");
            myStringBuilder.AppendLine(@"<td height=""25"" BgColor="""" background=""#""><img src=""queryli.gif"" width=""7"" height=""7"" hspace=""6"">");
            myStringBuilder.AppendLine(@"<a href='news.aspx?id="+dr["id"].ToString()+"' target='_self'>"+dr["title"].ToString()+"</a></td>");
            myStringBuilder.AppendLine(@"<td BgColor="""" background=""#"">"+dr["addtime"].ToString()+"</td>");

            myStringBuilder.AppendLine("</tr>");
        }
        myStringBuilder.AppendLine("</table>");

        return myStringBuilder.ToString();
    }
Example #8
0
    public string newsAllList(int pageVal)
    {
        StringBuilder sb = new StringBuilder();

        string strwhere = " categoryid=1 or categoryid=2 ";
        if (pageVal == 2)
        {
            strwhere = " categoryid=3 or categoryid=4 ";
        }
        else if (pageVal == 3)
        {
            strwhere = " categoryid=5 or categoryid=6 ";
        }

        DataTable dt = new light.BLL.news().GetList(strwhere).Tables[0];

        sb.AppendLine(@"<table width=""100%"" class=""Board_Tab"" border=""0"" cellspacing=""0"" cellpadding=""0"">");
        foreach (DataRow dr in dt.Rows)
        {
            sb.AppendLine(@"<tr>");
            sb.AppendLine(@"  <td height=""25"" BgColor="""" background=""#""><img src=""queryli.gif"" width=""7"" height=""7"" hspace=""6"">");
            sb.AppendLine(@"     <a href='news.aspx?id=" + dr["id"].ToString() + "' target='_blank'>" + dr["title"].ToString() + "</a></td>");
            sb.AppendLine(@"  <td BgColor="""" background=""#"">" + Convert.ToDateTime(dr["addtime"]).ToShortDateString() + "</td>");
            sb.AppendLine(@"</tr>");
        }
        sb.AppendLine(@"</table>");

        return sb.ToString();
    }
Example #9
0
    /// <summary>
    /// 
    /// </summary>
    /// <param name="cateid">咨询分类</param>
    /// <param name="type">语言分类</param>
    /// <returns></returns>
    public string news(int cateid, int type)
    {
        StringBuilder myStringBuilder = new StringBuilder();
        myStringBuilder.Append("<table width=\"100%\" class=\"Board_Tab\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\">");
        string catestr = " categoryid=1 or categoryid=2 ";
        if (cateid == 1)
        {
            if (type == 2)
                catestr = " categoryid=3  ";
            else if (type == 3)
                catestr = "  categoryid=5 ";
            else
                catestr = " categoryid=1  ";
        }
        else
        {
            if (type == 2)
                catestr = " categoryid=4  ";
            else if (type == 3)
                catestr = " categoryid=6 ";
            else
                catestr = " categoryid=2  ";
        }
        DataTable dt = new light.BLL.news().GetList(catestr + " ").Tables[0];
        int i = 0;
        foreach (DataRow dr in dt.Rows)
        {

            myStringBuilder.Append("<tr>");
            myStringBuilder.Append("<td height=\"22\">");
            myStringBuilder.Append("<img src=\"/images/li.jpg\" width=\"12\" height=\"12\" hspace=\"6\" border=\"0\">");
            myStringBuilder.Append(" <a href=\"news.aspx?id=" + dr["id"].ToString() + "\" >" + Utility.CutString(dr["title"].ToString(), 0, 22) + "</a>");
            myStringBuilder.Append("</td>");
            myStringBuilder.Append("<td>");
            myStringBuilder.Append("</td>");
            myStringBuilder.Append("</tr>");
            i++;
            if (i == 5)
                break;

        }
        myStringBuilder.Append("</table>");
        return myStringBuilder.ToString();
    }