protected void Button_Submit_Click(object sender, EventArgs e)
        {
            if (TextBox_CategoryName.Text != String.Empty)
            {
                NewsCategoryModel model = new NewsCategoryModel();

                int ParentID = Convert.ToInt32(Input_ParentCategoryID.Value);

                NewsCategoryModel pModel = bll.GetModel(ParentID);

                model.CateID =  CommDataHelper.GetNewSerialNum("ne");
                model.CateLevel = pModel==null?0:pModel.CateLevel+1;
                model.CateName = TextBox_CategoryName.Text;
                model.IsHide = Convert.ToInt32(DropDownList_IsHide.SelectedValue)==1?true:false;
                model.ParentID = ParentID;
                model.ShowOrder = model.CateID;
                model.Status = 1;

                bll.Add(model);

                MessageBox.Show(this,"添加成功!");

                Response.Redirect("list.aspx");
            }
            else
            {
                MessageBox.Show(this,"请输入分类名称");
            }
        }
        public void Add(NewsCategoryModel Model)
        {
            DbCommand command = dbw.GetStoredProcCommand("UP_neCategory_ADD");

            dbw.AddInParameter(command, "@cateid", DbType.Int32, Model.CateID);
            dbw.AddInParameter(command, "@catename", DbType.String, Model.CateName);
            dbw.AddInParameter(command, "@status", DbType.Int16, Model.Status);
            dbw.AddInParameter(command, "@ishide", DbType.Boolean, Model.IsHide);
            dbw.AddInParameter(command, "@catelevel", DbType.Int32, Model.CateLevel);
            dbw.AddInParameter(command, "@parentid", DbType.Int32, Model.ParentID);
            dbw.AddInParameter(command, "@showorder", DbType.Int32, Model.ShowOrder);

            dbw.ExecuteNonQuery(command);
        }
 public void Update(NewsCategoryModel Model)
 {
     dal.Update(Model);
 }
 public void Add(NewsCategoryModel Model)
 {
     dal.Add(Model);
 }
        private NewsCategoryModel ReaderBind(IDataReader dataReader)
        {
            NewsCategoryModel model = new NewsCategoryModel();

            model.CateID = Convert.ToInt32(dataReader["cateid"]);
            model.CateLevel = Convert.ToInt32(dataReader["catelevel"]);
            model.CateName = Convert.ToString(dataReader["catename"]);
            model.IsHide = Convert.ToBoolean(dataReader["ishide"]);
            model.ParentID = Convert.ToInt32(dataReader["parentid"]);
            model.ShowOrder = Convert.ToInt32(dataReader["showorder"]);
            model.Status = Convert.ToInt16(dataReader["status"]);

            return model;
        }