Ejemplo n.º 1
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            if (Request.UrlReferrer != null)
            {
                ViewState["url"] = Request.UrlReferrer.ToString();
            }
            else
            {
                ViewState["url"] = "MenuList1.aspx";
            }
            if (Request.QueryString["sid"] != "" && Request.QueryString["sid"] != null)
            {
                int sid = Convert.ToInt32(Request.QueryString["sid"].ToString());
                model = bll.GetModel(sid);
                if (model.SCheck == 1)
                {
                    model.SCheck = 0;
                }
                else
                {
                    model.SCheck = 1;
                }

                bll.Update(model);
                Response.Redirect(ViewState["url"].ToString());
            }
        }
    }
Ejemplo n.º 2
0
    protected void Button1_Click(object sender, EventArgs e)
    {
        int sid = Convert.ToInt32(Request.QueryString["sid"].ToString());

        model       = bll.GetModel(sid);
        model.SName = txtMuneName.Text.Trim();
        model.Surl  = txtUrlAdd.Text.Trim();
        try
        {
            model.Sorder = int.Parse(txtOrder.Text.Trim());
        }
        catch (Exception)
        {
            Response.Write("<script>alert('请输入数字')</script>");
            return;
        }

        model.Starget = DropDownList1.SelectedValue.Trim();
        if (bll.Update(model))
        {
            Response.Write("<script>alert('更新成功');location.href='" + ViewState["returnUrl"].ToString() + "';</script>");
            //Response.Redirect(ViewState["returnUrl"].ToString());
        }
        else
        {
            Response.Write("<script>alert('更新失败');location.href='" + ViewState["returnUrl"].ToString() + "';</script>");
        }
    }
Ejemplo n.º 3
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            if (Request.QueryString["sid"] != null && Request.QueryString["sid"] != "")
            {
                int sid = Convert.ToInt32(Request.QueryString["sid"].ToString());
                model                       = bll.GetModel(sid);
                txtMuneName.Text            = model.SName;
                txtUrlAdd.Text              = model.Surl;
                txtOrder.Text               = model.Sorder.ToString();
                DropDownList1.SelectedValue = model.Starget;
            }
            if (Request.UrlReferrer != null)
            {
                ViewState["returnUrl"] = Request.UrlReferrer.ToString();
            }
            else
            {
                ViewState["returnUrl"] = "MenuList1.aspx";
            }
            if (Request.QueryString["ji"] != null && Request.QueryString["ji"] != "")
            {
                switch (Request.QueryString["ji"].ToString())
                {
                case "1":
                    lbmenu.Text = "修改一级菜单";
                    break;

                case "2":
                    lbmenu.Text = "修改二级菜单";
                    break;

                case "3":
                    lbmenu.Text = "修改三级菜单";
                    break;

                case "4":
                    lbmenu.Text = "修改四级菜单";
                    break;

                default:
                    break;
                }
            }
            else
            {
                lbmenu.Text = "修改一级菜单";
            }
        }
    }
Ejemplo n.º 4
0
        /// <summary>
        /// 获得数据列表
        /// </summary>
        public List <Tz888.Model.dp.SysMenuTab> DataTableToList(DataTable dt)
        {
            List <Tz888.Model.dp.SysMenuTab> modelList = new List <Tz888.Model.dp.SysMenuTab>();
            int rowsCount = dt.Rows.Count;

            if (rowsCount > 0)
            {
                Tz888.Model.dp.SysMenuTab model;
                for (int n = 0; n < rowsCount; n++)
                {
                    model = new Tz888.Model.dp.SysMenuTab();
                    if (dt.Rows[n]["sid"].ToString() != "")
                    {
                        model.sid = int.Parse(dt.Rows[n]["sid"].ToString());
                    }
                    model.SName = dt.Rows[n]["SName"].ToString();
                    if (dt.Rows[n]["SCheck"].ToString() != "")
                    {
                        model.SCheck = int.Parse(dt.Rows[n]["SCheck"].ToString());
                    }
                    model.Surl = dt.Rows[n]["Surl"].ToString();
                    if (dt.Rows[n]["SisActive"].ToString() != "")
                    {
                        model.SisActive = int.Parse(dt.Rows[n]["SisActive"].ToString());
                    }
                    if (dt.Rows[n]["SParentCode"].ToString() != "")
                    {
                        model.SParentCode = int.Parse(dt.Rows[n]["SParentCode"].ToString());
                    }
                    model.SCode   = dt.Rows[n]["SCode"].ToString();
                    model.Starget = dt.Rows[n]["Starget"].ToString();
                    if (dt.Rows[n]["SDate"].ToString() != "")
                    {
                        model.SDate = DateTime.Parse(dt.Rows[n]["SDate"].ToString());
                    }
                    modelList.Add(model);
                }
            }
            return(modelList);
        }
Ejemplo n.º 5
0
    protected void GridView1_RowCommand(object sender, GridViewCommandEventArgs e)
    {
        int sid   = int.Parse(e.CommandArgument.ToString());
        int check = 0;

        switch (e.CommandName) //壮态

        {
        case "check":
            model = bll.GetModel(sid);
            if (model.SCheck == 0)
            {
                check = 1;
            }
            else
            {
                check = 0;
            }
            model.SCheck = check;
            bll.Update(model);
            databind(ViewState["order"].ToString());
            break;

        case "xiaji":    //添加一下级菜单
            Response.Redirect("MenuList2.aspx?sid=" + sid);
            break;

        case "modefiy":     //修改
            Response.Redirect("ModefiyMenu.aspx?sid=" + sid + "&ji=1");
            break;

        case "Del":    //删除
            bll.Delete(sid);
            databind(ViewState["order"].ToString());
            break;

        default:
            break;
        }
    }
Ejemplo n.º 6
0
    protected void GridView1_RowUpdating(object sender, GridViewUpdateEventArgs e)
    {
        string input = "";

        try
        {
            //获取文本框的值
            input = (GridView1.Rows[e.RowIndex].FindControl("txtUPdate") as TextBox).Text.ToString();
            HiddenField hf = GridView1.Rows[e.RowIndex].FindControl("HiddenField1") as HiddenField;
            model        = bll.GetModel(int.Parse(hf.Value));
            model.Sorder = int.Parse(input);
            if (bll.Update(model))
            {
                GridView1.EditIndex = -1;
                databind(ViewState["order"].ToString());
            }
        }
        catch (Exception)
        {
            throw;
        }
    }
Ejemplo n.º 7
0
 /// <summary>
 /// 更新一条数据
 /// </summary>
 public bool Update(Tz888.Model.dp.SysMenuTab model)
 {
     return(dal.Update(model));
 }
Ejemplo n.º 8
0
 /// <summary>
 /// 增加一条数据
 /// </summary>
 public int Add(Tz888.Model.dp.SysMenuTab model)
 {
     return(dal.Add(model));
 }