Example #1
0
        public void ProcessRequest(HttpContext context)
        {
            context.Response.ContentType = "text/plain";
            int    type     = int.Parse(context.Request["type"]);
            int    pid      = int.Parse(context.Request["pid"]);
            string strWhere = " TypeParentId=";

            if (type == 1)
            {
                strWhere += "0 ";
            }
            else
            {
                strWhere += pid + " ";
            }
            BookTypeBLL     bll  = new BookTypeBLL();
            DataTable       dt   = bll.GetList(strWhere);
            List <BookType> list = new List <BookType>();

            foreach (DataRow dr in dt.Rows)
            {
                list.Add(new BookType()
                {
                    TypeId    = Convert.ToInt32(dr["TypeId"]),
                    TypeTitle = dr["TypeTitle"].ToString()
                });
            }

            JavaScriptSerializer js = new JavaScriptSerializer();
            string temp             = js.Serialize(list);

            context.Response.Write(temp);
        }
Example #2
0
        private void BookSearch_Search()
        {
            BookInfoEntity infoEntity = new BookInfoEntity();

            if (!string.IsNullOrWhiteSpace(Request["TypeId"]))
            {
                BookTypeBLL    typeBLL    = new BookTypeBLL();
                BookTypeEntity typeEntity = typeBLL.lists(int.Parse(Request["TypeId"]));
                if (typeEntity == null)
                {
                    infoEntity.TypeId = 0;
                }
                else if (typeEntity.ParentId != 0)
                {
                    infoEntity.TypeId = int.Parse(Request["TypeId"]);
                }
            }
            if (!string.IsNullOrWhiteSpace(Request["ParentId"]))
            {
                infoEntity.SellCount = int.Parse(Request["ParentId"]);
            }
            if (!string.IsNullOrWhiteSpace(Request["BookName"]))
            {
                infoEntity.BookName = Request["BookName"];
            }
            BookInfoBLL           infoBLL  = new BookInfoBLL();
            int                   count    = 0;
            List <BookInfoEntity> infolist = infoBLL.list(infoEntity, int.Parse(Request["Pageint"]), int.Parse(Request["Pagesize"]), out count);

            Response.Write(count + "_" + MyJson.ToJsJson(infolist));
            Response.End();
        }
Example #3
0
        protected void Page_Load(object sender, EventArgs e)
        {
            BookTypeBLL bll = new BookTypeBLL();
            BookType    bt  = new BookType();

            if (!IsPostBack)
            {
                int id = int.Parse(Request["pid"]);
                BtModel = bll.GetBookTypeById(id);
            }
            else
            {
                BtModel              = new BookType();
                BtModel.TypeId       = int.Parse(Request["tid"]);
                BtModel.TypeTitle    = Request["title"];
                BtModel.TypeParentId = int.Parse(Request["tpid"]);
                if (bll.UpdateBookType(BtModel))
                {
                    Response.Redirect("../BookTypeList.aspx");
                }
                else
                {
                    Response.Redirect("Error.html");
                }
            }
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            BookTypeBLL bll = new BookTypeBLL();
            //read BookType table
            DataTable           dt   = bll.GetAllBookType();
            List <BookTypeTree> list = new List <BookTypeTree>();

            if (dt.Rows.Count > 0)
            {
                foreach (DataRow dr in dt.Rows)
                {
                    list.Add(new BookTypeTree()
                    {
                        id   = Convert.ToInt32(dr["TypeId"]),
                        name = dr["TypeTitle"].ToString(),
                        pId  = Convert.ToInt32(dr["TypeParentId"]),
                        open = true
                               //IsParent = true,
                               //Click = "Prompt(" + Convert.ToInt32(dr["TypeId"]) + ")"
                    });
                }
            }
            JavaScriptSerializer js = new JavaScriptSerializer();

            //return JSon object
            ZTree = js.Serialize(list);
        }
Example #5
0
        private void Book_delete()
        {
            BookTypeBLL typeBLL = new BookTypeBLL();

            Response.Write(typeBLL.Delete(int.Parse(Request["TypeId"])));
            Response.End();
        }
