Exemple #1
0
 private void ShowInfo(int SID)
 {
     BBS.BLL.BBSSection   bll   = new BBS.BLL.BBSSection();
     BBS.Model.BBSSection model = bll.GetModel(SID);
     this.lblSID.Text         = model.SID.ToString();
     this.lblSName.Text       = model.SName;
     this.lblSMasterID.Text   = model.SMasterID.ToString();
     this.lblSStatement.Text  = model.SStatement;
     this.lblSClickCount.Text = model.SClickCount.ToString();
     this.lblSTopicCount.Text = model.STopicCount.ToString();
 }
Exemple #2
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!Page.IsPostBack)
     {
         BBS.BLL.BBSSection bll = new BBS.BLL.BBSSection();
         if (Request.Params["id"] != null && Request.Params["id"].Trim() != "")
         {
             int SID = (Convert.ToInt32(Request.Params["id"]));
             bll.Delete(SID);
             Response.Redirect("list.aspx");
         }
     }
 }
Exemple #3
0
        public void btnSave_Click(object sender, EventArgs e)
        {
            string strErr = "";

            if (this.txtSName.Text.Trim().Length == 0)
            {
                strErr += "SName不能为空!\\n";
            }
            if (!PageValidate.IsNumber(txtSMasterID.Text))
            {
                strErr += "SMasterID格式错误!\\n";
            }
            if (this.txtSStatement.Text.Trim().Length == 0)
            {
                strErr += "SStatement不能为空!\\n";
            }
            if (!PageValidate.IsNumber(txtSClickCount.Text))
            {
                strErr += "SClickCount格式错误!\\n";
            }
            if (!PageValidate.IsNumber(txtSTopicCount.Text))
            {
                strErr += "STopicCount格式错误!\\n";
            }

            if (strErr != "")
            {
                MessageBox.Show(this, strErr);
                return;
            }
            int    SID         = int.Parse(this.lblSID.Text);
            string SName       = this.txtSName.Text;
            int    SMasterID   = int.Parse(this.txtSMasterID.Text);
            string SStatement  = this.txtSStatement.Text;
            int    SClickCount = int.Parse(this.txtSClickCount.Text);
            int    STopicCount = int.Parse(this.txtSTopicCount.Text);


            BBS.Model.BBSSection model = new BBS.Model.BBSSection();
            model.SID         = SID;
            model.SName       = SName;
            model.SMasterID   = SMasterID;
            model.SStatement  = SStatement;
            model.SClickCount = SClickCount;
            model.STopicCount = STopicCount;

            BBS.BLL.BBSSection bll = new BBS.BLL.BBSSection();
            bll.Update(model);
            Common.MessageBox.ShowAndRedirect(this, "保存成功!", "list.aspx");
        }
Exemple #4
0
        public void ProcessRequest(HttpContext context)
        {
            context.Response.ContentType = "text/plain";
            string json   = "{}";
            string action = context.Request.Form["Action"];

            if (action == "Show")
            {
                BBS.BLL.BBSSection bll = new BBS.BLL.BBSSection();
                DataSet            ds  = bll.GetList(""); //获取版块列表
                ds.Tables[0].TableName = "CategoryList";  //修改数据表的名字


                //返回列表
                json = Web.DataConvertJson.DataTable2Json(ds.Tables[0]);//转换
            }

            context.Response.Write(json);
        }
Exemple #5
0
        public void ProcessRequest(HttpContext context)
        {
            //  context.Response.ContentType = "text/plain";

            context.Response.ContentType = "text/html";
            string action = context.Request.Form["Action"];
            string json   = "{\"info\":\"已登录\"}";

            if (action == "Load")
            {
                if (context.Session["ID"] == null)
                {
                    json = "{\"info\":\"未登录\"}";
                }
                else
                {
                    BBS.BLL.BBSSection bll0 = new BBS.BLL.BBSSection();
                    DataSet            ds   = bll0.GetList("");
                    ds.Tables[0].TableName = "BBSSection";
                    string json1 = Web.DataConvertJson.DataTable2Json(ds.Tables[0]);
                    json = "{\"info\":\"已登录\"," + json1.Substring(1);
                }
            }
            else if (action == "Add")
            {
                json = "{\"info\":\"发表失败\"}";

                string content = context.Request.Form["Content"];        //保存文本框对象,提高效率
                content = HttpContext.Current.Server.UrlDecode(content); //反编码



                int      tsid        = int.Parse(context.Request.Form["section"]);
                int      tuid        = int.Parse(context.Session["ID"].ToString());
                int      treplycount = 0;
                string   TTopic      = context.Request.Form["title"];
                string   TContents   = content;
                DateTime TTime       = DateTime.Now;
                int      TClickCount = 0;
                DateTime TLastClickT = DateTime.Now;

                BBS.Model.BBSTopic model = new BBS.Model.BBSTopic();
                model.tsid        = tsid;
                model.tuid        = tuid;
                model.treplycount = treplycount;
                model.TTopic      = TTopic;
                model.TContents   = TContents;
                model.TTime       = TTime;
                model.TClickCount = TClickCount;
                model.TLastClickT = TLastClickT;

                BBS.BLL.BBSTopic bll = new BBS.BLL.BBSTopic();
                int n = bll.Add(model);
                //返回单个文字信息
                if (n > 0)
                {
                    json = "{\"info\":\"增加数据成功\",\"UID\":\"" + tuid + "\"}";
                }
            }

            context.Response.Write(json);
        }