示例#1
0
文件: addDAL.cs 项目: MungerLi/Charge
        public void IdelOnworker(Entity.onWork onwork)
        {
            SqlParameter[] para = { new SqlParameter("@userID", onwork.UserID) };
            string         sql  = "delete from onwork_info where userID=@userID";

            sqlhelper.ExecuteNoquery(sql, CommandType.Text, para);
        }
示例#2
0
文件: addDAL.cs 项目: MungerLi/Charge
        public bool IaddonWorker(Entity.onWork onwork)
        {
            //throw new NotImplementedException();
            SqlParameter[] para =
            {
                new SqlParameter("@userID",   onwork.UserID),
                new SqlParameter("@level",    onwork.Level),
                new SqlParameter("@computer", onwork.Computer)
            };
            string sql = "insert into onwork_info(userID,level,computer) values(@userID,@level,@computer)";

            return(sqlhelper.ExecuteNonquery(sql, CommandType.Text, para));
        }
示例#3
0
        public IList <Entity.onWork> select(Entity.onWork onwork)
        {
            //throw new NotImplementedException();
            SqlParameter[] para =
            {
                new SqlParameter("@userID", onwork.UserID)
            };
            string                sql     = "select * from onwork_info where userID=@userID ";
            DataTable             table   = DAL.sqlhelper.GetDatable(sql, CommandType.Text, para);
            IList <Entity.onWork> lOnwork = DAL.CovertHelper <Entity.onWork> .ConvertToModel(table);

            return(lOnwork);
        }
示例#4
0
        private void frmMain_FormClosing(object sender, FormClosingEventArgs e)
        {
            if (DialogResult.OK == MessageBox.Show("你确定要关闭应用程序吗?", "关闭提示", MessageBoxButtons.OKCancel, MessageBoxIcon.Question))
            {
                //补充完整值班记录

                Entity.onWork onwork = new Entity.onWork();
                onwork.UserID = frmLogin.UserName;

                //查询onwork表
                Facade.QueryOnworkFac queryOnwork = new Facade.QueryOnworkFac();
                IList <Entity.onWork> lonwork     = new List <Entity.onWork>();
                lonwork = queryOnwork.queryOnwork(onwork);
                //补充完整值班记录
                Entity.WorkLog worklog = new Entity.WorkLog();
                worklog.UserID   = lonwork[0].UserID;
                worklog.Level    = lonwork[0].Level;
                worklog.LogDate  = lonwork[0].logindate;
                worklog.LogTime  = lonwork[0].logintime;
                worklog.Computer = lonwork[0].Computer;

                Facade.AddWorkerFacade addworkerlog = new Facade.AddWorkerFacade();
                addworkerlog.addWorkLogTime(worklog);


                //删除正在值班教师
                Facade.AddWorkerFacade delOnwork = new Facade.AddWorkerFacade();
                delOnwork.delonWorkFac(onwork);



                this.FormClosing -= new FormClosingEventHandler(this.frmMain_FormClosing); //为保证Application.Exit();时不再弹出提示,所以将FormClosing事件取消
                Application.Exit();                                                        //退出整个程序
            }
            else
            {
                e.Cancel = true;  //取消关闭事件
            }
        }
示例#5
0
 public void delonWorkFac(Entity.onWork onwork)
 {
     BLL.AddWorkerBLL delONwork = new BLL.AddWorkerBLL();
     delONwork.delonwork(onwork);
 }
示例#6
0
 public bool addOnwork(Entity.onWork onwork)
 {
     BLL.AddWorkerBLL addonwork = new BLL.AddWorkerBLL();
     return(addonwork.addonWork(onwork));
 }
示例#7
0
 public void delonwork(Entity.onWork onwork)
 {
     Factory.Factory delonWorkfac = new Factory.Factory();
     IDal.IaddWorker delOnwork    = delonWorkfac.addWorker();
     delOnwork.IdelOnworker(onwork);
 }
示例#8
0
 public bool addonWork(Entity.onWork onwork)
 {
     Factory.Factory addonworkfac = new Factory.Factory();
     IDal.IaddWorker addonwork    = addonworkfac.addWorker();
     return(addonwork.IaddonWorker(onwork));
 }
示例#9
0
 public IList <Entity.onWork> queryOnwork(Entity.onWork onwork)
 {
     BLL.QueryOnworkBll queryonwork = new BLL.QueryOnworkBll();
     return(queryonwork.queryOnworkbll(onwork));
 }
示例#10
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;
            }
        }