示例#1
0
        private void AddUserInfoToClientList(PEIS.Model.SYSOpUser tempLoginUser)
        {
            DateTime now = DateTime.Now;

            if (tempLoginUser != null)
            {
                try
                {
                    ClientInfo clientInfo = new ClientInfo();
                    clientInfo.GUID          = tempLoginUser.LoginName;
                    clientInfo.UserName      = tempLoginUser.UserName;
                    clientInfo.LoginUserName = tempLoginUser.LoginName;
                    clientInfo.UserID        = tempLoginUser.UserID.ToString();
                    clientInfo.IpAddress     = Public.GetClientIP();
                    clientInfo.LoginState    = LoginState.已成功登陆;
                    ClientListManagement.Instance().AddClientInfo(clientInfo);
                }
                catch (Exception ex)
                {
                    DateTime now2     = DateTime.Now;
                    string   dateDiff = Public.GetDateDiff(ex.Message, now, now2);
                    Log4J.Instance.Info(string.Concat(new string[]
                    {
                        "设置在线人员信息出错:",
                        Public.GetClientIP(),
                        ",",
                        tempLoginUser.UserName,
                        ",",
                        dateDiff
                    }));
                }
            }
        }
示例#2
0
        public void GetUserLoginInfo()
        {
            int userID = base.GetUserID();

            if (userID <= 0)
            {
                base.Response.Clear();
                this.OutPutMessage("-9999");
            }
            else
            {
                PEIS.Model.SYSOpUser model = PEIS.BLL.SYSOpUser.Instance.GetModel(userID);
                if (model != null)
                {
                    string str  = (!model.OperateLevel.HasValue) ? "" : model.OperateLevel.ToString();
                    string str2 = (!model.VocationType.HasValue) ? "" : model.VocationType.ToString();
                    string text = model.UserID.ToString() + "|";
                    text  = text + model.LoginName + "|";
                    text  = text + model.UserName + "|";
                    text  = text + str + "|";
                    text  = text + str2 + "|";
                    text += this.Session.SessionID;
                    this.OutPutMessage(text.ToString());
                }
            }
        }
示例#3
0
        public int Add(PEIS.Model.SYSOpUser model)
        {
            StringBuilder stringBuilder = new StringBuilder();

            stringBuilder.Append("insert into SYSOpUser(");
            stringBuilder.Append("ID_Section,UserName,LoginName,PassWord,CreateTime,LastLoginTime,TotalNum,FailCount,OperateLevel,Note,DisDate,Signature,DisCountRate,sex,Is_Del,VocationType)");
            stringBuilder.Append(" values (");
            stringBuilder.Append("@SectionID,@UserName,@LoginName,@PassWord,@CreateTime,@LastLoginTime,@TotalNum,@FailCount,@OperateLevel,@Note,@DisDate,@Signature,@DisCountRate,@sex,@Is_Del,@VocationType)");
            stringBuilder.Append(";select @@IDENTITY");
            SqlParameter[] array = new SqlParameter[]
            {
                new SqlParameter("@SectionID", SqlDbType.Int, 4),
                new SqlParameter("@UserName", SqlDbType.VarChar, 256),
                new SqlParameter("@LoginName", SqlDbType.VarChar, 30),
                new SqlParameter("@PassWord", SqlDbType.VarChar, 256),
                new SqlParameter("@CreateTime", SqlDbType.DateTime),
                new SqlParameter("@LastLoginTime", SqlDbType.DateTime),
                new SqlParameter("@TotalNum", SqlDbType.Int, 4),
                new SqlParameter("@FailCount", SqlDbType.Int, 4),
                new SqlParameter("@OperateLevel", SqlDbType.Int, 4),
                new SqlParameter("@Note", SqlDbType.VarChar, 200),
                new SqlParameter("@DisDate", SqlDbType.DateTime),
                new SqlParameter("@Signature", SqlDbType.Image),
                new SqlParameter("@DisCountRate", SqlDbType.Int, 4),
                new SqlParameter("@sex", SqlDbType.Int, 4),
                new SqlParameter("@Is_Del", SqlDbType.Int, 4),
                new SqlParameter("@VocationType", SqlDbType.Int, 4)
            };
            array[0].Value  = model.SectionID;
            array[1].Value  = model.UserName;
            array[2].Value  = model.LoginName;
            array[3].Value  = model.PassWord;
            array[4].Value  = model.CreateTime;
            array[5].Value  = model.LastLoginTime;
            array[6].Value  = model.TotalNum;
            array[7].Value  = model.FailCount;
            array[8].Value  = model.OperateLevel;
            array[9].Value  = model.Note;
            array[10].Value = model.DisDate;
            array[11].Value = model.Signature;
            array[12].Value = model.DisCountRate;
            array[13].Value = model.Sex;
            array[14].Value = model.Is_Del;
            array[15].Value = model.VocationType;
            object single = DbHelperSQL.GetSingle(stringBuilder.ToString(), array);
            int    result;

            if (single == null)
            {
                result = 0;
            }
            else
            {
                result = Convert.ToInt32(single);
            }
            return(result);
        }
