Esempio n. 1
0
    protected void Page_Load(object sender, EventArgs e)
    {
        //验证权限
        AuthComm.chekcAuth_fromsession("1", UserSession.最终权值_后台菜单权限, true);

        if (!IsPostBack)
        {
            //绑定所有可选权限
            //调用执行方法获取数据
            DataSet  ds     = new DataSet();
            object[] re_dsi = IPC.Call("获取所有已启用的权限枚举", new object[] { "" });
            if (re_dsi[0].ToString() == "ok" && re_dsi[1] != null)
            {
                //这个就是得到远程方法真正的返回值,不同类型的,自行进行强制转换即可。
                ds = (DataSet)re_dsi[1];

                Unumber1.DataSource     = ds.Tables[0];
                Unumber1.DataTextField  = "ANBaseName";
                Unumber1.DataValueField = "ANBaseNumber";
                Unumber1.DataBind();


                Unumber2.DataSource     = ds.Tables[1];
                Unumber2.DataTextField  = "ANBaseName";
                Unumber2.DataValueField = "ANBaseNumber";
                Unumber2.DataBind();

                Unumber3.DataSource     = ds.Tables[2];
                Unumber3.DataTextField  = "ANBaseName";
                Unumber3.DataValueField = "ANBaseNumber";
                Unumber3.DataBind();

                Unumber4.DataSource     = ds.Tables[3];
                Unumber4.DataTextField  = "ANBaseName";
                Unumber4.DataValueField = "ANBaseNumber";
                Unumber4.DataBind();

                Unumber5.DataSource     = ds.Tables[4];
                Unumber5.DataTextField  = "ANBaseName";
                Unumber5.DataValueField = "ANBaseNumber";
                Unumber5.DataBind();
            }
            else
            {
                errmsg.Text = re_dsi[1].ToString();//向客户端输出错误字符串
            }



            //加载菜单
            ReLoadNode();
        }
    }
