コード例 #1
0
 public ActionResult CreateUser(UserRegModel userReg)
 {
     try
     {
         var user = db.FP_WMS_UserInfo.SingleOrDefault(t => t.username == userReg.username);
         if (user != null)
         {
             return(Json(new { Status = 0, Content = "用户已存在" }));
         }
         FP_WMS_UserInfo new_user = new FP_WMS_UserInfo();
         new_user.roleid       = 3;
         new_user.roles        = "";
         new_user.departid     = 0;
         new_user.departname   = "";
         new_user.departlist   = "";
         new_user.departs      = "";
         new_user.display      = 0;
         new_user.gradeid      = 0;
         new_user.types        = "";
         new_user.username     = userReg.username;
         new_user.password     = FPUtils.MD5(userReg.password);
         new_user.password2    = "";
         new_user.email        = "";
         new_user.isemail      = 0;
         new_user.mobile       = userReg.phonenumber;
         new_user.ismobile     = 0;
         new_user.realname     = userReg.truename;
         new_user.cardtype     = "";
         new_user.idcard       = "";
         new_user.isreal       = 0;
         new_user.usercode     = "";
         new_user.nickname     = "";
         new_user.avatar       = "";
         new_user.sex          = "";
         new_user.exp          = 0;
         new_user.credits      = 0;
         new_user.regip        = CreateExamHelp.GetLocalIP();
         new_user.joindatetime = DateTime.Now;
         new_user.sumlogin     = 0;
         new_user.lastip       = "";
         new_user.lastvisit    = new_user.joindatetime;
         new_user.secques      = "";
         new_user.authstr      = "";
         new_user.authtime     = new_user.joindatetime;
         new_user.authflag     = 1;
         new_user.vipdate      = "";
         new_user.state        = 1;
         new_user.issso        = 0;
         new_user.extend       = "{}";
         db.FP_WMS_UserInfo.Add(new_user);
         db.SaveChanges();
         return(Json(new { Status = 1, Content = "注册成功,请等待管理员审核" }));
     }
     catch (Exception e)
     {
         return(Json(new { Status = 0, Content = "注册失败出现异常" }));
     }
 }
コード例 #2
0
 // Token: 0x060002F2 RID: 754 RVA: 0x0000B890 File Offset: 0x00009A90
 public static int UpdatePassword2(int id, string password)
 {
     SqlParam[] sqlparams = new SqlParam[]
     {
         DbHelper.MakeSet("password2", FPUtils.MD5(password)),
         DbHelper.MakeAndWhere("id", id)
     };
     return(DbHelper.ExecuteUpdate <UserInfo>(sqlparams));
 }
コード例 #3
0
 // Token: 0x060002EA RID: 746 RVA: 0x0000B5A0 File Offset: 0x000097A0
 public static UserInfo CheckPassword2(int id, string password, bool originalpassword)
 {
     SqlParam[] sqlparams = new SqlParam[]
     {
         DbHelper.MakeAndWhere("id", id),
         DbHelper.MakeAndWhere("password2", originalpassword ? FPUtils.MD5(password) : password)
     };
     return(DbHelper.ExecuteModel <UserInfo>(sqlparams));
 }
コード例 #4
0
        // Token: 0x060002E6 RID: 742 RVA: 0x0000B4BC File Offset: 0x000096BC
        public static UserInfo CheckLogin(string username, string password)
        {
            string commandText = string.Format("SELECT * FROM [{0}WMS_UserInfo] WHERE ([username]=@account OR ([isemail]=1 AND [email]=@account) OR ([ismobile]=1 AND [mobile]=@account)) AND [password]=@password", DbConfigs.Prefix);

            DbParameter[] dbparams = new DbParameter[]
            {
                DbHelper.MakeInParam("@account", username),
                DbHelper.MakeInParam("@password", FPUtils.MD5(password))
            };
            return(DbHelper.ExecuteModel <UserInfo>(commandText, dbparams));
        }
