Ejemplo n.º 1
0
        protected void Page_Load(object sender, EventArgs e)
        {
            Shop.BLL.BookType btBll = new Shop.BLL.BookType();
            if (!IsPostBack)//初次加载请求
            {
                int id = int.Parse(Request["id"]);

                BtModel = btBll.GetModel(id);
            }
            else
            {
                //回传,进行修改处理
                BtModel = new Shop.Model.BookType()
                {
                    TypeId       = int.Parse(Request["tid"]),
                    TypeTitle    = Request["tTitle"],
                    TypeParentId = int.Parse(Request["tPid"])
                };

                if (btBll.Update(BtModel))
                {
                    Response.Redirect("BookTypeList.aspx");
                }
                else
                {
                    Response.Write("修改失败,请稍候重试");
                }
            }
        }
Ejemplo n.º 2
0
        protected void btnSave_Click(object sender, EventArgs e)
        {
            string strErr = "";

            if (this.txtTypeTitle.Text.Trim().Length == 0)
            {
                strErr += "TypeTitle不能为空!\\n";
            }
            if (!PageValidate.IsNumber(txtTypeParentId.Text))
            {
                strErr += "TypeParentId格式错误!\\n";
            }

            if (strErr != "")
            {
                MessageBox.Show(this, strErr);
                return;
            }
            string TypeTitle    = this.txtTypeTitle.Text;
            int    TypeParentId = int.Parse(this.txtTypeParentId.Text);

            Shop.Model.BookType model = new Shop.Model.BookType();
            model.TypeTitle    = TypeTitle;
            model.TypeParentId = TypeParentId;

            Shop.BLL.BookType bll = new Shop.BLL.BookType();
            bll.Add(model);
            Maticsoft.Common.MessageBox.ShowAndRedirect(this, "保存成功!", "add.aspx");
        }
Ejemplo n.º 3
0
        protected void Page_Load(object sender, EventArgs e)
        {
            Shop.BLL.BookType btBll = new Shop.BLL.BookType();
            DataTable         dt    = btBll.GetAllList().Tables[0];

            //{ id: 1, pId: 0, name: "父节点1 - 展开", open: true },
            List <BookTypeTree> list = new List <BookTypeTree>();

            foreach (DataRow row in dt.Rows)
            {
                list.Add(new BookTypeTree()
                {
                    id   = Convert.ToInt32(row["TypeId"]),
                    name = row["TypeTitle"].ToString(),
                    pId  = Convert.ToInt32(row["TypeParentId"]),
                    open = true
                           //isParent = true,
                           //click = "PromptDo("+Convert.ToInt32(row["TypeId"])+")"
                });
            }

            JavaScriptSerializer js = new JavaScriptSerializer();

            ZTree = js.Serialize(list);
        }
Ejemplo n.º 4
0
 private void ShowInfo(int TypeId)
 {
     Shop.BLL.BookType   bll   = new Shop.BLL.BookType();
     Shop.Model.BookType model = bll.GetModel(TypeId);
     this.lblTypeId.Text       = model.TypeId.ToString();
     this.lblTypeTitle.Text    = model.TypeTitle;
     this.lblTypeParentId.Text = model.TypeParentId.ToString();
 }
Ejemplo n.º 5
0
        public void ProcessRequest(HttpContext context)
        {
            context.Response.ContentType = "text/plain";

            int id = int.Parse(context.Request["id"]);

            Shop.BLL.BookType btBll = new Shop.BLL.BookType();
            if (btBll.Delete(id))
            {
                //成功返回1
                context.Response.Write(1);
            }
            else
            {
                context.Response.Write(0);
            }
        }
Ejemplo n.º 6
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (IsPostBack)
            {
                Shop.Model.BookType btModel = new Shop.Model.BookType()
                {
                    TypeTitle    = Request["title"],
                    TypeParentId = int.Parse(Request["pid"])
                };

                Shop.BLL.BookType btBll = new Shop.BLL.BookType();
                if (btBll.Add(btModel) > 0)
                {
                    Response.Redirect("BookTypeList.aspx");
                }
                else
                {
                    Response.Write("添加失败,请稍候重试");
                }
            }
        }
Ejemplo n.º 7
0
 protected void Page_Load(object sender, EventArgs e)
 {
     Shop.BLL.BookType btBll = new Shop.BLL.BookType();
     Repeater1.DataSource = btBll.GetAllList();
     Repeater1.DataBind();
 }