示例#4
0
 protected void GetEditUserInfo(int UserID, ref VelocityContext vltContext)
 {
     PEIS.Model.SYSOpUser model = PEIS.BLL.SYSOpUser.Instance.GetModel(UserID);
     if (model != null)
     {
         vltContext.Put("UserID", model.UserID);
         vltContext.Put("UserName", model.UserName);
         vltContext.Put("SectionID", model.SectionID);
         vltContext.Put("DisCountRate", model.DisCountRate);
         vltContext.Put("OperateLevel", model.OperateLevel);
         vltContext.Put("VocationType", model.VocationType);
         vltContext.Put("Sex", model.Sex);
         vltContext.Put("Signature", model.Signature);
         vltContext.Put("Is_Del", model.Is_Del);
         vltContext.Put("Note", model.Note);
         string sectionName = CommonSystemInfo.Instance.GetSectionName(int.Parse(model.SectionID.ToString()));
         vltContext.Put("SectionName", sectionName);
     }
 }
示例#5
0
        private void JudgeLoginInfo(PEIS.Model.SYSOpUser tempLoginUser, string currUserPassword)
        {
            DateTime now = DateTime.Now;

            if (2 == tempLoginUser.Is_Del)
            {
                this.OutPutMessage(EnumUserLoginState.该用户名已被禁用.ToString());
            }
            else if (1 == tempLoginUser.Is_Del)
            {
                this.OutPutMessage(EnumUserLoginState.该用户名已被删除.ToString());
            }
            else if (5 < tempLoginUser.FailCount)
            {
                this.OutPutMessage(EnumUserLoginState.连续登录错误次数超过3次请与管理员联系.ToString());
            }
            else if (tempLoginUser != null && tempLoginUser.PassWord == currUserPassword)
            {
                tempLoginUser.LastLoginTime = new DateTime?(DateTime.Now);
                if (!tempLoginUser.TotalNum.HasValue || tempLoginUser.TotalNum.ToString() == "")
                {
                    tempLoginUser.TotalNum = new int?(1);
                }
                else
                {
                    tempLoginUser.TotalNum++;
                }
                tempLoginUser.FailCount = new int?(0);
                bool flag = false;
                try
                {
                    flag = PEIS.BLL.SYSOpUser.Instance.Update(tempLoginUser);
                }
                catch (Exception ex)
                {
                    now = DateTime.Now;
                    string dateDiff = Public.GetDateDiff(ex.Message, this.logBeginTime, now);
                    Log4J.Instance.Info(string.Concat(new string[]
                    {
                        Public.GetClientIP(),
                        ",",
                        tempLoginUser.UserName,
                        ",",
                        dateDiff
                    }));
                }
                if (flag)
                {
                    try
                    {
                        string cacheKey = "SYSOpUserModel-" + tempLoginUser.UserID;
                        DataCache.DeleteCache(cacheKey);
                        this.Session["UserID"]   = tempLoginUser.UserID;
                        this.Session["UserName"] = tempLoginUser.UserName;
                        tempLoginUser.PassWord   = "";
                        this.LoginUserModel      = tempLoginUser;
                        BasePage.SetCookie(this.LoginUserModel, true, "");
                        this.AddUserInfoToClientList(tempLoginUser);
                        now = DateTime.Now;
                        string dateDiff = Public.GetDateDiff("登录成功", this.logBeginTime, now);
                        Log4J.Instance.Info(string.Concat(new string[]
                        {
                            Public.GetClientIP(),
                            ",",
                            tempLoginUser.UserName,
                            ",",
                            dateDiff
                        }));
                        this.OutPutMessage(EnumUserLoginState.登录成功.ToString());
                    }
                    catch (Exception ex)
                    {
                        now = DateTime.Now;
                        string dateDiff = Public.GetDateDiff(ex.Message, this.logBeginTime, now);
                        Log4J.Instance.Info(string.Concat(new string[]
                        {
                            Public.GetClientIP(),
                            ",",
                            tempLoginUser.UserName,
                            ",",
                            dateDiff
                        }));
                    }
                }
            }
            else
            {
                try
                {
                    tempLoginUser.LastLoginTime = new DateTime?(DateTime.Now);
                    tempLoginUser.FailCount++;
                    PEIS.BLL.SYSOpUser.Instance.Update(tempLoginUser);
                    this.OutPutMessage(EnumUserLoginState.密码输入错误请重新输入.ToString());
                }
                catch (Exception ex)
                {
                    now = DateTime.Now;
                    string dateDiff = Public.GetDateDiff(ex.Message, this.logBeginTime, now);
                    Log4J.Instance.Info(string.Concat(new string[]
                    {
                        Public.GetClientIP(),
                        ",",
                        tempLoginUser.UserName,
                        ",",
                        dateDiff
                    }));
                }
            }
        }
