示例#1
0
文件: MainForm.cs 项目: usetool/MyQQ
        /// <summary>
        /// 更新陌生人列表
        /// </summary>
        private void UpdateStranger(int loginId)
        {
            // 选出这个人的基本信息
            string sql   = "SELECT NickName, FaceId FROM Users WHERE Id=" + loginId;
            bool   error = false; // 用来标识是否出现错误

            try
            {
                SqlCommand command = new SqlCommand(sql, DBHelper.connection);
                DBHelper.connection.Open();
                SqlDataReader dataReader = command.ExecuteReader(); // 查询
                if (dataReader.Read())
                {
                    SbItem item = new SbItem((string)dataReader["NickName"], (int)dataReader["FaceId"]);
                    item.Tag = this.fromUserId;               // 将Id记录在Tag属性中
                    sbFriends.Groups[1].Items.Add(item);      // 向陌生人组中添加项
                }
                sbFriends.VisibleGroup = sbFriends.Groups[1]; // 设定陌生人组为可见组
            }
            catch (Exception ex)
            {
                error = true;
                Console.WriteLine(ex.Message);
            }
            finally
            {
                DBHelper.connection.Close();
            }

            // 出错了
            if (error)
            {
                MessageBox.Show("服务器出现意外错误!", "抱歉", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
示例#2
0
        /// <summary>
        /// 更新陌生人列表
        /// </summary>
        private void UpdateStranger(int loginId)
        {
            bool error = false; // 用来标识是否出现错误

            try
            {
                // 选出这个人的基本信息
                MySqlCommand cmd = new MySqlCommand("SELECT NickName, FaceId FROM Userdata,user WHERE user.Id=@userId and user.dataid=userdata.id", DBHelper.Connect());
                cmd.Parameters.AddWithValue("userId", loginId);
                MySqlDataReader dataReader = cmd.ExecuteReader(); // 查询
                if (dataReader.Read())
                {
                    SbItem item = new SbItem((string)dataReader["NickName"], (int)dataReader["FaceId"]);
                    item.Tag = this.fromUserId;               // 将Id记录在Tag属性中
                    sbFriends.Groups[1].Items.Add(item);      // 向陌生人组中添加项
                }
                sbFriends.VisibleGroup = sbFriends.Groups[1]; // 设定陌生人组为可见组
            }
            catch (Exception ex)
            {
                error = true;
                Console.WriteLine(ex.Message);
            }
            finally
            {
                DBHelper.Connect().Close();
            }

            // 出错了
            if (error)
            {
                MessageBox.Show("服务器出现意外错误!", "抱歉", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
示例#3
0
        // Token: 0x060001F4 RID: 500 RVA: 0x0000A704 File Offset: 0x00008904
        private void processGroup2(SbItem item)
        {
            if (item == null || item.Tag == null)
            {
                return;
            }
            switch ((int)item.Tag)
            {
            case 0:
            {
                QueryUsersPage page = new QueryUsersPage();
                this.switchPage(page);
                return;
            }

            case 1:
                this.switchPage(this.queryPursuitPage);
                return;

            case 2:
                this.switchPage(this.soldoutQueryTabpage);
                return;

            case 3:
                this.switchPage(this.refundQueryTabPage);
                return;

            case 4:
                this.switchPage(this.queryReplaceCardTabPage);
                return;

            case 5:
                this.switchPage(this.queryDealDetailTabPage);
                return;

            case 6:
                this.switchPage(this.queryDayMonthYearTabpage);
                return;

            case 7:
                this.switchPage(this.queryRepairMeterTabPage);
                return;

            case 8:
            {
                QueryTotalItemsTabpage page2 = new QueryTotalItemsTabpage();
                this.switchPage(page2);
                return;
            }

            case 9:
                this.switchPage(this.queryCancelDealTabPage);
                return;

            default:
                return;
            }
        }
示例#4
0
文件: MainForm.cs 项目: usetool/MyQQ
        /// <summary>
        /// 向我的好友组中添加我的好友列表
        /// </summary>
        private void ShowFriendList()
        {
            // 清空原来的列表
            sbFriends.Groups[0].Items.Clear();

            bool error = false;   // 标识数据库是否出错

            // 查找有哪些好友
            string sql = string.Format(
                "SELECT FriendId,NickName,FaceId FROM Users,Friends WHERE Friends.HostId={0} AND Users.Id=Friends.FriendId",
                UserHelper.loginId);

            try
            {
                // 执行查询
                SqlCommand command = new SqlCommand(sql, DBHelper.connection);
                DBHelper.connection.Open();
                SqlDataReader dataReader = command.ExecuteReader();

                // 循环添加好友列表
                while (dataReader.Read())
                {
                    // 创建一个SideBar项
                    SbItem item = new SbItem((string)dataReader["NickName"], (int)dataReader["FaceId"]);
                    item.Tag = (int)dataReader["FriendId"]; // 将号码放在Tag属性中

                    // SideBar中的组可以通过数组的方式访问,按照添加的顺序索引从0开始
                    // Groups[0]表示SideBar中的第一个组,也就是“我的好友”组
                    sbFriends.Groups[0].Items.Add(item); // 向SideBar的“我的好友”组中添加项
                }

                dataReader.Close();
            }
            catch (Exception ex)
            {
                error = true;
                Console.WriteLine(ex.Message);
            }
            finally
            {
                DBHelper.connection.Close();
            }
            // 出错了
            if (error)
            {
                MessageBox.Show("服务器发生意外错误!请尝试重新登录", "抱歉", MessageBoxButtons.OK, MessageBoxIcon.Error);
                Application.Exit();
            }
        }
示例#5
0
        // Token: 0x060001F3 RID: 499 RVA: 0x0000A600 File Offset: 0x00008800
        private void processGroup1(SbItem item)
        {
            if (item == null || item.Tag == null)
            {
                return;
            }
            switch ((int)item.Tag)
            {
            case 0:
                this.checkCardPage.setParentForm(this);
                this.switchPage(this.checkCardPage);
                return;

            case 1:
                this.clearCardPage.setParentForm(this);
                this.switchPage(this.clearCardPage);
                return;

            case 2:
                this.refundCardPage.setParentForm(this);
                this.switchPage(this.refundCardPage);
                return;

            case 3:
                this.settingCardPage.setParentForm(this);
                this.switchPage(this.settingCardPage);
                return;

            case 4:
                this.transCardPage.setParentForm(this);
                this.switchPage(this.transCardPage);
                return;

            case 5:
                this.forceCloseOpenCardPage.setParentForm(this);
                this.switchPage(this.forceCloseOpenCardPage);
                return;

            case 6:
                this.checkCardPage1.setParentForm(this);
                this.checkCardPage1.setFactoryMode();
                this.switchPage(this.checkCardPage1);
                return;

            default:
                return;
            }
        }
示例#6
0
        /// <summary>
        /// 向我的好友组中添加我的好友列表
        /// </summary>
        private void ShowFriendList()
        {
            // 清空原来的列表
            sbFriends.Groups[0].Items.Clear();

            bool error = false;   // 标识数据库是否出错

            try
            {
                // 查找有哪些好友
                MySqlCommand cmd = new MySqlCommand("SELECT accetFriendId,NickName,FaceId FROM UserData,Friend,user WHERE Friend.hostFriendId=@hostFriendId  AND user.id=friend.accetFriendId AND UserData.id=user.dataid", DBHelper.Connect());
                cmd.Parameters.AddWithValue("hostFriendId", UserHelper.loginId);
                MySqlDataReader dataReader = cmd.ExecuteReader();

                // 循环添加好友列表
                while (dataReader.Read())
                {
                    // 创建一个SideBar项
                    SbItem item = new SbItem((string)dataReader["NickName"], (int)dataReader["FaceId"]);
                    item.Tag = (int)dataReader["accetFriendId"]; // 将号码放在Tag属性中

                    // SideBar中的组可以通过数组的方式访问,按照添加的顺序索引从0开始
                    // Groups[0]表示SideBar中的第一个组,也就是“我的好友”组
                    sbFriends.Groups[0].Items.Add(item); // 向SideBar的“我的好友”组中添加项
                }

                dataReader.Close();
            }
            catch (Exception ex)
            {
                error = true;
                Console.WriteLine(ex.Message);
            }
            finally
            {
                DBHelper.Connect().Close();
            }
            // 出错了
            if (error)
            {
                MessageBox.Show("服务器发生意外错误!请尝试重新登录", "抱歉", MessageBoxButtons.OK, MessageBoxIcon.Error);
                Application.Exit();
            }
        }
示例#7
0
        // Token: 0x060001F2 RID: 498 RVA: 0x0000A524 File Offset: 0x00008724
        private void processGroup0(SbItem item)
        {
            if (item == null || item.Tag == null)
            {
                return;
            }
            switch ((int)item.Tag)
            {
            case 0:
                this.createNewUserPage.setParentForm(this);
                this.switchPage(this.createNewUserPage);
                return;

            case 1:
                this.userCardPage.setParentForm(this);
                this.switchPage(this.userCardPage);
                return;

            case 2:
                this.accountDailyPayPage.setParentForm(this);
                this.switchPage(this.accountDailyPayPage);
                return;

            case 3:
                this.readCardPage.setParentForm(this);
                this.switchPage(this.readCardPage);
                return;

            case 4:
                this.emptyCardPage.setParentForm(this);
                this.switchPage(this.emptyCardPage);
                return;

            case 5:
                this.receiptPrintPage.setParentForm(this);
                this.switchPage(this.receiptPrintPage);
                return;

            default:
                return;
            }
        }
示例#8
0
        // Token: 0x060001F6 RID: 502 RVA: 0x0000A918 File Offset: 0x00008B18
        private void processGroup4(SbItem item)
        {
            if (item == null || item.Tag == null)
            {
                return;
            }
            switch ((int)item.Tag)
            {
            case 0:
                this.systemSettingPage.setParentForm(this);
                this.switchPage(this.systemSettingPage);
                return;

            case 1:
                this.switchPage(this.staffManagementPage);
                return;

            case 2:
            {
                PermissionManagerTabpage page = new PermissionManagerTabpage();
                this.switchPage(page);
                return;
            }

            case 3:
                this.switchPage(this.userPwdResetPage);
                return;

            case 4:
                this.switchPage(this.priceSettingsPage);
                return;

            case 5:
                this.switchPage(this.dbBackupPage);
                return;

            default:
                return;
            }
        }
示例#9
0
        /// <summary>
        /// 更新陌生人列表
        /// </summary>        
        private void UpdateStranger(int loginId)
        {
            // 选出这个人的基本信息
            string sql = "SELECT NickName, FaceId FROM Users WHERE Id=" + loginId;
            bool error = false; // 用来标识是否出现错误
            try
            {
                SqlCommand command = new SqlCommand(sql, DBHelper.connection);
                DBHelper.connection.Open();                
                SqlDataReader dataReader = command.ExecuteReader(); // 查询
                if (dataReader.Read())
                {
                    SbItem item = new SbItem((string)dataReader["NickName"], (int)dataReader["FaceId"]);
                    item.Tag = this.fromUserId;           // 将Id记录在Tag属性中
                    sbFriends.Groups[1].Items.Add(item);  // 向陌生人组中添加项
                }
                sbFriends.VisibleGroup = sbFriends.Groups[1];  // 设定陌生人组为可见组
            }
            catch (Exception ex)
            {
                error = true;
                Console.WriteLine(ex.Message);
            }
            finally
            {
                DBHelper.connection.Close();
            }

            // 出错了
            if (error)
            {
                MessageBox.Show("服务器出现意外错误!", "抱歉", MessageBoxButtons.OK, MessageBoxIcon.Error);                
            }
        }        
示例#10
0
        /// <summary>
        /// 向我的好友组中添加我的好友列表
        /// </summary>
        private void ShowFriendList()
        {
            // 清空原来的列表
            sbFriends.Groups[0].Items.Clear();

            bool error = false;   // 标识数据库是否出错

            // 查找有哪些好友
            string sql = string.Format(
                "SELECT FriendId,NickName,FaceId FROM Users,Friends WHERE Friends.HostId={0} AND Users.Id=Friends.FriendId",
                UserHelper.loginId);
            try
            {
                // 执行查询
                SqlCommand command = new SqlCommand(sql, DBHelper.connection);
                DBHelper.connection.Open();
                SqlDataReader dataReader = command.ExecuteReader();

                // 循环添加好友列表
                while (dataReader.Read())
                {
                    // 创建一个SideBar项
                    SbItem item = new SbItem((string)dataReader["NickName"], (int)dataReader["FaceId"]);
                    item.Tag = (int)dataReader["FriendId"]; // 将号码放在Tag属性中

                    // SideBar中的组可以通过数组的方式访问,按照添加的顺序索引从0开始
                    // Groups[0]表示SideBar中的第一个组,也就是“我的好友”组
                    sbFriends.Groups[0].Items.Add(item); // 向SideBar的“我的好友”组中添加项
                }

                dataReader.Close();
            }
            catch (Exception ex)
            {
                error = true;
                Console.WriteLine(ex.Message);
            }
            finally
            {
                DBHelper.connection.Close();
            }
            // 出错了
            if (error)
            {
                MessageBox.Show("服务器发生意外错误!请尝试重新登录", "抱歉", MessageBoxButtons.OK, MessageBoxIcon.Error);
                Application.Exit();
            }
        }        
示例#11
0
        public void getResource()
        {
            string userstate = "";

            try
            {
                str = string.Format("select faceid,nickname,userstateid,mood,userstate from users,userstate " +
                                    "where users.id='{0}' and userstateid=userstate.id",
                                    userID);
                while (db.con.State != ConnectionState.Closed)
                {
                    ;
                }
                cmd = new SqlCommand(str, db.con);

                db.con.Open();
                reader = cmd.ExecuteReader();
                while (reader.Read())
                {
                    userNickName     = reader["nickname"].ToString();
                    llbHostName.Text = string.Format("{0}\n({1})", reader["nickname"].ToString(), userID);
                    txtMood.Text     = reader["mood"].ToString();
                    userstate        = reader["userstate"].ToString();
                    if ((int)reader["userstateid"] == 1)
                    {
                        pboFace.BackgroundImage = ilFace.Images[(int)reader["faceid"]]; picBusy.Hide();
                    }
                    else if ((int)reader["userstateid"] == 2)
                    {
                        pboFace.BackgroundImage = ilFace.Images[(int)reader["faceid"]]; picBusy.Show();
                    }
                    else
                    {
                        pboFace.BackgroundImage = ilFace.Images[(int)reader["faceid"] + 33]; picBusy.Hide();
                    }
                    //cboState.Text = reader["userstate"].ToString();
                }
                db.con.Close();

                //更新好友列表
                for (int i = sideBar1.Groups.Count - 1; i >= 0; i--)
                {
                    sideBar1.Groups[i].Items.Clear();
                    treeView1.Nodes[i].Nodes.Clear();
                }
                //lvGroup.Items.Clear();
                treeViewGroup.Nodes.Clear();

                str = string.Format("select friendoption,friendid,nickname,faceid,userstateid from friends,users " +
                                    "where hostid='{0}' and friendid=users.id order by friendoption,userstateid", userID);
                while (db.con.State != ConnectionState.Closed)
                {
                    ;
                }
                cmd = new SqlCommand(str, db.con);

                db.con.Open();
                reader = cmd.ExecuteReader();
                while (reader.Read())
                {
                    int group = (int)reader["friendoption"];
                    if ((int)reader["userstateid"] == 1)
                    {
                        si = new SbItem((string)reader["nickname"], (int)reader["faceid"]);
                        tn = new TreeNode((string)reader["nickname"], (int)reader["faceid"], (int)reader["faceid"]);
                    }
                    else
                    {
                        si = new SbItem((string)reader["nickname"], (int)reader["faceid"] + 33);
                        tn = new TreeNode((string)reader["nickname"], (int)reader["faceid"] + 33, (int)reader["faceid"] + 33);
                    }
                    si.Tag = (int)reader["friendid"];
                    tn.Tag = (int)reader["friendid"];
                    sideBar1.Groups[group].Items.Add(si);
                    treeView1.Nodes[group].Nodes.Add(tn);
                }
                db.con.Close();

                //str = string.Format("select groupname,groups.id from groups,groupmembers " +
                //    "where groupmemberid='{0}' and groupid=groups.id order by groupid", userID);
                //  while (db.con.State != ConnectionState.Closed) ;
                //cmd = new SqlCommand(str, db.con);

                //db.con.Open();
                //reader = cmd.ExecuteReader();
                //while (reader.Read())
                //{
                //    tn = new TreeNode(reader["groupname"].ToString(), 72, 72);
                //    tn.Tag = (int)reader["id"];
                //    treeViewGroup.Nodes.Add(tn);
                //}

                //db.con.Close();

                //for(int i=treeViewGroup.Nodes.Count-1;i>=0;i--)
                int groupid = 0, groupcount = -1;
                str = string.Format("select groupid,groupname,groupmemberid,faceid,nickname,userstateid from groups,groupmembers,users  " +
                                    "where groupmemberid=users.id and groupid=groups.id order by groupid,userstateid");
                while (db.con.State != ConnectionState.Closed)
                {
                    ;
                }
                cmd = new SqlCommand(str, db.con);

                db.con.Open();
                reader = cmd.ExecuteReader();
                while (reader.Read())
                {
                    //groupid = (int)reader["groupid"];
                    if ((int)reader["groupid"] != groupid)
                    {
                        tn     = new TreeNode(reader["groupname"].ToString(), 72, 72);
                        tn.Tag = (int)reader["groupid"];
                        treeViewGroup.Nodes.Add(tn);
                        groupcount++;
                    }
                    if ((int)reader["userstateid"] == 1)
                    {
                        tn = new TreeNode(reader["nickname"].ToString(), (int)reader["faceid"], (int)reader["faceid"]);
                    }
                    else
                    {
                        tn = new TreeNode(reader["nickname"].ToString(), (int)reader["faceid"] + 33, (int)reader["faceid"] + 33);
                    }
                    tn.Tag = (int)reader["groupmemberid"];
                    treeViewGroup.Nodes[groupcount].Nodes.Add(tn);
                    groupid = (int)reader["groupid"];
                }
                db.con.Close();
                for (int i = treeViewGroup.Nodes.Count - 1; i >= 0; i--)
                {
                    bool found = false;
                    for (int j = treeViewGroup.Nodes[i].Nodes.Count - 1; j >= 0; j--)
                    {
                        if ((int)treeViewGroup.Nodes[i].Nodes[j].Tag == userID)
                        {
                            found = true;
                        }
                    }
                    if (!found)
                    {
                        treeViewGroup.Nodes.RemoveAt(i);
                    }
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show("errorr:getResource");
            }
            finally
            {
                db.con.Close();
                cboState.Text = userstate;
            }
        }
示例#12
0
        /// <summary>
        /// 向我的好友组中添加我的好友列表
        /// </summary>
        private void ShowFriendList()
        {
            Console.WriteLine("Mainform.cs ShowFriendList");
            // 清空原来的列表
            sbFriends.Groups[0].Items.Clear();

            bool error = false;   // 标识数据库是否出错

            // 查找有哪些好友
            string sql = string.Format(
                "SELECT FriendId,NickName,FaceId FROM Users,Friends WHERE Friends.HostId={0} AND Users.Id=Friends.FriendId",
                UserHelper.loginId);
            try
            {
                DbConnection connection = DBHelper.GetConnection();
                DbCommand command = DBHelper.GetCommand(sql, connection);
                DBHelper.OpenConnection();
                DbDataReader dataReader = command.ExecuteReader();
                UserInfo userinfo;
                int frindId;
                // 循环添加好友列表
                MyQQEntities entities = DBHelper.GetNewEntities();
                while (dataReader.Read())
                {
                    // 创建一个SideBar项
                    frindId = (int)dataReader["FriendId"];
                    userinfo = entities.UserInfoes.First<UserInfo>(item => item.userId == frindId);
                    if (userinfo.isLogin.Equals("T"))
                    {
                        Console.WriteLine("userinfo:T  " + userinfo.isLogin + " id" + userinfo.userId);
                        SbItem sbitem = new SbItem((string)dataReader["NickName"], (int)dataReader["FaceId"]);

                        sbitem.Tag = (int)dataReader["FriendId"]; // 将号码放在Tag属性中

                        // SideBar中的组可以通过数组的方式访问,按照添加的顺序索引从0开始
                        // Groups[0]表示SideBar中的第一个组,也就是“我的好友”组
                        sbFriends.Groups[0].Items.Add(sbitem); // 向SideBar的“我的好友”组中添加项
                    }
                    else
                    {
                        SbItem sbitem = new SbItem((string)dataReader["NickName"], 101);

                        sbitem.Tag = (int)dataReader["FriendId"]; // 将号码放在Tag属性中

                        // SideBar中的组可以通过数组的方式访问,按照添加的顺序索引从0开始
                        // Groups[0]表示SideBar中的第一个组,也就是“我的好友”组
                        sbFriends.Groups[0].Items.Add(sbitem); // 向SideBar的“我的好友”组中添加项
                    }
                }

                dataReader.Close();
            }
            catch (Exception ex)
            {
                error = true;
                Console.WriteLine(ex.Message);
            }
            finally
            {
                DBHelper.ColseConnection();
            }
            // 出错了
            if (error)
            {
                MessageBox.Show("服务器发生意外错误!请尝试重新登录", "抱歉", MessageBoxButtons.OK, MessageBoxIcon.Error);
                Application.Exit();
            }
        }
示例#13
0
 //加载好友信息
 private void friendsInfo()
 {
     this.sideBar1.Groups[0].Items.Clear();
     string sql = string.Format("select FriendId,FaceId,NickName from Friends inner join [user] on Friends.FriendId=[user].QQ where hostId='{0}'", UserHelp.QQ);
     con.Open();
     SqlCommand com = new SqlCommand(sql, con);
     SqlDataReader reader = com.ExecuteReader();
     while (reader.Read())
     {
         string nickname = reader["NickName"].ToString();
         int faceid = (int)reader["FaceId"];
         UserHelp.friendid = Convert.ToInt32(reader["FriendId"]);
         SbItem item = new SbItem(nickname + "(" + UserHelp.friendid + ")", faceid);
         item.Tag = (int)reader["FriendId"];
         this.sideBar1.Groups[0].Items.Add(item);
     }
     reader.Close();
     con.Close();
 }
示例#14
0
        // Token: 0x060001F5 RID: 501 RVA: 0x0000A7E0 File Offset: 0x000089E0
        private void processGroup3(SbItem item)
        {
            if (item == null || item.Tag == null)
            {
                return;
            }
            switch ((int)item.Tag)
            {
            case 0:
                this.repairChangeMeterPage.setParentForm(this);
                this.switchPage(this.repairChangeMeterPage);
                return;

            case 1:
            {
                UserSearchForTrans userSearchForTrans = new UserSearchForTrans();
                userSearchForTrans.setParentForm(this);
                userSearchForTrans.setTitleLalbel("用户补卡");
                userSearchForTrans.setType(UserSearchForTrans.SWITCH_TO_REPLACECARD);
                this.switchPage(userSearchForTrans);
                return;
            }

            case 2:
                this.userInfoModifyPage.setParentForm(this);
                this.switchPage(this.userInfoModifyPage);
                return;

            case 3:
                this.refundProcessPage = new RefundProcessPage();
                this.refundProcessPage.setParentForm(this);
                this.switchPage(this.refundProcessPage);
                return;

            case 4:
                this.switchPage(this.suspiciousUserQueryTabPage);
                return;

            case 5:
                this.cancelDealPage.setParentForm(this);
                this.switchPage(this.cancelDealPage);
                return;

            case 6:
                this.transWrongMeterTabPage.setParentForm(this);
                this.switchPage(this.transWrongMeterTabPage);
                return;

            case 7:
            {
                UserSearchForTrans userSearchForTrans2 = new UserSearchForTrans();
                userSearchForTrans2.setParentForm(this);
                userSearchForTrans2.setTitleLalbel("用户过户");
                userSearchForTrans2.setType(UserSearchForTrans.SWITCH_TO_TRANSFOROWNER);
                this.switchPage(userSearchForTrans2);
                return;
            }

            case 8:
            {
                this.refundFailedPage.setParentForm(this);
                this.switchPage(this.refundFailedPage);
                return;
            }

            default:
                return;
            }
        }
示例#15
0
        // Token: 0x060001D8 RID: 472 RVA: 0x000093C8 File Offset: 0x000075C8
        private void initializePages()
        {
            this.createNewUserPage      = new CreateNewUserPage();
            this.userCardPage           = new UserCardPage();
            this.welcomePage            = new WelcomePage();
            this.checkCardPage          = new CheckCardPage();
            this.checkCardPage1         = new CheckCardPage();
            this.forceCloseOpenCardPage = new ForceCloseOrOpenCardPage();
            this.refundCardPage         = new RefundCardPage();
            this.settingCardPage        = new SettingCardPage();
            this.transCardPage          = new TransCardPage();
            this.clearCardPage          = new ClearCardPage();
            this.emptyCardPage          = new EmptyCardPage();
            this.settingsPage           = new SettingsPage();
            this.readCardPage           = new ReadCardPage();
            this.receiptPrintPage       = new ReceiptPrintPage();
            this.accountDailyPayPage    = new AccountDailyPayPage();
            DbUtil dbUtil = new DbUtil();

            dbUtil.AddParameter("staffId", MainForm.staffId);
            DataRow dataRow = dbUtil.ExecuteRow("SELECT * FROM staffTable WHERE staffId=@staffId");

            if (dataRow != null)
            {
                this.permissions = ConvertUtils.ToUInt64(dataRow["permissions"].ToString());
            }
            else
            {
                this.permissions = 0UL;
            }
            if (PermissionFlags.hasDailyOperation(this.permissions))
            {
                SbGroup sbGroup = new SbGroup();
                sbGroup.Tag  = 0;
                sbGroup.Text = "日常业务";
                this.sideBar1.AddGroup(sbGroup);
                this.sideBar1.VisibleGroup = sbGroup;
                if (PermissionFlags.hasPermission(this.permissions, PermissionFlags.xinhukaihu_flag))
                {
                    SbItem sbItem = new SbItem("新户开户", 0);
                    sbItem.Tag = 0;
                    this.sideBar1.Groups[0].Items.Add(sbItem);
                }
                if (PermissionFlags.hasPermission(this.permissions, PermissionFlags.richanggoumai_flag))
                {
                    SbItem sbItem2 = new SbItem("日常购买", 0);
                    sbItem2.Tag = 1;
                    this.sideBar1.Groups[0].Items.Add(sbItem2);
                }
                if (PermissionFlags.hasPermission(this.permissions, PermissionFlags.yingyezhazhang_flag))
                {
                    SbItem sbItem3 = new SbItem("营业扎帐", 0);
                    sbItem3.Tag = 2;
                    this.sideBar1.Groups[0].Items.Add(sbItem3);
                }
                if (PermissionFlags.hasPermission(this.permissions, PermissionFlags.duka_flag))
                {
                    SbItem sbItem4 = new SbItem("读   卡", 0);
                    sbItem4.Tag = 3;
                    this.sideBar1.Groups[0].Items.Add(sbItem4);
                }
                if (PermissionFlags.hasPermission(this.permissions, PermissionFlags.qingka_flag))
                {
                    SbItem sbItem5 = new SbItem("清   卡", 0);
                    sbItem5.Tag = 4;
                    this.sideBar1.Groups[0].Items.Add(sbItem5);
                }
                if (PermissionFlags.hasPermission(this.permissions, PermissionFlags.budafapiao_flag))
                {
                    SbItem sbItem6 = new SbItem("补打发票", 0);
                    sbItem6.Tag = 5;
                    this.sideBar1.Groups[0].Items.Add(sbItem6);
                }
            }
            if (PermissionFlags.hasMakeFunctionCard(this.permissions))
            {
                int     count    = this.sideBar1.Groups.Count;
                SbGroup sbGroup2 = new SbGroup();
                sbGroup2.Tag  = 1;
                sbGroup2.Text = "功能卡制作";
                this.sideBar1.AddGroup(sbGroup2);
                if (PermissionFlags.hasPermission(this.permissions, PermissionFlags.zhizuochaxunka_flag))
                {
                    SbItem sbItem7 = new SbItem("制作查询卡", 0);
                    sbItem7.Tag = 0;
                    this.sideBar1.Groups[count].Items.Add(sbItem7);
                }
                if (PermissionFlags.hasPermission(this.permissions, PermissionFlags.zhizuoqinglingka_flag))
                {
                    SbItem sbItem8 = new SbItem("制作清零卡", 0);
                    sbItem8.Tag = 1;
                    this.sideBar1.Groups[count].Items.Add(sbItem8);
                }
                PermissionFlags.hasPermission(this.permissions, PermissionFlags.zhizuotuigouka_flag);
                if (PermissionFlags.hasPermission(this.permissions, PermissionFlags.zhizuoshezhika_flag))
                {
                    SbItem sbItem9 = new SbItem("制作设置卡", 0);
                    sbItem9.Tag = 3;
                    this.sideBar1.Groups[count].Items.Add(sbItem9);
                }
                if (PermissionFlags.hasPermission(this.permissions, PermissionFlags.zhizuozhuanyika_flag))
                {
                    SbItem sbItem10 = new SbItem("制作转移卡", 0);
                    sbItem10.Tag = 4;
                    this.sideBar1.Groups[count].Items.Add(sbItem10);
                }
                if (PermissionFlags.hasPermission(this.permissions, PermissionFlags.zhizuoqiangzhikaguanfaka_flag))
                {
                    SbItem sbItem11 = new SbItem("制作工程卡", 0);
                    sbItem11.Tag = 5;
                    this.sideBar1.Groups[count].Items.Add(sbItem11);
                }
                if (this.bHasFactoryMode)
                {
                    SbItem sbItem12 = new SbItem("制作工厂卡", 0);
                    sbItem12.Tag = 6;
                    this.sideBar1.Groups[count].Items.Add(sbItem12);
                }
            }
            if (PermissionFlags.hasQueryTableFunction(this.permissions))
            {
                int     count2   = this.sideBar1.Groups.Count;
                SbGroup sbGroup3 = new SbGroup();
                sbGroup3.Tag  = 2;
                sbGroup3.Text = "报表管理";
                this.sideBar1.AddGroup(sbGroup3);
                if (PermissionFlags.hasPermission(this.permissions, PermissionFlags.kehuxinxichaxun_flag))
                {
                    SbItem sbItem13 = new SbItem("客户信息查询", 0);
                    sbItem13.Tag = 0;
                    this.sideBar1.Groups[count2].Items.Add(sbItem13);
                }
                if (PermissionFlags.hasPermission(this.permissions, PermissionFlags.goumaimingxichaxun_flag))
                {
                    SbItem sbItem14 = new SbItem("购买明细查询", 0);
                    sbItem14.Tag = 1;
                    this.sideBar1.Groups[count2].Items.Add(sbItem14);
                }
                if (PermissionFlags.hasPermission(this.permissions, PermissionFlags.shouchumingxichaxun_flag))
                {
                    SbItem sbItem15 = new SbItem("售出明细查询", 0);
                    sbItem15.Tag = 2;
                    this.sideBar1.Groups[count2].Items.Add(sbItem15);
                }
                if (PermissionFlags.hasPermission(this.permissions, PermissionFlags.tuigoumingxichaxun_flag))
                {
                    SbItem sbItem16 = new SbItem("退购明细查询", 0);
                    sbItem16.Tag = 3;
                    this.sideBar1.Groups[count2].Items.Add(sbItem16);
                }
                if (PermissionFlags.hasPermission(this.permissions, PermissionFlags.bukamingxichaxun_flag))
                {
                    SbItem sbItem17 = new SbItem("补卡明细查询", 0);
                    sbItem17.Tag = 4;
                    this.sideBar1.Groups[count2].Items.Add(sbItem17);
                }
                if (PermissionFlags.hasPermission(this.permissions, PermissionFlags.jiaoyimingxichaxun_flag))
                {
                    SbItem sbItem18 = new SbItem("交易明细查询", 0);
                    sbItem18.Tag = 5;
                    this.sideBar1.Groups[count2].Items.Add(sbItem18);
                }
                if (PermissionFlags.hasPermission(this.permissions, PermissionFlags.ribaoyuebaonianbao_flag))
                {
                    SbItem sbItem19 = new SbItem("日报月报年报", 0);
                    sbItem19.Tag = 6;
                    this.sideBar1.Groups[count2].Items.Add(sbItem19);
                }
                if (PermissionFlags.hasPermission(this.permissions, PermissionFlags.yibiaoweixiuchaxun_flag))
                {
                    SbItem sbItem20 = new SbItem("维修换表查询", 0);
                    sbItem20.Tag = 7;
                    this.sideBar1.Groups[count2].Items.Add(sbItem20);
                }
                if (PermissionFlags.hasPermission(this.permissions, PermissionFlags.zonghejiaoyichaxun_flag))
                {
                    SbItem sbItem21 = new SbItem("综合统计查询", 0);
                    sbItem21.Tag = 8;
                    this.sideBar1.Groups[count2].Items.Add(sbItem21);
                }
                if (PermissionFlags.hasPermission(this.permissions, PermissionFlags.quxiaojiaoyichaxun_flag))
                {
                    SbItem sbItem22 = new SbItem("取消交易查询", 0);
                    sbItem22.Tag = 9;
                    this.sideBar1.Groups[count2].Items.Add(sbItem22);
                }
            }
            if (PermissionFlags.hasUnusualOperationFunction(this.permissions))
            {
                int     count3   = this.sideBar1.Groups.Count;
                SbGroup sbGroup4 = new SbGroup();
                sbGroup4.Tag  = 3;
                sbGroup4.Text = "异常业务";
                this.sideBar1.AddGroup(sbGroup4);
                if (PermissionFlags.hasPermission(this.permissions, PermissionFlags.weixiuhuanbiao_flag))
                {
                    SbItem sbItem23 = new SbItem("维修换表", 0);
                    sbItem23.Tag = 0;
                    this.sideBar1.Groups[count3].Items.Add(sbItem23);
                }
                if (PermissionFlags.hasPermission(this.permissions, PermissionFlags.yonghubuka_flag))
                {
                    SbItem sbItem24 = new SbItem("用户补卡", 0);
                    sbItem24.Tag = 1;
                    this.sideBar1.Groups[count3].Items.Add(sbItem24);
                }
                if (PermissionFlags.hasPermission(this.permissions, PermissionFlags.xinxixiugai_flag))
                {
                    SbItem sbItem25 = new SbItem("信息修改", 0);
                    sbItem25.Tag = 2;
                    this.sideBar1.Groups[count3].Items.Add(sbItem25);
                }
                if (PermissionFlags.hasPermission(this.permissions, PermissionFlags.yonghutuigou_flag))
                {
                    SbItem sbItem26 = new SbItem("用户退购", 0);
                    sbItem26.Tag = 3;
                    this.sideBar1.Groups[count3].Items.Add(sbItem26);
                }
                if (PermissionFlags.hasPermission(this.permissions, PermissionFlags.yonghufenxi_flag))
                {
                    SbItem sbItem27 = new SbItem("可疑用户分析", 0);
                    sbItem27.Tag = 4;
                    this.sideBar1.Groups[count3].Items.Add(sbItem27);
                }
                if (PermissionFlags.hasPermission(this.permissions, PermissionFlags.quxiaojiaoyi_flag))
                {
                    SbItem sbItem28 = new SbItem("取消交易", 0);
                    sbItem28.Tag = 5;
                    this.sideBar1.Groups[count3].Items.Add(sbItem28);
                }
                if (PermissionFlags.hasPermission(this.permissions, PermissionFlags.cuowushuakachongzhi_flag))
                {
                    SbItem sbItem29 = new SbItem("错误刷卡重置", 0);
                    sbItem29.Tag = 6;
                    this.sideBar1.Groups[count3].Items.Add(sbItem29);
                }
                if (PermissionFlags.hasPermission(this.permissions, PermissionFlags.guohu_flag))
                {
                    SbItem sbItem30 = new SbItem("用户过户", 0);
                    sbItem30.Tag = 7;
                    this.sideBar1.Groups[count3].Items.Add(sbItem30);
                }
                if (PermissionFlags.hasPermission(this.permissions, PermissionFlags.zizhutuikuanshibai_flag))
                {
                    SbItem sbItem30 = new SbItem("自助退款失败", 0);
                    sbItem30.Tag = 8;
                    this.sideBar1.Groups[count3].Items.Add(sbItem30);
                }
            }
            if (PermissionFlags.hasSystemSettingOperation(this.permissions))
            {
                int     count4   = this.sideBar1.Groups.Count;
                SbGroup sbGroup5 = new SbGroup();
                sbGroup5.Tag  = 4;
                sbGroup5.Text = "系统设置";
                this.sideBar1.AddGroup(sbGroup5);
                if (PermissionFlags.hasPermission(this.permissions, PermissionFlags.xitongshezhi_flag))
                {
                    SbItem sbItem31 = new SbItem("系统设置", 0);
                    sbItem31.Tag = 0;
                    this.sideBar1.Groups[count4].Items.Add(sbItem31);
                }
                if (PermissionFlags.hasPermission(this.permissions, PermissionFlags.renyuanguanli_flag))
                {
                    SbItem sbItem32 = new SbItem("人员管理", 0);
                    sbItem32.Tag = 1;
                    this.sideBar1.Groups[count4].Items.Add(sbItem32);
                }
                if (PermissionFlags.hasPermission(this.permissions, PermissionFlags.quanxianfenpei_flag))
                {
                    SbItem sbItem33 = new SbItem("权限管理", 0);
                    sbItem33.Tag = 2;
                    this.sideBar1.Groups[count4].Items.Add(sbItem33);
                }
                if (PermissionFlags.hasPermission(this.permissions, PermissionFlags.mimachongzhi_flag))
                {
                    SbItem sbItem34 = new SbItem("密码重置", 0);
                    sbItem34.Tag = 3;
                    this.sideBar1.Groups[count4].Items.Add(sbItem34);
                }
                if (PermissionFlags.hasPermission(this.permissions, PermissionFlags.jiageguanli_flag))
                {
                    SbItem sbItem35 = new SbItem("价格管理", 0);
                    sbItem35.Tag = 4;
                    this.sideBar1.Groups[count4].Items.Add(sbItem35);
                }
                //注释 菜单 数据备份
                //if (PermissionFlags.hasPermission(this.permissions, PermissionFlags.shujubeifen_flag))
                //{
                //	SbItem sbItem36 = new SbItem("数据备份", 0);
                //	sbItem36.Tag = 5;
                //	this.sideBar1.Groups[count4].Items.Add(sbItem36);
                //}
            }
            this.sideBar1.Invalidate();
            this.switchPage(this.welcomePage);
        }