Esempio n. 1
0
 protected void Bind()
 {
     Model.Category      category1 = new Model.Category();
     BLL.CategoryManager category2 = new BLL.CategoryManager();
     GridView1.DataSource = category2.GetAllList();
     GridView1.DataBind();
 }
Esempio n. 2
0
 protected void Bind()
 {
     //Model.Question question1 = new Model.Question();
     //BLL.QuestionManager question2 = new BLL.QuestionManager();
     //GridView1.DataSource = question2.GetAllList();
     //GridView1.DataBind();
     Model.Category      category1 = new Model.Category();
     BLL.CategoryManager category2 = new BLL.CategoryManager();
     GridView1.DataSource = category2.GetAllList();
     GridView1.DataBind();
 }
Esempio n. 3
0
        protected void GridView1_RowDeleting(object sender, GridViewDeleteEventArgs e)
        {
            Model.Category      category3 = new Model.Category();
            BLL.CategoryManager category4 = new BLL.CategoryManager();
            int  categoryID = Convert.ToInt32((GridView1.Rows[e.RowIndex].FindControl("LabelID") as Label).Text);
            bool bo         = category4.Delete(categoryID);

            if (bo == true)
            {
                Bind();
            }
        }
Esempio n. 4
0
        protected void GridView1_RowDeleting(object sender, GridViewDeleteEventArgs e)
        {
            Model.Category      category3 = new Model.Category();
            BLL.CategoryManager category4 = new BLL.CategoryManager();
            string categoryID             = Convert.ToString((GridView1.Rows[e.RowIndex].FindControl("txbCategory") as TextBox).Text);
            bool   bo = category4.Delete(categoryID);

            if (bo == true)
            {
                Bind();
            }
        }
Esempio n. 5
0
        protected void CategoryDataBind()
        {
            Model.Category      category1 = new Model.Category();
            BLL.CategoryManager category2 = new BLL.CategoryManager();
            DropDownList_Category.DataTextField  = "category";
            DropDownList_Category.DataValueField = "categoryID";
            DataSet ds = new CategoryManager().GetAllList();
            DataRow dr = ds.Tables[0].NewRow();

            dr["categoryID"] = 0;
            dr["category"]   = "---请选择问题分类---";
            ds.Tables[0].Rows.InsertAt(dr, 0);
            DropDownList_Category.DataSource = ds;
            DropDownList_Category.DataBind();
        }
Esempio n. 6
0
        protected void BntSave_Click(object sender, EventArgs e)
        {
            Model.Category      category3 = new Model.Category();
            BLL.CategoryManager category4 = new BLL.CategoryManager();

            category3.category = txbAdd.Text;
            bool bo = category4.Add(category3);

            if (bo == true)
            {
                Bind();
            }
            else
            {
                Response.Write("<script language=javascript>alert('添加失败!')");
            }
        }
Esempio n. 7
0
        protected void BntSave_Click(object sender, EventArgs e)
        {
            Model.Category      category3 = new Model.Category();
            BLL.CategoryManager category4 = new BLL.CategoryManager();
            //users.userName = txbUserName.Text;
            category3.category = txbAdd.Text;
            bool bo = category4.Add(category3);

            if (bo == true)
            {
                // Response.Redirect("~/Default.aspx");
                Bind();
            }
            else
            {
                Response.Write("<script language=javascript>alert('添加失败!')");
            }
        }
Esempio n. 8
0
        protected void GridView1_RowUpdating(object sender, GridViewUpdateEventArgs e)
        {
            //Model.Question question1 = new Model.Question();
            //BLL.QuestionManager question2 = new BLL.QuestionManager();
            //question1.questionID = Convert.ToInt32((GridView1.Rows[e.RowIndex].FindControl("LabelquestionID") as Label).Text);
            //question1.question = (GridView1.Rows[e.RowIndex].FindControl("txbQuestion") as TextBox).Text.ToString();
            //question1.solution = (GridView1.Rows[e.RowIndex].FindControl("txbSolution") as TextBox).Text.ToString();
            //bool bo = question2.Update(question1);
            //GridView1.EditIndex = -1;
            //Bind();
            Model.Category      category1 = new Model.Category();
            BLL.CategoryManager category2 = new BLL.CategoryManager();
            category1.category = Convert.ToString((GridView1.Rows[e.RowIndex].FindControl("txbCategory") as TextBox).Text);
            category1.category = (GridView1.Rows[e.RowIndex].FindControl("txbCategory") as TextBox).Text.ToString();
            bool bo = category2.Update(category1);

            GridView1.EditIndex = -1;
            Bind();
        }
Esempio n. 9
0
        protected void GridView1_RowDeleting(object sender, GridViewDeleteEventArgs e)
        {
            //Model.Question question3 = new Model.Question();
            //BLL.QuestionManager question4 = new BLL.QuestionManager();
            //int QuestionID = Convert.ToInt32((GridView1.Rows[e.RowIndex].FindControl("LabelquestionID") as Label).Text);
            //bool bo = question4.Delete(QuestionID);
            //if (bo == true)
            //{
            //    Bind();
            //}
            Model.Category      category3 = new Model.Category();
            BLL.CategoryManager category4 = new BLL.CategoryManager();
            string categoryID             = Convert.ToString((GridView1.Rows[e.RowIndex].FindControl("txbCategory") as TextBox).Text);
            bool   bo = category4.Delete(categoryID);

            if (bo == true)
            {
                Bind();
            }
        }
Esempio n. 10
0
        protected void GridView1_RowUpdating(object sender, GridViewUpdateEventArgs e)
        {
            Model.Category category = new Model.Category();
            category.categoryID = Convert.ToInt32(GridView1.DataKeys[e.RowIndex].Value);
            category.category   = (GridView1.Rows[e.RowIndex].FindControl("txtCategory") as TextBox).Text;

            BLL.CategoryManager categoryManager = new BLL.CategoryManager();
            bool bo = categoryManager.Update(category);

            if (bo == true)
            {
                Response.Write("<script language=javascript>alert('修改成功!')</script>");
                GridView1.EditIndex = -1;
                Bind();
            }
            else
            {
                Response.Write("<script language=javascript>alert('修改失败!请重试')");
            }
        }