示例#6
0
 public int SaveUser(PEIS.Model.SYSOpUser UserModel)
 {
     return(CommonConfig.dal.SaveUser(UserModel));
 }
示例#7
0
        public bool Update(PEIS.Model.SYSOpUser model)
        {
            StringBuilder stringBuilder = new StringBuilder();

            stringBuilder.Append("update SYSOpUser set ");
            stringBuilder.Append("SectionID=@SectionID,");
            stringBuilder.Append("UserName=@UserName,");
            stringBuilder.Append("LoginName=@LoginName,");
            stringBuilder.Append("PassWord=@PassWord,");
            stringBuilder.Append("CreateTime=@CreateTime,");
            stringBuilder.Append("LastLoginTime=@LastLoginTime,");
            stringBuilder.Append("TotalNum=@TotalNum,");
            stringBuilder.Append("FailCount=@FailCount,");
            stringBuilder.Append("OperateLevel=@OperateLevel,");
            stringBuilder.Append("Note=@Note,");
            stringBuilder.Append("DisDate=@DisDate,");
            stringBuilder.Append("Signature=@Signature,");
            stringBuilder.Append("DisCountRate=@DisCountRate,");
            stringBuilder.Append("sex=@sex,");
            stringBuilder.Append("Is_Del=@Is_Del,");
            stringBuilder.Append("VocationType=@VocationType");
            stringBuilder.Append(" where UserID=@UserID");
            SqlParameter[] array = new SqlParameter[]
            {
                new SqlParameter("@SectionID", SqlDbType.Int, 4),
                new SqlParameter("@UserName", SqlDbType.VarChar, 256),
                new SqlParameter("@LoginName", SqlDbType.VarChar, 30),
                new SqlParameter("@PassWord", SqlDbType.VarChar, 256),
                new SqlParameter("@CreateTime", SqlDbType.DateTime),
                new SqlParameter("@LastLoginTime", SqlDbType.DateTime),
                new SqlParameter("@TotalNum", SqlDbType.Int, 4),
                new SqlParameter("@FailCount", SqlDbType.Int, 4),
                new SqlParameter("@OperateLevel", SqlDbType.Int, 4),
                new SqlParameter("@Note", SqlDbType.VarChar, 200),
                new SqlParameter("@DisDate", SqlDbType.DateTime),
                new SqlParameter("@Signature", SqlDbType.Image),
                new SqlParameter("@DisCountRate", SqlDbType.Int, 4),
                new SqlParameter("@sex", SqlDbType.Int, 4),
                new SqlParameter("@Is_Del", SqlDbType.Int, 4),
                new SqlParameter("@VocationType", SqlDbType.Int, 4),
                new SqlParameter("@UserID", SqlDbType.Int, 4)
            };
            array[0].Value  = model.SectionID;
            array[1].Value  = model.UserName;
            array[2].Value  = model.LoginName;
            array[3].Value  = model.PassWord;
            array[4].Value  = model.CreateTime;
            array[5].Value  = model.LastLoginTime;
            array[6].Value  = model.TotalNum;
            array[7].Value  = model.FailCount;
            array[8].Value  = model.OperateLevel;
            array[9].Value  = model.Note;
            array[10].Value = model.DisDate;
            array[11].Value = model.Signature;
            array[12].Value = model.DisCountRate;
            array[13].Value = model.Sex;
            array[14].Value = model.Is_Del;
            array[15].Value = model.VocationType;
            array[16].Value = model.UserID;
            int num = DbHelperSQL.ExecuteSql(stringBuilder.ToString(), array);

            return(num > 0);
        }