Example #6
0
        private void Book_Add()
        {
            BookTypeBLL    typeBLL    = new BookTypeBLL();
            BookTypeEntity typeEntity = new BookTypeEntity();

            typeEntity.ParentId = int.Parse(Request["ParentId"]);
            typeEntity.TypeName = Request["TypeName"];
            Response.Write(typeBLL.Add(typeEntity));
            Response.End();
        }
Example #7
0
 //Repeater嵌套
 protected void Repeater1_ItemDataBound(object sender, RepeaterItemEventArgs e)
 {
     if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem)
     {
         Repeater    re  = e.Item.FindControl("Repeater2") as Repeater;
         int         id  = int.Parse((e.Item.FindControl("HiddenField1") as HiddenField).Value);
         BookTypeBLL bll = new BookTypeBLL();
         re.DataSource = bll.list(id);
         re.DataBind();
     }
 }
Example #8
0
        //数据绑定
        private void bindata()
        {
            BookTypeBLL bll = new BookTypeBLL();

            DropDownList1.DataSource     = bll.list(0);
            DropDownList1.DataTextField  = "TypeName";
            DropDownList1.DataValueField = "TypeId";
            DropDownList1.DataBind();
            DropDownList1.Items.Insert(0, new ListItem("--全部分类--", "0"));

            Repeater1.DataSource = bll.list(0);
            Repeater1.DataBind();
        }
Example #9
0
        private void bindate()
        {
            if (string.IsNullOrWhiteSpace(Request["TypeId"]))
            {
                return;
            }
            BookTypeBLL    bookType   = new BookTypeBLL();
            BookTypeEntity typeEntity = bookType.lists(int.Parse(Request["TypeId"]));

            ViewState["txtName"]  = typeEntity.TypeName;
            ViewState["ParentId"] = typeEntity.ParentId;
            ViewState["TypeId"]   = typeEntity.TypeId;
        }
Example #10
0
 // 写下拉框 主页开始的
 private void FindSele(BookInfo_View bk = null)
 {
     if (bk == null)
     {
         var        listSele = BookTypeBLL.Find();
         SelectList seleList = new SelectList(listSele, "TypeId", "TypeName");
         ViewBag.seleList = seleList;
     }
     else
     {
         var        listSele = BookTypeBLL.Find();
         SelectList seleList = new SelectList(listSele, "TypeId", "TypeName", bk.TypeId);
         ViewBag.seleList = seleList;
     }
 }
Example #11
0
        public void ProcessRequest(HttpContext context)
        {
            context.Response.ContentType = "text/plain";
            int         id  = int.Parse(context.Request["id"]);
            BookTypeBLL bll = new BookTypeBLL();

            if (bll.DeleteBookType(id))
            {
                context.Response.Write(1);
            }
            else
            {
                context.Response.Write(0);
            }
        }
Example #12
0
        private void BookSearch_babaid()
        {
            int            typid      = int.Parse(Request["TypeId"]);
            BookTypeBLL    typeBLL    = new BookTypeBLL();
            BookTypeEntity typeEntity = typeBLL.lists(typid);

            if (typeEntity == null)
            {
                Response.Write(0);
            }
            else
            {
                Response.Write(MyJson.ToJsJson(typeEntity));
            }

            Response.End();
        }
Example #13
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (IsPostBack)
     {
         BookType bt = new BookType();
         bt.TypeTitle    = Request["title"];
         bt.TypeParentId = int.Parse(Request["pid"]);
         BookTypeBLL bll = new BookTypeBLL();
         if (bll.InsertBookType(bt))
         {
             Response.Redirect("../BookTypeList.aspx");
         }
         else
         {
             Response.Redirect("Error.html");
         }
     }
 }
Example #14
0
        private void BookSearch_binzije()
        {
            int            typid      = int.Parse(Request["TypeId"]);
            BookTypeBLL    typeBLL    = new BookTypeBLL();
            BookTypeEntity typeEntity = typeBLL.lists(typid);

            if (typeEntity == null)
            {
                Response.Write(MyJson.ToJsJson(typeBLL.list(0)));
            }
            else
            {
                if (typeEntity.ParentId == 0)
                {
                    Response.Write(MyJson.ToJsJson(typeBLL.list(typeEntity.TypeId)));
                }
                else
                {
                    Response.Write(MyJson.ToJsJson(typeBLL.list(typeEntity.ParentId)));
                }
            }

            Response.End();
        }