コード例 #5
0
        // Token: 0x060002F6 RID: 758 RVA: 0x0000B9FC File Offset: 0x00009BFC
        public static string GetUserSecques(int questionid, string answer)
        {
            string result;

            if (questionid > 0)
            {
                result = FPUtils.MD5(answer + FPUtils.MD5(questionid.ToString())).Substring(15, 8);
            }
            else
            {
                result = "";
            }
            return(result);
        }
コード例 #6
0
 // Token: 0x0600030F RID: 783 RVA: 0x0000CBF0 File Offset: 0x0000ADF0
 protected override void View()
 {
     if (this.authstr != "")
     {
         List <SqlParam> list = new List <SqlParam>();
         list.Add(DbHelper.MakeAndWhere("authstr", this.authstr));
         list.Add(DbHelper.MakeAndWhere("authflag", 2));
         if (DbConfigs.DbType == DbType.Access)
         {
             list.Add(DbHelper.MakeAndWhere("DATEDIFF(\"m\",[authtime],NOW())<=30", WhereType.Custom, ""));
         }
         else
         {
             list.Add(DbHelper.MakeAndWhere("DateDiff(m,[authtime],getdate())<=30", WhereType.Custom, ""));
         }
         UserInfo userInfo = DbHelper.ExecuteModel <UserInfo>(list.ToArray());
         if (userInfo.id == 0)
         {
             this.ShowErr("用户验证码过期或不存在。");
         }
         else if (this.ispost)
         {
             string @string = FPRequest.GetString("password");
             string string2 = FPRequest.GetString("repeat");
             if (@string != string2)
             {
                 this.ShowErr("两次输入密码不一致。");
             }
             else
             {
                 DbHelper.ExecuteUpdate <UserInfo>(new List <SqlParam>
                 {
                     DbHelper.MakeSet("password", FPUtils.MD5(@string)),
                     DbHelper.MakeSet("authflag", 0),
                     DbHelper.MakeSet("authstr", ""),
                     DbHelper.MakeAndWhere("id", userInfo.id)
                 }.ToArray());
                 base.AddMsg("密码更改成功");
             }
         }
     }
     else
     {
         this.ShowErr("您当前的修改密码链接已无效。");
     }
 }
コード例 #7
0
        public ActionResult CheckLogin(UserLoginModel userinfomodel)
        {
            var password = FPUtils.MD5(userinfomodel.password);
            var userInfo = db.FP_WMS_UserInfo.SingleOrDefault(t => t.username == userinfomodel.username & t.password == password);

            if (userInfo == null)
            {
                return(Json(new { Status = 0, Content = "用户名或者密码错误" }));
            }
            else
            {
                if (userInfo.id > 0)
                {
                    if (userInfo.roleid == 4)
                    {
                        return(Json(new { Status = 0, Content = "对不起,该帐户已被禁止登录" }));
                    }
                    if (userInfo.roleid == 3)
                    {
                        return(Json(new { Status = 0, Content = "对不起,您的账号尚未被激活或者尚未被审核" }));
                    }
                    if (userInfo.state == 0)
                    {
                        return(Json(new { Status = 0, Content = "抱歉, 您的帐号已被禁止使用。" }));
                    }
                    Session.Add("FP_WAPLOGIN", userInfo);
                    //SysBll.InsertLog(userInfo.id, "用户登录", "登录成功,登录名:" + userInfo.username, true);
                    if (userinfomodel.callbackurl == "" || userinfomodel.callbackurl == null)
                    {
                        userinfomodel.callbackurl = HomeUrl;
                    }
                    return(Json(new { Status = 1, Content = "登录成功", backurl = userinfomodel.callbackurl }));
                }
                else
                {
                    //SysBll.InsertLog(userInfo.id, "用户登录", "登录失败,登录名:" + userinfomodel.username + ",密码:" + password, false);
                    return(Json(new { Status = 0, Content = "用户id异常" }));
                }
            }
        }
