⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 sitetask_edit.aspx.cs

📁 最好用的站点内容管理系统 全部源代码都有
💻 CS
📖 第 1 页 / 共 2 页
字号:
                string Str_TimeSet = Request.Form["TimeSet"];
                if (Str_TimeSet == null || Str_TimeSet == "" || Str_TimeSet == string.Empty)
                {
                    Str_TimeSet = "0";
                }
                else
                {
                    Str_TimeSet = Request.Form["TimeSet"];
                }
                #endregion

                string Str_CreateTime = this.CreatTime.Text.Trim();//创建时间
                #region checkdata
                if (NetCMS.Common.Input.ChkDate(Str_CreateTime) == false)
                {
                    PageError("日期格式不正确", "siteTask.aspx");
                }
                #endregion


                #region 栏目索引

                int all_class = 0, every_class = 0, today_class = 0;
                string str_publictype = NetCMS.Config.verConfig.PublicType;
                if (str_publictype == "1")
                {
                    if (AllClass1.Checked)
                    {
                        all_class = 1;
                    }
                    else
                    {
                        all_class = 0;
                    }
                    if (EveryDayClass1.Checked)
                    {
                        every_class = 1;
                    }
                    else
                    {
                        every_class = 0;
                    }
                    if (TodayClass1.Checked)
                    {
                        today_class = 1;
                    }
                    else
                    {
                        today_class = 0;
                    }
                }
                else
                {
                    if (AllClass1.Checked)
                    {
                        all_class = 1;
                    }
                    else
                    {
                        all_class = 0;
                    }
                    if (TodayClass1.Checked)
                    {
                        today_class = 1;
                    }
                    else
                    {
                        today_class = 0;
                    }
                    every_class = 0;
                }
                #endregion

                #region 栏目数组
                string Str_ClassID = Request.Form["divclassNews"];
                if (Str_ClassID == null || Str_ClassID == "" || Str_ClassID == string.Empty)
                {
                    Str_ClassID = "0";
                }
                else
                {
                    Str_ClassID = Request.Form["divclassNews"];
                }
                #endregion

                #region 生成所有新闻
                int allnews = 0;
                if (AllNews.Checked)
                {
                    allnews = 1;
                }
                else
                {
                    allnews = 0;
                }
                #endregion

                #region 新闻ID
                string Str_NewsID = "0";
                if (NewsID.Checked)
                {
                    string Str_NewsID1 = this.NewsID1.Text.Trim();
                    string Str_NewsID2 = this.NewsID2.Text.Trim();
                    if (Str_NewsID1 == null || Str_NewsID1 == "" || Str_NewsID1 == string.Empty || Str_NewsID2 == null || Str_NewsID2 == "" || Str_NewsID2 == string.Empty)
                    {
                        Str_NewsID = "0";
                    }
                    else
                    {
                        if (!NetCMS.Common.Input.IsInteger(Str_NewsID1) || !NetCMS.Common.Input.IsInteger(Str_NewsID2))
                        {
                            PageError("抱歉,ID必须为数字", "siteTask.aspx");
                        }
                        else
                        {
                            if (int.Parse(Str_NewsID1) > int.Parse(Str_NewsID2))
                            {
                                PageError("抱歉,第一个ID必须比第二个小", "siteTask.aspx");
                            }
                            else
                            {
                                Str_NewsID = "" + Str_NewsID1 + "," + Str_NewsID2 + "";
                            }
                        }
                    }
                }
                #endregion

                #region 新闻日期
                string Str_Data = "0";
                if (Data.Checked)
                {
                    string Str_Data1 = this.Data1.Text.Trim();
                    string Str_Data2 = this.Data2.Text.Trim();
                    if (Str_Data1 == null || Str_Data1 == "" || Str_Data1 == string.Empty || Str_Data2 == null || Str_Data2 == "" || Str_Data2 == string.Empty)
                    {
                        Str_Data = "0";//不按照日期发布
                    }
                    else
                    {
                        #region check data
                        if (NetCMS.Common.Input.ChkDate(Str_Data1) == false || NetCMS.Common.Input.ChkDate(Str_Data2) == false)
                        {
                            PageError("日期格式不正确", "siteTask.aspx");
                        }
                        #endregion
                        else
                        {
                            Str_Data = "" + Str_Data1 + "," + Str_Data2 + "";
                        }
                    }
                }
                #endregion

                #region 最新数

                int Str_LastNewsNum = 0;
                if (LastNewsNum_checkbox.Checked)
                {
                    string lastnum = this.LastNewsNum.Text.Trim();
                    if (lastnum == null || lastnum == "" || lastnum == string.Empty)
                    {
                        Str_LastNewsNum = 0;
                    }
                    else
                    {
                        if (!NetCMS.Common.Input.IsInteger(lastnum))
                        {
                            PageError("最新数应为数字型", "siteTask.aspx");
                        }
                        else
                        {
                            Str_LastNewsNum = int.Parse(lastnum);
                        }
                    }
                }
                #endregion

                #region 新闻数组
                string Str_ArrNewsID = Request.Form["divclassClass"];
                if (Str_ArrNewsID == null || Str_ArrNewsID == "" || Str_ArrNewsID == string.Empty)
                {
                    Str_ArrNewsID = "0";
                }
                else
                {
                    Str_ArrNewsID = Request.Form["divclassClass"];
                }
                #endregion

                #region 专题数组
                string Str_Special = Request.Form["SpecialID"];
                if (Str_Special == null || Str_Special == "" || Str_Special == string.Empty)
                {
                    Str_Special = "0";
                }
                else
                {
                    Str_Special = Request.Form["SpecialID"];
                }
                #endregion

                #region 修改数据

                NetCMS.Model.Task uc = new NetCMS.Model.Task();
                uc.taskID = taskid;
                uc.TaskName = Str_TaskName;
                uc.isIndex = isindexx;
                uc.ClassID = all_class + "|" + every_class + "|" + today_class + "|" + Str_ClassID;
                uc.News = allnews + "|" + Str_NewsID + "|" + Str_Data + "|" + Str_LastNewsNum + "|" + Str_ArrNewsID+"|"+this.unHTML.SelectedValue;
                uc.Special = Str_Special;
                uc.TimeSet = Str_TimeSet;
                uc.CreatTime = DateTime.Parse((DateTime.Now).ToString());
                uc.SiteID = SiteID;
                pd.UpdateTask(uc);
                PageRight("修改成功", "siteTask.aspx");
                #endregion

                #region 更新数据库
                #endregion
            }
        }
    }
    /// <summary>
    /// 得到栏目父类列表
    /// </summary>
    /// <param name="flgStr"></param>
    /// <returns></returns>
    protected string getClassNews(string flgStr)
    {
        string _Str = "\r<select name=\"" + flgStr + "\" size=\"10\" multiple=\"multiple\" style=\"width:100%\">\r";
        DataTable dt = rd.getClassListPublic("0");
        if (dt != null)
        {
            if (dt.Rows.Count > 0)
            {
                for (int i = 0; i < dt.Rows.Count; i++)
                {
                    _Str += "<option value=\"" + dt.Rows[i]["ClassID"].ToString() + "\">┝" + dt.Rows[i]["ClassCName"].ToString() + "</option>\r";
                    _Str += getChildClassNews(dt.Rows[i]["ClassID"].ToString(), "┝┉┉");
                }
            }
            dt.Clear(); dt.Dispose();
        }
        _Str += "</select>\r";
        return _Str;
    }

    /// <summary>
    /// 得到子类列表
    /// </summary>
    /// <param name="ParentID"></param>
    /// <param name="_tmp"></param>
    /// <returns></returns>
    protected string getChildClassNews(string ParentID, string _tmp)
    {
        string _Str = "";
        DataTable dt = rd.getClassListPublic(ParentID);
        if (dt != null)
        {
            if (dt.Rows.Count > 0)
            {
                for (int i = 0; i < dt.Rows.Count; i++)
                {
                    _Str += "<option value=\"" + dt.Rows[i]["ClassID"].ToString() + "\">" + _tmp + dt.Rows[i]["ClassCName"].ToString() + "</option>\r";
                    _Str += getChildClassNews(dt.Rows[i]["ClassID"].ToString(), "┝" + _tmp);
                }
            }
            dt.Clear(); dt.Dispose();
        }
        return _Str;
    }

    /// <summary>
    /// 得到专题父类列表
    /// </summary>
    /// <param name="flgStr"></param>
    /// <returns></returns>
    protected string getSpecial()
    {
        string _Str = "\r<select name=\"SpecialID\" size=\"10\" multiple=\"multiple\" style=\"width:100%\">\r";
        DataTable dt = rd.getSpecialListPublic("0");
        if (dt != null)
        {
            if (dt.Rows.Count > 0)
            {
                for (int i = 0; i < dt.Rows.Count; i++)
                {
                    _Str += "<option value=\"" + dt.Rows[i]["SpecialID"].ToString() + "\">┝" + dt.Rows[i]["SpecialCName"].ToString() + "</option>\r";
                    _Str += getChildSpecial(dt.Rows[i]["SpecialID"].ToString(), "┝┉┉");
                }
            }
            dt.Clear(); dt.Dispose();
        }
        _Str += "</select>\r";
        return _Str;
    }

    /// <summary>
    /// 得到专题子类列表
    /// </summary>
    /// <param name="ParentID"></param>
    /// <param name="_tmp"></param>
    /// <returns></returns>
    protected string getChildSpecial(string ParentID, string _tmp)
    {
        string _Str = "";
        DataTable dt = rd.getSpecialListPublic(ParentID);
        if (dt != null)
        {
            if (dt.Rows.Count > 0)
            {
                for (int i = 0; i < dt.Rows.Count; i++)
                {
                    _Str += "<option value=\"" + dt.Rows[i]["SpecialID"].ToString() + "\">" + _tmp + dt.Rows[i]["SpecialCName"].ToString() + "</option>\r";
                    _Str += getChildClassNews(dt.Rows[i]["SpecialID"].ToString(), "┝" + _tmp);
                }
            }
            dt.Clear(); dt.Dispose();
        }
        return _Str;
    }
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -