.NET进销存管理系统 第8页

.NET进销存管理系统 第8页
进入系统前首先进入登录这个界面,当用户登录成功后,可以利用此界面进行权限切换,流程图5-2,截图5-3所示。
登录的主要代码:
 public void dlDataBind()
 {
        ddlsf.DataSource = JsManager.getAllJs();
        ddlsf.DataBind();
        ListItem item = new ListItem("请选择……", "-1", true);
        ddlsf.Items.Insert(0, item);
    }
    protected void btndl_Click1(object sender, EventArgs e)
    {
        if (ddlsf.SelectedValue == "-1")
            lblmassage.Text = "请选择身份!";//51aspx
        else if(txtbuser.Text == null || txtbuser.Text == "")
            lblmassage.Text = "请填写用户名!";
        else if (txtbpwd.Text == null || txtbpwd.Text == "")
            lblmassage.Text = "请填写密码!";
        else {
            lblmassage.Text = "";
            Ywy ywy = YwyManager.getYwyByCoditions(txtbuser.Text,
txtbpwd.Text,Convert.ToInt32(ddlsf.SelectedValue));
            if(ywy!=null && ywy.Ywymc!=null){
                Session.Add("ywy", ywy);
                Response.Redirect("/JXC/Default.aspx", true);
            }
            else{
                lblmassage.Text = "登录失败!";
            }
        }
 
登录流程图5-2
 图5-3 登录(JCXX_DL.aspx)
5.2.2登录成功后进入的主界面
主界面可以添加一些制度及其他方面的说明,更重要的是从这个界面可以依据不同的权限进入相应的界面进行相关操作,流程图5-4,主界面图5-5所示。
主界面涉及权限的部分代码:
    protected void Page_Load(object sender, EventArgs e)
    {
        if (Session["ywy"] != null)
        {
            Ywy ywy = (Ywy)Session["ywy"];
            IList<Js_qx> js_qxs = new List<Js_qx>();
            js_qxs = Js_qxManager.getJs_qxsByJsbh(ywy.Jsbh);
            int urlid = Convert.ToInt32(Request.QueryString["urlid"]);
            if (urlid != 0)
            {
                if (js_qxs.Count > 0)
                {
                    for (int i = 0; i < js_qxs.Count; i++)
                    {
                        Js_qx js_qx = (Js_qx)js_qxs[i];
                        if (js_qx.Qxbh == urlid)
                      Response.Redirect(QxManager.getQxByQxbh(urlid).Qxurl, true);
                    }
                }
            }
        }
     }
 
登录后进入其他模块流程图5-4
 图5-5 主界面(Default.aspx)
5.2.3 权限设置
进入这个界面后,就可以对权限进行相关操作,权限设置流程图5-6,权限设置图5-7所示。
权限设置部分代码:
    //保存数据,确保刷新时数据存在
    public int Qxbh
    {
        get {
            if (ViewState["Qxbh"] != null)
                return (int)ViewState["Qxbh"];
            else
                return -1;
        }
        set { ViewState["Qxbh"] = value; }
    }
    //绑定业务员
    public void qxDataBind() {
        gvQx.DataSource = QxManager.getAllQx();
        gvQx.DataBind();
    }
    //行变色事件
    protected void gvQx_RowDataBound(object sender, GridViewRowEventArgs e)
    {
        if (e.Row.RowType == DataControlRowType.DataRow)//判断事件行是不是数据行
        {
            e.Row.Attributes.Add("onmouseover", "currentcolor=this.style.backgroundColor;
this.style.backgroundColor='#CCFF99'");//改变鼠标所在行的颜色,并存储当前颜色
            e.Row.Attributes.Add("onmouseout", "this.style.backgroundColor=currentcolor");
//还原颜色
            LinkButton lbtnDelete = (LinkButton)e.Row.FindControl("lbtnDelete");
//获得点击的按钮
            lbtnDelete.Attributes.Add("onclick", "return confirm('你确定删除吗?')");
//弹出提示对话框
        }
    }
   
    //实现分页
    protected void gvQx_PageIndexChanging(object sender, GridViewPageEventArgs e)
    {
        gvQx.PageIndex = e.NewPageIndex;
        qxDataBind();
    }
    //编辑和删除事件
    protected void gvQx_RowCommand(object sender, GridViewCommandEventArgs e)
    {
        Qxbh = Convert.ToInt32(e.CommandArgument);
        if(e.CommandName == "De"){
            QxManager.deleteQxByQxbh(Qxbh);
        }
        if(e.CommandName == "Ed"){
           
            Qx qx = QxManager.getQxByQxbh(Qxbh);
            this.txtbqxmcgx.Text = qx.Qxmc;
            this.txtbqxurlgx.Text = qx.Qxurl;
            this.txtbbzgx.Text = qx.Qxbz;
            //lbltjmassage.Text = "eeee"+Qxbh;
        }
        qxDataBind();
    }
    //更新修改项
    protected void btngx_Click(object sender, EventArgs e)
    {
        Qx qx = new Qx();
        if (this.Qxbh == -1)
        {
            lblgxmassage.Text = "请选择编辑项!";
        }
        else{
            qx.Qxbh = this.Qxbh;
            qx.Qxmc = txtbqxmcgx.Text;
            qx.Qxurl = txtbqxurlgx.Text;
            qx.Qxbz = txtbbzgx.Text;

上一页  [1] [2] [3] [4] [5] [6] [7] [8] [9] [10]  ... 下一页  >> 

Copyright © 2007-2012 www.chuibin.com 六维论文网 版权所有