コード例 #8
0
ファイル: userimport.cs プロジェクト: Run2948/FangPageExam
 // Token: 0x06000084 RID: 132 RVA: 0x0000D2E8 File Offset: 0x0000B4E8
 protected override void View()
 {
     if (this.ispost)
     {
         if (!this.isfile)
         {
             this.ShowErr("请选择要导入的本地Excel表文件");
         }
         else
         {
             string mapPath  = FPUtils.GetMapPath(this.webpath + "cache");
             string fileName = Path.GetFileName(FPRequest.Files["uploadfile"].FileName);
             string a        = Path.GetExtension(fileName).ToLower();
             if (a != ".xls")
             {
                 this.ShowErr("该文件不是Excel表文件类型");
             }
             else
             {
                 if (!Directory.Exists(mapPath))
                 {
                     Directory.CreateDirectory(mapPath);
                 }
                 if (File.Exists(mapPath + "\\" + fileName))
                 {
                     File.Delete(mapPath + "\\" + fileName);
                 }
                 FPRequest.Files["uploadfile"].SaveAs(mapPath + "\\" + fileName);
                 DataTable excelTable = FPExcel.GetExcelTable(mapPath + "\\" + fileName);
                 string    text       = "";
                 string    text2      = "";
                 string    text3      = "";
                 if (excelTable.Rows.Count > 0)
                 {
                     int num = excelTable.Rows.Count - 1;
                     for (int i = 0; i < num; i++)
                     {
                         DataRow dataRow = excelTable.Rows[num - i];
                         string  text4   = dataRow.ItemArray[0].ToString().Trim();
                         if (!(text4 == ""))
                         {
                             SqlParam sqlParam = DbHelper.MakeAndWhere("username", text4);
                             UserInfo userInfo = DbHelper.ExecuteModel <UserInfo>(new SqlParam[]
                             {
                                 sqlParam
                             });
                             if (userInfo.id == 0)
                             {
                                 userInfo.username = text4;
                                 userInfo.realname = dataRow.ItemArray[1].ToString().Trim();
                                 userInfo.password = FPUtils.MD5(dataRow.ItemArray[2].ToString().Trim());
                                 userInfo.roleid   = this.GetRoleId(dataRow.ItemArray[3].ToString().Trim());
                                 userInfo.departid = this.GetDepartId(dataRow.ItemArray[4].ToString().Trim());
                                 userInfo.nickname = dataRow.ItemArray[5].ToString().Trim();
                                 userInfo.id       = DbHelper.ExecuteInsert <UserInfo>(userInfo);
                             }
                             else
                             {
                                 if (!string.IsNullOrEmpty(dataRow.ItemArray[1].ToString().Trim()))
                                 {
                                     userInfo.realname = dataRow.ItemArray[1].ToString().Trim();
                                 }
                                 if (!string.IsNullOrEmpty(dataRow.ItemArray[2].ToString().Trim()))
                                 {
                                     userInfo.password = FPUtils.MD5(dataRow.ItemArray[2].ToString().Trim());
                                 }
                                 if (!string.IsNullOrEmpty(dataRow.ItemArray[3].ToString().Trim()))
                                 {
                                     userInfo.roleid = this.GetRoleId(dataRow.ItemArray[3].ToString().Trim());
                                 }
                                 if (!string.IsNullOrEmpty(dataRow.ItemArray[4].ToString().Trim()))
                                 {
                                     userInfo.departid = this.GetDepartId(dataRow.ItemArray[4].ToString().Trim());
                                 }
                                 if (!string.IsNullOrEmpty(dataRow.ItemArray[5].ToString().Trim()))
                                 {
                                     userInfo.nickname = dataRow.ItemArray[5].ToString().Trim();
                                 }
                                 DbHelper.ExecuteUpdate <UserInfo>(userInfo);
                             }
                             if (text != "")
                             {
                                 text += ",";
                             }
                             text += userInfo.id;
                         }
                     }
                     if (File.Exists(mapPath + "\\" + fileName))
                     {
                         File.Delete(mapPath + "\\" + fileName);
                     }
                     if (text != "")
                     {
                         if (this.examuser != "")
                         {
                             this.examuser += ",";
                         }
                         this.examuser += text;
                     }
                     SqlParam        sqlParam2 = DbHelper.MakeAndWhere("id", WhereType.In, this.examuser);
                     List <UserInfo> list      = DbHelper.ExecuteList <UserInfo>(new SqlParam[]
                     {
                         sqlParam2
                     });
                     foreach (int num2 in FPUtils.SplitInt(this.examuser))
                     {
                         foreach (UserInfo userInfo2 in list)
                         {
                             if (num2 == userInfo2.id && !FPUtils.InArray(num2, text3))
                             {
                                 if (text2 != "")
                                 {
                                     text2 += ",";
                                 }
                                 if (userInfo2.realname != "")
                                 {
                                     text2 += userInfo2.realname;
                                 }
                                 else
                                 {
                                     text2 += userInfo2.username;
                                 }
                                 if (text3 != "")
                                 {
                                     text3 += ",";
                                 }
                                 text3 += num2;
                             }
                         }
                     }
                 }
                 Hashtable hashtable = new Hashtable();
                 hashtable["uname"]    = text2;
                 hashtable["examuser"] = text3;
                 base.Response.AddHeader("Content-Type", "text/html; charset=UTF-8");
                 base.Response.Write(JsonMapper.ToJson(hashtable));
                 base.Response.End();
             }
         }
     }
 }