示例#8
0
        public PEIS.Model.SYSOpUser GetModel(int UserID)
        {
            StringBuilder stringBuilder = new StringBuilder();

            stringBuilder.Append("select  top 1 [UserID],[SectionID],[UserName],[LoginName],[PassWord],[LastLoginTime],[Note],[DisDate],[Signature],[DisCountRate],[Sex],[Is_Del],[VocationType],[OperateLevel],[TotalNum],[FailCount],[CreateTime] from SYSOpUser ");
            stringBuilder.Append(" where UserID=@UserID");
            SqlParameter[] array = new SqlParameter[]
            {
                new SqlParameter("@UserID", SqlDbType.Int, 4)
            };
            array[0].Value = UserID;
            PEIS.Model.SYSOpUser sysopUser = new PEIS.Model.SYSOpUser();
            DataSet dataSet = DbHelperSQL.Query(stringBuilder.ToString(), array);

            PEIS.Model.SYSOpUser result;
            if (dataSet.Tables[0].Rows.Count > 0)
            {
                if (dataSet.Tables[0].Rows[0]["UserID"].ToString() != "")
                {
                    sysopUser.UserID = int.Parse(dataSet.Tables[0].Rows[0]["UserID"].ToString());
                }
                if (dataSet.Tables[0].Rows[0]["SectionID"].ToString() != "")
                {
                    sysopUser.SectionID = new int?(int.Parse(dataSet.Tables[0].Rows[0]["SectionID"].ToString()));
                }
                sysopUser.UserName  = dataSet.Tables[0].Rows[0]["UserName"].ToString();
                sysopUser.LoginName = dataSet.Tables[0].Rows[0]["LoginName"].ToString();
                sysopUser.PassWord  = dataSet.Tables[0].Rows[0]["PassWord"].ToString();
                if (dataSet.Tables[0].Rows[0]["CreateTime"].ToString() != "")
                {
                    sysopUser.CreateTime = DateTime.Parse(dataSet.Tables[0].Rows[0]["CreateTime"].ToString());
                }
                if (dataSet.Tables[0].Rows[0]["LastLoginTime"].ToString() != "")
                {
                    sysopUser.LastLoginTime = new DateTime?(DateTime.Parse(dataSet.Tables[0].Rows[0]["LastLoginTime"].ToString()));
                }
                if (dataSet.Tables[0].Rows[0]["TotalNum"].ToString() != "")
                {
                    sysopUser.TotalNum = new int?(int.Parse(dataSet.Tables[0].Rows[0]["TotalNum"].ToString()));
                }
                if (dataSet.Tables[0].Rows[0]["FailCount"].ToString() != "")
                {
                    sysopUser.FailCount = new int?(int.Parse(dataSet.Tables[0].Rows[0]["FailCount"].ToString()));
                }
                if (dataSet.Tables[0].Rows[0]["OperateLevel"].ToString() != "")
                {
                    sysopUser.OperateLevel = new int?(int.Parse(dataSet.Tables[0].Rows[0]["OperateLevel"].ToString()));
                }
                sysopUser.Note = dataSet.Tables[0].Rows[0]["Note"].ToString();
                if (dataSet.Tables[0].Rows[0]["DisDate"].ToString() != "")
                {
                    sysopUser.DisDate = new DateTime?(DateTime.Parse(dataSet.Tables[0].Rows[0]["DisDate"].ToString()));
                }
                if (dataSet.Tables[0].Rows[0]["Signature"].ToString() != "")
                {
                    sysopUser.Signature = (byte[])dataSet.Tables[0].Rows[0]["Signature"];
                }
                if (dataSet.Tables[0].Rows[0]["DisCountRate"].ToString() != "")
                {
                    sysopUser.DisCountRate = new int?(int.Parse(dataSet.Tables[0].Rows[0]["DisCountRate"].ToString()));
                }
                if (dataSet.Tables[0].Rows[0]["Sex"].ToString() != "")
                {
                    sysopUser.Sex = new int?(int.Parse(dataSet.Tables[0].Rows[0]["Sex"].ToString()));
                }
                if (dataSet.Tables[0].Rows[0]["Is_Del"].ToString() != "")
                {
                    sysopUser.Is_Del = new int?(int.Parse(dataSet.Tables[0].Rows[0]["Is_Del"].ToString()));
                }
                if (dataSet.Tables[0].Rows[0]["VocationType"].ToString() != "")
                {
                    sysopUser.VocationType = new int?(int.Parse(dataSet.Tables[0].Rows[0]["VocationType"].ToString()));
                }
                result = sysopUser;
            }
            else
            {
                result = null;
            }
            return(result);
        }
