示例#1
0
        /// <summary>
        /// 登录
        /// </summary>
        /// <param name="userid"></param>
        /// <param name="password"></param>
        /// <param name="windowid"></param>
        /// <returns></returns>
        public string getLogin(string userid, string password, string windowid)
        {
            ErrorLog.WriteLog("getLogin#F", userid);
            EmployeeOR _empOR = new EmployeeMySqlDA().SelectAEmployeeLogin(userid, password);
            if (_empOR == null)
            {
                return "用户名或密码错误";//用户名或密码错误
            }
            WindowOR _winOR = new WindowMySqlDA().SelectWindowByNo(windowid);
            if (_winOR == null)
            {
                return string.Format("窗口号:{0}不存在", windowid);
            }

            WindowLoginInfoOR _Log = GetLoginLog(userid, windowid);
            if (_Log == null)
            {
                //在内存中查询用户是否已经登录
                WindowLoginInfoOR _LoginRecordEmp = GetLoginLogByEmployeeNo(userid);
                if (_LoginRecordEmp != null && isHaveLoginInfo(_LoginRecordEmp))
                {
                    return string.Format("用户:{0}已经登录",userid);//用户已经登录
                }

                WindowLoginInfoOR _LoginRecordWin = GetLoginLogByWindowNo(windowid);
                if (_LoginRecordWin != null && isHaveLoginInfo(_LoginRecordWin))
                {
                    return string.Format("此窗口号:{0}已登录",windowid);//此窗口已登录
                }
            }
            else
            {
                if(isHaveLoginInfo(_Log))
                {
                    return string.Format("用户:{0},窗口号:{1}已经登录", userid, windowid);
                }
            }

            try
            {
                WindowLoginInfoOR _Login = new WindowLoginInfoOR();
                _Login.Windowno = windowid;
                _Login.Employname = _empOR.Name;
                _Login.Employno = _empOR.Employno;
                _Login.Alerttime = _Login.Logintime = DateTime.Now;
                _Login.Status = 0;
                _Login.BussinessRoleOn = BussRoleObj.GetBussinessRoleOn(_empOR, _winOR);
                _WindowLoginDA.InsertLoginWindowInfo(_Login);//写入数据库
                ListWindowLogins.Add(_Login);
            }
            catch (Exception ex)
            {
                ErrorLog.WriteLog("getLogin#ex", ex.Message);
                return ex.Message; //写入数据库出错。
            }
            return "0";
        }
示例#2
0
        public bool UpdateWindow()
        {
            if (string.IsNullOrEmpty(OrgbhWhere))
                return false;

            try
            {
                WriteMsg("0000", "开始更新“窗口”", true);

                WindowMSSqlDA mssqlWind = new WindowMSSqlDA();
                List<WindowOR> listWind = mssqlWind.selectWindowData(OrgbhWhereSelf);
                WriteMsg("0000", string.Format("查询到 Window 数量:{0}条", listWind.Count));

                WindowMySqlDA mysqlWind = new WindowMySqlDA();
                mysqlWind.UpdateWindow(listWind);
                WriteMsg("0000", "更新 Window 成功。");
            }
            catch (Exception ex)
            {
                WriteMsg("", ex.Message);
            }
            return true;
        }