コード例 #9
0
ファイル: useradd.cs プロジェクト: Run2948/FangPageExam
        // Token: 0x060000B5 RID: 181 RVA: 0x0000DF80 File Offset: 0x0000C180
        protected override void View()
        {
            if (this.id > 0)
            {
                this.fulluserinfo = DbHelper.ExecuteModel <FullUserInfo>(this.id);
            }
            this.bday = FPUtils.SplitString(this.fulluserinfo.bday, ",", 3);
            if (this.ispost)
            {
                this.fulluserinfo.isreal   = 0;
                this.fulluserinfo.isemail  = 0;
                this.fulluserinfo.ismobile = 0;
                string username = this.fulluserinfo.username;
                this.fulluserinfo = FPRequest.GetModel <FullUserInfo>(this.fulluserinfo);
                if (this.fulluserinfo.roleid == 0)
                {
                    this.ShowErr("请选择用户角色。");
                    return;
                }
                if (this.fulluserinfo.username == "")
                {
                    this.ShowErr("请输入用户名。");
                    return;
                }
                string @string = FPRequest.GetString("password1");
                if (this.fulluserinfo.isidcard != 0)
                {
                    this.fulluserinfo.isidcard = ((this.fulluserinfo.isreal == 1) ? 1 : -1);
                }
                if (FPRequest.GetInt("isgrade") == 1)
                {
                    UserGrade userGradeByExpHigher = UserBll.GetUserGradeByExpHigher(this.fulluserinfo.exp);
                    this.fulluserinfo.gradeid = userGradeByExpHigher.id;
                }
                if (this.fulluserinfo.id > 0)
                {
                    if (this.fulluserinfo.username != username)
                    {
                        if (UserBll.CheckUserName(this.fulluserinfo.username))
                        {
                            this.ShowErr("该用户名已经存在,请使用别的用户名。");
                            return;
                        }
                    }
                    if (@string.Trim() != "")
                    {
                        this.fulluserinfo.password = FPUtils.MD5(@string);
                    }
                    DbHelper.ExecuteUpdate <FullUserInfo>(this.fulluserinfo);
                }
                else
                {
                    if (@string.Trim() == "")
                    {
                        this.ShowErr("登录密码不能为空!");
                        return;
                    }
                    if (UserBll.CheckUserName(this.fulluserinfo.username))
                    {
                        this.ShowErr("该用户名已经存在,请使用别的用户名。");
                        return;
                    }
                    this.fulluserinfo.password = FPUtils.MD5(@string);
                    this.fulluserinfo.regip    = FPRequest.GetIP();
                    this.fulluserinfo.lastip   = FPRequest.GetIP();
                    this.fulluserinfo.id       = DbHelper.ExecuteInsert <FullUserInfo>(this.fulluserinfo);
                }
                base.Response.Redirect("usermanage.aspx");
            }
            SqlParam sqlParam = DbHelper.MakeAndWhere("parentid", 0);

            this.deparlist = DbHelper.ExecuteList <Department>(OrderBy.ASC, new SqlParam[]
            {
                sqlParam
            });
            sqlParam      = DbHelper.MakeAndWhere("id", WhereType.NotEqual, 2);
            this.rolelist = DbHelper.ExecuteList <RoleInfo>(OrderBy.ASC, new SqlParam[]
            {
                sqlParam
            });
            this.usergradelist = DbHelper.ExecuteList <UserGrade>(OrderBy.ASC);
            this.typelist      = TypeBll.GetTypeListByMarkup("usertype");
            base.SaveRightURL();
        }
