Пример #1
0
        private void frmUserID_SelectedIndexChanged(object sender, EventArgs e)
        {
            //根据用户的ID知道用户姓名
            Entity.User user = new Entity.User();
            user.UserID = CbUserID.Text;
            Facade.QueryUserFacade QueryUser = new Facade.QueryUserFacade();

            IList <Entity.User> Luser = new List <Entity.User>();

            Luser = QueryUser.QueryUser(user);

            txtUserName.Text = Luser[0].UserName;


            // 显示内容在tab1的date中
            paraToolStripTextBox.Text = CbUserID.Text;

            try
            {
                this.card_infoTableAdapter.queryUserID(this.check_buyCard.Card_info, paraToolStripTextBox.Text);
            }
            catch (System.Exception ex)
            {
                System.Windows.Forms.MessageBox.Show(ex.Message);
            }

            //将值传给tab2,以达到传值
            userIDToolStripTextBox.Text  = CbUserID.Text;
            ischeckToolStripTextBox.Text = "未结账";

            //将值传给tab3
            userIDToolStripTextBox1.Text  = CbUserID.Text;
            isCheckToolStripTextBox1.Text = "未结账";
        }
Пример #2
0
        private void button1_Click(object sender, EventArgs e)
        {
            //判空
            foreach (Control con in this.Controls)
            {
                if (con.Text == "")
                {
                    MessageBox.Show("请将内容补充完整", "提示");
                    con.Focus();
                    return;
                }
            }
            //查询是否有该用户,
            Entity.User user = new Entity.User();
            user.UserID   = txtUserID.Text.Trim();
            user.UserName = txtName.Text.Trim();
            user.PassWord = txtPWD.Text.Trim();
            user.Level    = CBlevel.Text;
            user.Head     = frmLogin.UserName;//------------------------------------------
            //user.Head = "YY";

            Facade.QueryUserFacade QueryUser = new Facade.QueryUserFacade();
            IList <Entity.User>    luser     = new List <Entity.User>();

            luser = QueryUser.QueryUser(user);

            if (luser.Count != 0)
            {
                MessageBox.Show("该用户ID已注册,请更换ID", "提示");
                txtUserID.Text = "";
                txtUserID.Focus();
                return;
            }
            else
            //存在,添加
            {
                Facade.AddVSdelUserFacade addUser = new Facade.AddVSdelUserFacade();
                bool flag;
                flag = addUser.addUser(user);
                if (flag == true)
                {
                    MessageBox.Show("添加成功", "提示");
                    return;
                }
            }
        }
Пример #3
0
        private void frmMain_Load(object sender, EventArgs e)
        {
            //查询权限,显示toolstrip
            Entity.User user = new Entity.User();
            user.UserID = frmLogin.UserName;
            IList <Entity.User> Luser = new List <Entity.User>();

            Facade.QueryUserFacade QueryUserfacade = new Facade.QueryUserFacade();
            Luser = QueryUserfacade.QueryUser(user);
            if (Luser[0].Level == "一般用户")
            {
                操作员ToolStripMenuItem.Enabled = false;

                管理员ToolStripMenuItem.Enabled = false;
            }
            if (Luser[0].Level == "操作员")
            {
                管理员ToolStripMenuItem.Enabled = false;
            }
        }
Пример #4
0
        private void frmCheckOut_Load(object sender, EventArgs e)
        {
            // TODO: 这行代码将数据加载到表“check_returnCard.ReturnCard_info”中。您可以根据需要移动或删除它。
            this.returnCard_infoTableAdapter.Fill(this.check_returnCard.ReturnCard_info);
            // TODO: 这行代码将数据加载到表“chargeDataSet3check_chargeCard.Charge_info”中。您可以根据需要移动或删除它。
            //this.charge_infoTableAdapter1.Fill(this.chargeDataSet3check_chargeCard.Charge_info);
            // TODO: 这行代码将数据加载到表“check_buyCard.Card_info”中。您可以根据需要移动或删除它。
            //this.card_infoTableAdapter.Fill(this.check_buyCard.Card_info);
            this.queryUserIDToolStrip.Hide();
            this.queryCharge1ToolStrip.Hide();
            this.queryReturnCardToolStrip.Hide();
            //加载窗体将操作员和管理员的放入 其中
            Entity.User         user  = new Entity.User();
            IList <Entity.User> Luser = new List <Entity.User>();

            Facade.QueryUserFacade QueryUser = new Facade.QueryUserFacade();
            Luser = QueryUser.QueryUser(user);


            for (int i = 1; i < Luser.Count; i++)
            {
                CbUserID.Items.Add(Luser[i].UserID);
            }
        }
Пример #5
0
        private void btlogin_Click(object sender, EventArgs e)
        {
            UserName = txtUserName.Text.Trim();  //全局变量
            //传递用户输入的参数
            string UserID = txtUserName.Text.Trim();

            // string PWD = txtUserPWD.Text.Trim();

            //定义外观层对象
            Facade.LoginFacade loginfacade = new Facade.LoginFacade();
            Entity.User        userinfo    = new Entity.User();

            //将文本框的值给实体层对象,让实体层对象带上参数
            userinfo.UserID   = txtUserName.Text;
            userinfo.PassWord = txtUserPWD.Text;

            string strResult;

            strResult = loginfacade.loginfacade(userinfo);

            switch (strResult)
            {
            case "无用户": MessageBox.Show("用户不存在,请重新输入");

                break;

            case "登录成功":     //MessageBox.Show("登录成功 ");
                this.Visible = false;
                //查找user的信息
                Entity.User userInfo = new Entity.User();
                userinfo.UserID = txtUserName.Text;
                Facade.QueryUserFacade queryUser = new Facade.QueryUserFacade();
                IList <Entity.User>    lUser     = new List <Entity.User>();
                lUser = queryUser.QueryUser(userinfo);

                //将正在上班的信息,传到当值 表
                Facade.AddWorkerFacade addonwork = new Facade.AddWorkerFacade();

                Entity.onWork onwork = new Entity.onWork();
                onwork.UserID   = lUser[0].UserID;
                onwork.Level    = lUser[0].Level;
                onwork.Computer = Environment.MachineName;     //获得计算机名称
                bool flag;
                flag = addonwork.addOnwork(onwork);

                //传到上机记录表
                Entity.WorkLog worklog = new Entity.WorkLog();
                worklog.UserID   = lUser[0].UserID;
                worklog.Level    = lUser[0].Level;
                worklog.Computer = Environment.MachineName;
                worklog.Status   = "正常上机";
                flag             = addonwork.addWorkLog(worklog);

                frmMain frmmain = new frmMain();
                frmmain.StartPosition = FormStartPosition.CenterParent;
                frmmain.Show();
                break;

            case "密码不正确": MessageBox.Show("用户密码不正确,请重新输入 ");
                break;
            }
        }