示例#9
0
 public bool Update(PEIS.Model.SYSOpUser model)
 {
     return(this.dal.Update(model));
 }
示例#10
0
 public int Add(PEIS.Model.SYSOpUser model)
 {
     return(this.dal.Add(model));
 }
示例#11
0
        public List <PEIS.Model.SYSOpUser> DataTableToList(DataTable dt)
        {
            List <PEIS.Model.SYSOpUser> list = new List <PEIS.Model.SYSOpUser>();
            int count = dt.Rows.Count;

            if (count > 0)
            {
                for (int i = 0; i < count; i++)
                {
                    PEIS.Model.SYSOpUser sysopUser = new PEIS.Model.SYSOpUser();
                    if (dt.Rows[i]["UserID"].ToString() != "")
                    {
                        sysopUser.UserID = int.Parse(dt.Rows[i]["UserID"].ToString());
                    }
                    if (dt.Rows[i]["SectionID"].ToString() != "")
                    {
                        sysopUser.SectionID = new int?(int.Parse(dt.Rows[i]["SectionID"].ToString()));
                    }
                    sysopUser.UserName  = dt.Rows[i]["UserName"].ToString();
                    sysopUser.LoginName = dt.Rows[i]["LoginName"].ToString();
                    sysopUser.PassWord  = dt.Rows[i]["PassWord"].ToString();
                    if (dt.Rows[i]["CreateTime"].ToString() != "")
                    {
                        sysopUser.CreateTime = DateTime.Parse(dt.Rows[i]["CreateTime"].ToString());
                    }
                    if (dt.Rows[i]["LastLoginTime"].ToString() != "")
                    {
                        sysopUser.LastLoginTime = new DateTime?(DateTime.Parse(dt.Rows[i]["LastLoginTime"].ToString()));
                    }
                    if (dt.Rows[i]["TotalNum"].ToString() != "")
                    {
                        sysopUser.TotalNum = new int?(int.Parse(dt.Rows[i]["TotalNum"].ToString()));
                    }
                    if (dt.Rows[i]["FailCount"].ToString() != "")
                    {
                        sysopUser.FailCount = new int?(int.Parse(dt.Rows[i]["FailCount"].ToString()));
                    }
                    if (dt.Rows[i]["OperateLevel"].ToString() != "")
                    {
                        sysopUser.OperateLevel = new int?(int.Parse(dt.Rows[i]["OperateLevel"].ToString()));
                    }
                    sysopUser.Note = dt.Rows[i]["Note"].ToString();
                    if (dt.Rows[i]["DisDate"].ToString() != "")
                    {
                        sysopUser.DisDate = new DateTime?(DateTime.Parse(dt.Rows[i]["DisDate"].ToString()));
                    }
                    if (dt.Rows[i]["Signature"].ToString() != "")
                    {
                        sysopUser.Signature = (byte[])dt.Rows[i]["Signature"];
                    }
                    if (dt.Rows[i]["DisCountRate"].ToString() != "")
                    {
                        sysopUser.DisCountRate = new int?(int.Parse(dt.Rows[i]["DisCountRate"].ToString()));
                    }
                    if (dt.Rows[i]["Sex"].ToString() != "")
                    {
                        sysopUser.Sex = new int?(int.Parse(dt.Rows[i]["Sex"].ToString()));
                    }
                    if (dt.Rows[i]["Is_Del"].ToString() != "")
                    {
                        sysopUser.Is_Del = new int?(int.Parse(dt.Rows[i]["Is_Del"].ToString()));
                    }
                    if (dt.Rows[i]["VocationType"].ToString() != "")
                    {
                        sysopUser.VocationType = new int?(int.Parse(dt.Rows[i]["VocationType"].ToString()));
                    }
                    list.Add(sysopUser);
                }
            }
            return(list);
        }
示例#12
0
 public int UpdateLisCustFeeExamItem(long ID_Customer, int ID_Section, PEIS.Model.SYSOpUser LoginUserModel)
 {
     return(CommonCustExam.dal.UpdateLisCustFeeExamItem(ID_Customer, ID_Section, LoginUserModel));
 }
示例#13
0
 public int UpdateSectionSummaryCheckState(PEIS.Model.SYSOpUser UserModel, int CheckState, List <int> IDList)
 {
     return(CommonCustExam.dal.UpdateSectionSummaryCheckState(UserModel, CheckState, IDList));
 }