Esempio n. 2
0
    protected void Page_Load(object sender, EventArgs e)
    {
        //验证权限
        AuthComm.chekcAuth_fromsession("4", UserSession.最终权值_后台菜单权限, true);

        if (!IsPostBack)
        {
            if (Request["UAid"] == null || Request["UAid"].ToString().Trim() == "")
            {
                ;
            }
            else
            {
                string UAid = Request["UAid"].ToString().Trim();
                //有UAid,开始找数据,找到了才能修改
                DataSet  ds     = new DataSet();
                object[] re_dsi = IPC.Call("获取单个用户权限", new object[] { UAid });
                if (re_dsi[0].ToString() == "ok" && re_dsi[1] != null)
                {
                    //这个就是得到远程方法真正的返回值,不同类型的,自行进行强制转换即可。
                    ds = (DataSet)re_dsi[1];
                    if (ds.Tables["返回值单条"].Rows[0]["执行结果"].ToString() == "ok")
                    {
                        //超管账号不允许编辑
                        if (ds.Tables["数据记录"].Rows[0]["SuperUser"].ToString() == "1")
                        {
                            addbutton1.Enabled = false;
                            addbutton1.Text    = "超管账号不能进行编辑";
                        }


                        quyu_zhao.Visible   = false;
                        quyu_peizhi.Visible = true;


                        //把可用的权限组弄上
                        //调用执行方法获取数据
                        DataTable dtdtD   = new DataTable();
                        object[]  re_dsiD = IPC.Call("获取菜单数据", new object[] { "auth_group", 0, 1 });
                        if (re_dsiD[0].ToString() == "ok")
                        {
                            //这个就是得到远程方法真正的返回值,不同类型的,自行进行强制转换即可。
                            dtdtD = (DataTable)re_dsiD[1];
                            Uingroups.DataSource     = dtdtD;
                            Uingroups.DataTextField  = "SortNameTree";
                            Uingroups.DataValueField = "SortID";
                            Uingroups.DataBind();
                        }
                        else
                        {
                            errmsg.InnerHtml = re_dsiD[1].ToString();//向客户端输出错误字符串
                        }



                        //把下拉菜单默认值弄上
                        ee_UAid.Text       = ds.Tables["数据记录"].Rows[0]["UAid"].ToString();
                        ee_Uloginname.Text = ds.Tables["数据记录"].Rows[0]["Uloginname"].ToString();



                        UfinalUnumber.Text = ds.Tables["数据记录"].Rows[0]["UfinalUnumber1"].ToString() + "," + ds.Tables["数据记录"].Rows[0]["UfinalUnumber2"].ToString() + "," + ds.Tables["数据记录"].Rows[0]["UfinalUnumber3"].ToString() + "," + ds.Tables["数据记录"].Rows[0]["UfinalUnumber4"].ToString() + "," + ds.Tables["数据记录"].Rows[0]["UfinalUnumber5"].ToString();
                        //调用执行方法获取数据
                        DataSet  dsQ     = new DataSet();
                        object[] re_dsiQ = IPC.Call("获取所有已启用的权限枚举", new object[] { "隐藏开发专用" });
                        if (re_dsiQ[0].ToString() == "ok" && re_dsiQ[1] != null)
                        {
                            //这个就是得到远程方法真正的返回值,不同类型的,自行进行强制转换即可。
                            dsQ = (DataSet)re_dsiQ[1];

                            Unumber1.DataSource     = dsQ.Tables[0];
                            Unumber1.DataTextField  = "ANBaseName";
                            Unumber1.DataValueField = "ANBaseNumber";
                            Unumber1.DataBind();


                            Unumber2.DataSource     = dsQ.Tables[1];
                            Unumber2.DataTextField  = "ANBaseName";
                            Unumber2.DataValueField = "ANBaseNumber";
                            Unumber2.DataBind();

                            Unumber3.DataSource     = dsQ.Tables[2];
                            Unumber3.DataTextField  = "ANBaseName";
                            Unumber3.DataValueField = "ANBaseNumber";
                            Unumber3.DataBind();

                            Unumber4.DataSource     = dsQ.Tables[3];
                            Unumber4.DataTextField  = "ANBaseName";
                            Unumber4.DataValueField = "ANBaseNumber";
                            Unumber4.DataBind();

                            Unumber5.DataSource     = dsQ.Tables[4];
                            Unumber5.DataTextField  = "ANBaseName";
                            Unumber5.DataValueField = "ANBaseNumber";
                            Unumber5.DataBind();
                        }
                        else
                        {
                            errmsg.InnerHtml = re_dsiQ[0].ToString();//向客户端输出错误字符串
                        }

                        //给对应的地方赋值
                        Dictionary <string, string> dic_Unumber1 = AuthComm.GetEnumFormUnumber(ds.Tables["数据记录"].Rows[0]["Unumber1"].ToString());
                        foreach (KeyValuePair <string, string> kv in dic_Unumber1)
                        {
                            ListItem lt = Unumber1.Items.FindByValue(kv.Value);
                            if (lt != null)
                            {
                                lt.Selected = true;
                            }
                        }

                        Dictionary <string, string> dic_Unumber2 = AuthComm.GetEnumFormUnumber(ds.Tables["数据记录"].Rows[0]["Unumber2"].ToString());
                        foreach (KeyValuePair <string, string> kv in dic_Unumber2)
                        {
                            ListItem lt = Unumber2.Items.FindByValue(kv.Value);
                            if (lt != null)
                            {
                                lt.Selected = true;
                            }
                        }

                        Dictionary <string, string> dic_Unumber3 = AuthComm.GetEnumFormUnumber(ds.Tables["数据记录"].Rows[0]["Unumber3"].ToString());
                        foreach (KeyValuePair <string, string> kv in dic_Unumber3)
                        {
                            ListItem lt = Unumber3.Items.FindByValue(kv.Value);
                            if (lt != null)
                            {
                                lt.Selected = true;
                            }
                        }

                        Dictionary <string, string> dic_Unumber4 = AuthComm.GetEnumFormUnumber(ds.Tables["数据记录"].Rows[0]["Unumber4"].ToString());
                        foreach (KeyValuePair <string, string> kv in dic_Unumber4)
                        {
                            ListItem lt = Unumber4.Items.FindByValue(kv.Value);
                            if (lt != null)
                            {
                                lt.Selected = true;
                            }
                        }

                        Dictionary <string, string> dic_Unumber5 = AuthComm.GetEnumFormUnumber(ds.Tables["数据记录"].Rows[0]["Unumber5"].ToString());
                        foreach (KeyValuePair <string, string> kv in dic_Unumber5)
                        {
                            ListItem lt = Unumber5.Items.FindByValue(kv.Value);
                            if (lt != null)
                            {
                                lt.Selected = true;
                            }
                        }

                        string[] groupstr = ds.Tables["数据记录"].Rows[0]["Uingroups"].ToString().Split(',');
                        for (int i = 0; i < groupstr.Count(); i++)
                        {
                            if (groupstr[i].Trim() != "")
                            {
                                ListItem lt = Uingroups.Items.FindByValue(groupstr[i]);
                                if (lt != null)
                                {
                                    lt.Selected = true;
                                }
                            }
                        }
                    }
                    else
                    {
                        errmsg.InnerHtml = ds.Tables["返回值单条"].Rows[0]["提示文本"].ToString();
                    }
                }
                else
                {
                    errmsg.InnerHtml = re_dsi[1].ToString();
                }
            }
        }
    }