コード例 #10
0
 // Token: 0x0600031F RID: 799 RVA: 0x0000D54C File Offset: 0x0000B74C
 protected override void View()
 {
     if (this.reurl == "")
     {
         this.reurl = "login.aspx";
     }
     this.regconfig = RegConfigs.GetRegConfig();
     if (this.ispost)
     {
         if (this.userid > 0)
         {
             this.ShowErr("对不起,系统不允许重复注册用户。");
         }
         else if (this.regconfig.regstatus != 1)
         {
             this.ShowErr("对不起,系统目前暂不允许新用户注册。");
         }
         else
         {
             if (this.regconfig.regctrl > 0)
             {
                 SqlParam sqlParam = DbHelper.MakeAndWhere("regip", FPRequest.GetIP());
                 UserInfo userInfo = DbHelper.ExecuteModel <UserInfo>(new SqlParam[]
                 {
                     sqlParam
                 });
                 if (userInfo.id > 0)
                 {
                     int num = this.StrDateDiffHours(userInfo.joindatetime, this.regconfig.regctrl);
                     if (num < 0)
                     {
                         this.ShowErr("抱歉,系统设置了IP注册间隔限制,您必须在 " + (num * -1).ToString() + " 小时后才可以重新注册");
                         return;
                     }
                 }
             }
             if (this.regconfig.ipregctrl.Trim() != "")
             {
                 string[] iparray = FPUtils.SplitString(this.regconfig.ipregctrl, "|");
                 if (FPUtils.InIPArray(FPRequest.GetIP(), iparray))
                 {
                     this.ShowErr("抱歉,系统设置了IP注册限制,您所在的IP段不允许注册。");
                     return;
                 }
             }
             string @string = FPRequest.GetString("username");
             string string2 = FPRequest.GetString("password");
             string text    = FPRequest.GetString("email").Trim().ToLower();
             string string3 = FPRequest.GetString("realname");
             string string4 = FPRequest.GetString("idcard");
             string text2   = FPRequest.GetString("mobile").Trim();
             if (@string.Equals(""))
             {
                 this.ShowErr("用户名不能为空。");
             }
             else if (@string.Length < 3)
             {
                 this.ShowErr("对不起,用户名不能小于3个字符");
             }
             else if (@string.Length > 20)
             {
                 this.ShowErr("对不起,用户名不能大于20个字符");
             }
             else if (!FPUtils.IsSafeSqlString(@string))
             {
                 this.ShowErr("对不起,您使用的用户名有敏感字符");
             }
             else if (this.InRestrictArray(@string, this.regconfig.restrict))
             {
                 this.ShowErr("对不起,该用户名:" + @string + " 不允许使用");
             }
             else if (UserBll.CheckUserName(@string))
             {
                 this.ShowErr("该用户名已经存在,请使用别的用户名。");
             }
             else if (string2.Equals(""))
             {
                 this.ShowErr("密码不能为空");
             }
             else if (string2 != FPRequest.GetString("repeat"))
             {
                 this.ShowErr("对不起,两次输入密码不相同");
             }
             else if (this.regconfig.email == 1 && text == "")
             {
                 this.ShowErr("Email不能为空");
             }
             else if (text.Trim() != "" && !FPUtils.IsEmail(text))
             {
                 this.ShowErr("Email格式不正确");
             }
             else
             {
                 if (text.Trim() != "")
                 {
                     if (DbHelper.ExecuteCount <UserInfo>("[email]='" + text + "'") > 0)
                     {
                         this.ShowErr("邮箱: \"" + text + "\" 已经被其他用户使用");
                         return;
                     }
                 }
                 string emailHostName = this.GetEmailHostName(text);
                 if (text.Trim() != "" && this.regconfig.accessemail.Trim() != "")
                 {
                     if (!FPUtils.InArray(emailHostName, this.regconfig.accessemail, "|"))
                     {
                         this.ShowErr("本站点只允许使用以下域名的Email地址注册:" + this.regconfig.accessemail);
                         return;
                     }
                 }
                 else if (text.Trim() != "" && this.regconfig.censoremail.Trim() != "")
                 {
                     if (FPUtils.InArray(text, this.regconfig.censoremail, "|"))
                     {
                         this.ShowErr("本站点不允许使用以下域名的Email地址注册: " + this.regconfig.censoremail);
                         return;
                     }
                 }
                 if (this.regconfig.realname == 1)
                 {
                     if (string3.Equals(""))
                     {
                         this.ShowErr("真实姓名不能为空");
                         return;
                     }
                 }
                 if (this.InRestrictArray(string3, this.regconfig.restrict))
                 {
                     this.ShowErr("对不起,该姓名:[" + string3 + "]不允许使用");
                 }
                 else
                 {
                     if (this.regconfig.mobile == 1)
                     {
                         if (text2.Equals(""))
                         {
                             this.ShowErr("手机号码不能为空");
                             return;
                         }
                     }
                     if (text2.Trim().Length > 20)
                     {
                         this.ShowErr("手机号码不能大于20个字符");
                     }
                     else if (text2.Trim() != "" && !Regex.IsMatch(text2.Trim(), "^[\\d|-]+$"))
                     {
                         this.ShowErr("手机号码中含有非法字符");
                     }
                     else
                     {
                         if (this.regconfig.rules == 1)
                         {
                             if (FPRequest.GetInt("rules", 0) != 1)
                             {
                                 this.ShowErr("对不起,您没有选择同意网站许可协议");
                                 return;
                             }
                         }
                         if (this.isseccode)
                         {
                             if (FPRequest.GetString("verify").Equals(""))
                             {
                                 this.ShowErr("验证码不能为空");
                                 return;
                             }
                             if (!this.isvalid)
                             {
                                 this.ShowErr("验证码错误");
                                 return;
                             }
                         }
                         this.iuser              = FPRequest.GetModel <UserInfo>();
                         this.iuser.password     = FPUtils.MD5(this.iuser.password);
                         this.iuser.credits      = this.regconfig.credit;
                         this.iuser.regip        = FPRequest.GetIP();
                         this.iuser.joindatetime = DbUtils.GetDateTime();
                         if (this.regconfig.regverify == 1)
                         {
                             this.iuser.authstr  = "";
                             this.iuser.authflag = 1;
                             this.iuser.roleid   = 3;
                         }
                         else if (this.regconfig.regverify == 2)
                         {
                             this.iuser.authstr  = WMSUtils.CreateAuthStr(20);
                             this.iuser.authflag = 1;
                             this.iuser.roleid   = 3;
                             string newValue = string.Concat(new string[]
                             {
                                 "<pre style=\"width:100%;word-wrap:break-word\"><a href=\"http://",
                                 this.domain,
                                 this.rawpath,
                                 "activationuser.aspx?authstr=",
                                 this.iuser.authstr,
                                 "\"  target=\"_blank\">http://",
                                 this.domain,
                                 this.rawpath,
                                 "activationuser.aspx?authstr=",
                                 this.iuser.authstr,
                                 "</a></pre>"
                             });
                             MsgTempInfo msgTemplate = MsgTempBll.GetMsgTemplate("email_register");
                             msgTemplate.content = msgTemplate.content.Replace("【用户名】", this.iuser.username).Replace("【邮箱帐号】", this.iuser.email).Replace("【激活链接】", newValue);
                             Email.Send(text, msgTemplate.name, msgTemplate.content);
                         }
                         else
                         {
                             this.iuser.authstr  = "";
                             this.iuser.authflag = 0;
                             this.iuser.roleid   = 5;
                         }
                         this.iuser.id = DbHelper.ExecuteInsert <UserInfo>(this.iuser);
                         if (this.iuser.id > 0)
                         {
                             if (this.regconfig.credit > 0 && this.iuser.credits > 0)
                             {
                                 UserBll.Credit_AddLog(this.iuser.id, "用户注册", 0, this.iuser.credits);
                             }
                             if (this.regconfig.regverify == 1)
                             {
                                 base.AddMsg("注册成功, 但需要等待管理员审核后您的帐户才能生效。");
                             }
                             else if (this.regconfig.regverify == 2)
                             {
                                 base.AddMsg("您的注册邮箱[" + this.iuser.email + "]将收到一封认证邮件,请登录您的邮箱查收,并点击邮件中的链接完成激活。激活成功后,可以使用站内所有功能,再次感谢您的加入。");
                             }
                             else
                             {
                                 base.AddMsg("注册成功, 请点击下面链接返回登录。");
                             }
                         }
                         else
                         {
                             this.ShowErr("注册失败,请检查输入是否正确。");
                         }
                     }
                 }
             }
         }
     }
 }
コード例 #11
0
ファイル: userimport.cs プロジェクト: Run2948/FangPageExam
 // Token: 0x060000BE RID: 190 RVA: 0x0000E7B0 File Offset: 0x0000C9B0
 protected override void View()
 {
     this.regconfig = RegConfigs.GetRegConfig();
     if (this.ispost)
     {
         if (!this.isfile)
         {
             this.ShowErr("请选择要导入的本地Excel表文件");
         }
         else
         {
             string mapPath  = FPUtils.GetMapPath(this.webpath + "cache");
             string fileName = Path.GetFileName(FPRequest.Files["uploadfile"].FileName);
             string a        = Path.GetExtension(fileName).ToLower();
             if (a != ".xls")
             {
                 this.ShowErr("该文件不是Excel表文件类型");
             }
             else
             {
                 if (!Directory.Exists(mapPath))
                 {
                     Directory.CreateDirectory(mapPath);
                 }
                 if (File.Exists(mapPath + "\\" + fileName))
                 {
                     File.Delete(mapPath + "\\" + fileName);
                 }
                 FPRequest.Files["uploadfile"].SaveAs(mapPath + "\\" + fileName);
                 DataTable excelTable = FPExcel.GetExcelTable(mapPath + "\\" + fileName);
                 if (excelTable.Rows.Count > 0)
                 {
                     int num = excelTable.Rows.Count - 1;
                     for (int i = 0; i < excelTable.Rows.Count; i++)
                     {
                         DataRow dataRow = excelTable.Rows[num - i];
                         string  text    = dataRow.ItemArray[0].ToString().Trim();
                         if (!(text == ""))
                         {
                             if (!this.InRestrictArray(text, this.regconfig.restrict))
                             {
                                 if (!UserBll.CheckUserName(text))
                                 {
                                     DbHelper.ExecuteInsert <UserInfo>(new UserInfo
                                     {
                                         username = text,
                                         password = FPUtils.MD5(dataRow.ItemArray[1].ToString().Trim()),
                                         realname = dataRow.ItemArray[2].ToString().Trim(),
                                         mobile   = dataRow.ItemArray[3].ToString().Trim(),
                                         email    = dataRow.ItemArray[4].ToString().Trim(),
                                         roleid   = this.GetRoleId(dataRow.ItemArray[5].ToString().Trim()),
                                         departid = this.GetDepartId(dataRow.ItemArray[6].ToString().Trim())
                                     });
                                 }
                             }
                         }
                     }
                 }
                 if (File.Exists(mapPath + "\\" + fileName))
                 {
                     File.Delete(mapPath + "\\" + fileName);
                 }
                 base.Response.Redirect("usermanage.aspx");
             }
         }
     }
 }