Esempio n. 1
0
        // Token: 0x060002ED RID: 749 RVA: 0x0000B648 File Offset: 0x00009848
        public static UserInfo GetOnlineUser(string passwordkey, int timeout, int uid)
        {
            UserInfo userInfo = new UserInfo();
            int      num      = FPUtils.StrToInt(WMSCookie.GetCookie("userid"), uid);
            string   text     = DES.Decode(WMSCookie.GetCookie("password"), passwordkey).Trim();

            if (text.Length == 0)
            {
                num = 0;
            }
            if (num > 0)
            {
                DateTime lastCookieTime = WMSCookie.GetLastCookieTime();
                DateTime t = DateTime.Now.AddMinutes((double)(timeout * -1));
                if (lastCookieTime >= t)
                {
                    UserInfo userInfo2 = UserBll.CheckPassword(num, text, false);
                    if (userInfo2.id > 0)
                    {
                        return(userInfo2);
                    }
                }
                WMSCookie.ClearUserCookie();
            }
            return(UserBll.CreateGuestUser());
        }
Esempio n. 2
0
        // Token: 0x0600003C RID: 60 RVA: 0x00003DA0 File Offset: 0x00001FA0
        public static void WriteCookie(string strName, string strValue)
        {
            HttpCookie httpCookie = HttpContext.Current.Request.Cookies["wms"];

            if (httpCookie == null)
            {
                httpCookie = new HttpCookie("wms");
                httpCookie.Values[strName] = FPUtils.UrlEncode(strValue);
            }
            else
            {
                httpCookie.Values[strName] = FPUtils.UrlEncode(strValue);
                if (HttpContext.Current.Request.Cookies["wms"]["expires"] != null)
                {
                    int num = FPUtils.StrToInt(HttpContext.Current.Request.Cookies["wms"]["expires"].ToString(), 0);
                    if (num > 0)
                    {
                        httpCookie.Expires = DateTime.Now.AddMinutes((double)FPUtils.StrToInt(HttpContext.Current.Request.Cookies["wms"]["expires"].ToString(), 0));
                    }
                }
            }
            string text = SysConfigs.GetConfig().cookiedomain.Trim();

            if (text != string.Empty && HttpContext.Current.Request.Url.Host.IndexOf(text.TrimStart(new char[]
            {
                '.'
            })) > -1 && WMSUtils.IsValidDomain(HttpContext.Current.Request.Url.Host))
            {
                httpCookie.Domain = text;
            }
            HttpContext.Current.Response.AppendCookie(httpCookie);
        }
Esempio n. 3
0
        // Token: 0x06000088 RID: 136 RVA: 0x0000BCCC File Offset: 0x00009ECC
        protected override void View()
        {
            SqlParam     sqlParam = DbHelper.MakeAndWhere("parentid", 0);
            OrderByParam orderby  = DbHelper.MakeOrderBy("display", OrderBy.ASC);

            this.menulist = DbHelper.ExecuteList <MenuInfo>(orderby, new SqlParam[]
            {
                sqlParam
            });
            if (this.Session["FP_ADMIN_TOPMENU"] != null)
            {
                this.topmenuid = FPUtils.StrToInt(this.Session["FP_ADMIN_TOPMENU"].ToString(), 0);
            }
            if (this.topmenuid == 0)
            {
                if (this.roleid == 1)
                {
                    this.topmenuid = 1;
                }
                else if (this.role.menus != "")
                {
                    this.topmenuid = FPUtils.SplitInt(this.role.menus)[0];
                }
            }
        }
Esempio n. 4
0
 // Token: 0x060000C2 RID: 194 RVA: 0x000130BC File Offset: 0x000112BC
 protected override void View()
 {
     this.examresult = DbHelper.ExecuteModel <ExamResult>(this.resultid);
     if (this.examresult.id == 0)
     {
         this.ShowErr("该考生的试卷不存在或已被删除。");
     }
     else if (this.examresult.status == 0)
     {
         this.ShowErr("对不起,该考试尚未完成。");
     }
     else
     {
         this.examresult.passmark = this.examresult.passmark * this.examresult.total / 100.0;
         string commandText = string.Format("SELECT MAX([score]) AS [maxscore] FROM [{0}Exam_ExamResult] WHERE [examid]={1} AND [status]>0", DbConfigs.Prefix, this.examresult.examid);
         this.maxscore = Math.Round((double)FPUtils.StrToFloat(DbHelper.ExecuteScalar(commandText).ToString(), 0f), 1);
         commandText   = string.Format("SELECT AVG([score]) AS [avgscore] FROM [{0}Exam_ExamResult] WHERE [examid]={1} AND [status]>0", DbConfigs.Prefix, this.examresult.examid);
         this.avgscore = Math.Round((double)FPUtils.StrToFloat(DbHelper.ExecuteScalar(commandText).ToString(), 0f));
         SqlParam[] sqlparams = new SqlParam[]
         {
             DbHelper.MakeAndWhere("examid", this.examresult.examid),
             DbHelper.MakeAndWhere("status", WhereType.GreaterThan, 0)
         };
         this.testers = DbHelper.ExecuteCount <ExamResult>(sqlparams);
         commandText  = string.Format("SELECT COUNT(*) FROM [{0}Exam_ExamResult] WHERE [examid]={1} AND [score]>{2} AND [status]>0", DbConfigs.Prefix, this.examresult.examid, this.examresult.score);
         if (this.examresult.score > 0.0)
         {
             this.display = FPUtils.StrToInt(DbHelper.ExecuteScalar(commandText).ToString(), 0) + 1;
         }
         SqlParam     sqlParam = DbHelper.MakeAndWhere("resultid", this.resultid);
         OrderByParam orderby  = DbHelper.MakeOrderBy("display", OrderBy.ASC);
         this.examtopiclist = DbHelper.ExecuteList <ExamResultTopic>(orderby, new SqlParam[]
         {
             sqlParam
         });
         int num  = Convert.ToInt32(this.examresult.total) / 5;
         int num2 = num / 2;
         if (num % 2 != 0)
         {
             num2++;
         }
         for (int i = 1; i < 10; i++)
         {
             if (i % 2 == 0)
             {
                 this.bcklist.Add(i / 2 * num);
             }
             else
             {
                 this.bcklist.Add(i * num2);
             }
         }
     }
 }
Esempio n. 5
0
        // Token: 0x060000C0 RID: 192 RVA: 0x00012FBC File Offset: 0x000111BC
        private ExamLogInfo GetExamLogInfo(string sqlstring)
        {
            IDataReader dataReader  = DbHelper.ExecuteReader(CommandType.Text, sqlstring);
            ExamLogInfo examLogInfo = new ExamLogInfo();

            if (dataReader.Read())
            {
                examLogInfo.answers = FPUtils.StrToInt(dataReader["answers"]);
                examLogInfo.wrongs  = FPUtils.StrToInt(dataReader["wrongs"]);
            }
            dataReader.Close();
            return(examLogInfo);
        }
Esempio n. 6
0
 // Token: 0x060000CE RID: 206 RVA: 0x0001462C File Offset: 0x0001282C
 protected override void View()
 {
     this.channelinfo = ChannelBll.GetChannelInfo("exam_question");
     if (this.channelinfo.id == 0)
     {
         this.ShowErr("对不起,目前系统尚未创建题目库频道。");
     }
     else
     {
         string commandText = string.Format("SELECT SUM([curfavs]) AS [total] FROM [{0}Exam_ExamLogInfo] WHERE [channelid]={1} AND [uid]={2}", DbConfigs.Prefix, this.channelinfo.id, this.userid);
         this.total       = FPUtils.StrToInt(DbHelper.ExecuteScalar(commandText));
         this.userexamlog = ExamBll.GetExamLogList(this.channelinfo.id, this.userid);
         List <SortAppInfo> sortAppList = SortBll.GetSortAppList("exam_");
         foreach (SortAppInfo sortAppInfo in sortAppList)
         {
             if (this.sortappidlist != "")
             {
                 this.sortappidlist += ",";
             }
             this.sortappidlist += sortAppInfo.id;
         }
         SqlParam[] sqlparams = new SqlParam[]
         {
             DbHelper.MakeAndWhere("parentid", 0),
             DbHelper.MakeAndWhere("channelid", this.channelinfo.id),
             DbHelper.MakeAndWhere("appid", WhereType.In, this.sortappidlist),
             DbHelper.MakeAndWhere("hidden", 0)
         };
         OrderByParam    orderby = DbHelper.MakeOrderBy("display", OrderBy.ASC);
         List <SortInfo> list    = DbHelper.ExecuteList <SortInfo>(orderby, sqlparams);
         foreach (SortInfo sortInfo in list)
         {
             ExamLogInfo examLogInfo;
             if (this.userexamlog.ContainsKey(sortInfo.id))
             {
                 examLogInfo = this.userexamlog[sortInfo.id];
             }
             else
             {
                 examLogInfo = new ExamLogInfo();
             }
             examLogInfo.sortid    = sortInfo.id;
             examLogInfo.sortname  = sortInfo.name;
             examLogInfo.questions = sortInfo.posts;
             examLogInfo.subcounts = sortInfo.subcounts;
             this.examloglist.Add(examLogInfo);
         }
     }
 }
Esempio n. 7
0
        // Token: 0x0600007B RID: 123 RVA: 0x0000B078 File Offset: 0x00009278
        protected override void View()
        {
            this.link = "typemanage.aspx";
            if (this.id > 0)
            {
                this.typeinfo = DbHelper.ExecuteModel <TypeInfo>(this.id);
                this.parentid = this.typeinfo.parentid;
            }
            if (this.ispost)
            {
                this.typeinfo = FPRequest.GetModel <TypeInfo>(this.typeinfo);
                if (this.typeinfo.id > 0)
                {
                    if (DbHelper.ExecuteUpdate <TypeInfo>(this.typeinfo) > 0)
                    {
                        StringBuilder stringBuilder = new StringBuilder();
                        if (this.typeinfo.parentid != this.parentid)
                        {
                            stringBuilder.AppendFormat("UPDATE [{0}WMS_TypeInfo] SET [subcounts]=[subcounts]-1 WHERE [id]={1};", DbConfigs.Prefix, this.parentid);
                            stringBuilder.AppendFormat("UPDATE [{0}WMS_TypeInfo] SET [subcounts]=[subcounts]+1 WHERE [id]={1};", DbConfigs.Prefix, this.typeinfo.parentid);
                            stringBuilder.AppendFormat("UPDATE [{0}WMS_TypeInfo] SET [subcounts]=0 WHERE [subcounts]<0", DbConfigs.Prefix);
                            DbHelper.ExecuteSql(stringBuilder.ToString());
                        }
                    }
                    base.AddMsg("更新分类成功!");
                }
                else
                {
                    this.typeinfo.display = FPUtils.StrToInt(DbHelper.ExecuteMax <TypeInfo>("display").ToString()) + 1;
                    if (DbHelper.ExecuteInsert <TypeInfo>(this.typeinfo) > 0)
                    {
                        string sqlstring = string.Format("UPDATE [{0}WMS_TypeInfo] SET [subcounts]=[subcounts]+1 WHERE [id]={1}", DbConfigs.Prefix, this.typeinfo.parentid);
                        DbHelper.ExecuteSql(sqlstring);
                    }
                    base.AddMsg("添加分类成功!");
                }
                CacheBll.RemoveSortCache();
            }
            SqlParam[] sqlparams = new SqlParam[]
            {
                DbHelper.MakeAndWhere("id", WhereType.NotEqual, this.id),
                DbHelper.MakeAndWhere("parentid", 0)
            };
            OrderByParam orderby = DbHelper.MakeOrderBy("display", OrderBy.ASC);

            this.parenttypelist = DbHelper.ExecuteList <TypeInfo>(orderby, sqlparams);
            base.SaveRightURL();
        }
Esempio n. 8
0
        // Token: 0x060002D8 RID: 728 RVA: 0x0000AE88 File Offset: 0x00009088
        private void EditorFile()
        {
            HttpPostedFile httpPostedFile = FPRequest.Files["imgfile"];

            if (httpPostedFile == null)
            {
                this.ShowErrMsg("请选择要上传文件!");
            }
            else
            {
                UpLoad   upLoad   = new UpLoad();
                string   json     = upLoad.FileSaveAs(httpPostedFile, this.dir, this.user);
                JsonData jsonData = JsonMapper.ToObject(json);
                string   text     = jsonData["error"].ToString();
                if (text != "")
                {
                    this.ShowErrMsg(text);
                }
                else
                {
                    AttachInfo attachInfo = new AttachInfo();
                    attachInfo.uid          = this.userid;
                    attachInfo.sortid       = this.sortid;
                    attachInfo.filename     = jsonData["filename"].ToString();
                    attachInfo.filesize     = (long)FPUtils.StrToInt(jsonData["filesize"].ToString(), 0);
                    attachInfo.originalname = jsonData["originalname"].ToString();
                    attachInfo.postdatetime = DbUtils.GetDateTime();
                    attachInfo.filetype     = this.dir;
                    if (DbHelper.ExecuteInsert <AttachInfo>(attachInfo) == 0)
                    {
                        this.ShowErrMsg("数据库更新失败。");
                    }
                    else
                    {
                        Hashtable hashtable = new Hashtable();
                        hashtable["error"] = 0;
                        hashtable["url"]   = attachInfo.filename;
                        hashtable["title"] = attachInfo.originalname;
                        base.Response.AddHeader("Content-Type", "text/html; charset=UTF-8");
                        base.Response.Write(JsonMapper.ToJson(hashtable));
                        base.Response.End();
                    }
                }
            }
        }
Esempio n. 9
0
 // Token: 0x0600005A RID: 90 RVA: 0x0000820C File Offset: 0x0000640C
 protected override void View()
 {
     if (this.id > 0)
     {
         this.channelinfo = DbHelper.ExecuteModel <ChannelInfo>(this.id);
     }
     else
     {
         this.channelinfo.display = FPUtils.StrToInt(DbHelper.ExecuteMax <ChannelInfo>("display").ToString()) + 1;
     }
     if (this.ispost)
     {
         this.link        = "channelmanage.aspx";
         this.channelinfo = FPRequest.GetModel <ChannelInfo>(this.channelinfo);
         if (this.channelinfo.id > 0)
         {
             DbHelper.ExecuteUpdate <ChannelInfo>(this.channelinfo);
             base.AddMsg("更新频道成功!");
         }
         else
         {
             this.channelinfo.id = DbHelper.ExecuteInsert <ChannelInfo>(this.channelinfo);
             if (this.channelinfo.id > 0 && FPRequest.GetInt("ismenu") == 1)
             {
                 MenuInfo menuInfo = new MenuInfo();
                 menuInfo.name = this.channelinfo.name;
                 SqlParam sqlParam = DbHelper.MakeAndWhere("parentid", menuInfo.parentid);
                 menuInfo.display = DbHelper.ExecuteCount <MenuInfo>(new SqlParam[]
                 {
                     sqlParam
                 }) + 1;
                 menuInfo.lefturl = "sorttree.aspx?channelid=" + this.channelinfo.id;
                 menuInfo.id      = DbHelper.ExecuteInsert <MenuInfo>(menuInfo);
                 RoleInfo roleInfo  = RoleBll.GetRoleInfo(1);
                 RoleInfo roleInfo2 = roleInfo;
                 roleInfo2.menus += ((roleInfo.menus == "") ? menuInfo.id.ToString() : ("," + menuInfo.id));
                 DbHelper.ExecuteUpdate <RoleInfo>(roleInfo);
             }
             base.AddMsg("添加频道成功!");
         }
     }
     base.SaveRightURL();
 }
Esempio n. 10
0
        // Token: 0x060002FB RID: 763 RVA: 0x0000BAD8 File Offset: 0x00009CD8
        public static UserGrade GetUserGradeByExpHigher(int expHigher)
        {
            if (expHigher < 0)
            {
                expHigher = 0;
            }
            List <SqlParam> list = new List <SqlParam>();

            list.Add(DbHelper.MakeAndWhere("explower", WhereType.LessThanEqual, expHigher));
            int num = FPUtils.StrToInt(DbHelper.ExecuteMax <UserGrade>("expupper"));

            if (expHigher >= num)
            {
                list.Add(DbHelper.MakeAndWhere("expupper", num));
            }
            else
            {
                list.Add(DbHelper.MakeAndWhere("expupper", WhereType.GreaterThan, expHigher));
            }
            return(DbHelper.ExecuteModel <UserGrade>(list.ToArray()));
        }
Esempio n. 11
0
        // Token: 0x060002F5 RID: 757 RVA: 0x0000B958 File Offset: 0x00009B58
        public static void UpdateUserExp(int uid, int exp)
        {
            UserInfo userInfo = UserBll.GetUserInfo(uid);

            userInfo.exp += exp;
            int num = FPUtils.StrToInt(DbHelper.ExecuteMax <UserGrade>("expupper"));

            if (userInfo.exp > num)
            {
                userInfo.exp = num;
            }
            UserGrade userGradeByExpHigher = UserBll.GetUserGradeByExpHigher(userInfo.exp);
            string    sqlstring            = string.Format("UPDATE [{0}WMS_UserInfo] SET [gradeid]={1},[exp]=[exp]+{2} WHERE [id]={3}", new object[]
            {
                DbConfigs.Prefix,
                userGradeByExpHigher.id,
                exp,
                uid
            });

            DbHelper.ExecuteSql(sqlstring);
        }
Esempio n. 12
0
        // Token: 0x06000025 RID: 37 RVA: 0x00003AE0 File Offset: 0x00001CE0
        public static ExpInfo GetExamExpByScore(double score, int examid)
        {
            if (score < 0.0)
            {
                score = 0.0;
            }
            List <SqlParam> list = new List <SqlParam>();

            list.Add(DbHelper.MakeAndWhere("examid", examid));
            list.Add(DbHelper.MakeAndWhere("scorelower", WhereType.LessThanEqual, score));
            int num = FPUtils.StrToInt(DbHelper.ExecuteMax <ExpInfo>("scoreupper"));

            if (score >= (double)num)
            {
                list.Add(DbHelper.MakeAndWhere("scoreupper", num));
            }
            else
            {
                list.Add(DbHelper.MakeAndWhere("scoreupper", WhereType.GreaterThan, score));
            }
            return(DbHelper.ExecuteModel <ExpInfo>(list.ToArray()));
        }
Esempio n. 13
0
 // Token: 0x060000B2 RID: 178 RVA: 0x000117F4 File Offset: 0x0000F9F4
 protected override void View()
 {
     if (!this.isperm)
     {
         this.ShowErr("对不起,您没有权限阅卷。");
     }
     else
     {
         this.examresult = DbHelper.ExecuteModel <ExamResult>(this.resultid);
         if (this.examresult.id == 0)
         {
             this.ShowErr("该考生的试卷不存在或已被删除。");
         }
         else
         {
             this.examloglist = ExamBll.GetExamLogList(this.examresult.channelid, this.userid);
             string commandText = string.Format("SELECT MAX([score]) AS [maxscore] FROM [{0}Exam_ExamResult] WHERE [id]={1}", DbConfigs.Prefix, this.resultid);
             this.maxscore = Math.Round((double)FPUtils.StrToFloat(DbHelper.ExecuteScalar(commandText).ToString(), 0f), 1);
             if (this.maxscore > this.examresult.total)
             {
                 this.maxscore = this.examresult.total;
             }
             commandText   = string.Format("SELECT AVG([score]) AS [avgscore] FROM [{0}Exam_ExamResult] WHERE [id]={1}", DbConfigs.Prefix, this.resultid);
             this.avgscore = Math.Round((double)FPUtils.StrToFloat(DbHelper.ExecuteScalar(commandText).ToString(), 0f), 1);
             SqlParam sqlParam = DbHelper.MakeAndWhere("examid", this.examresult.examid);
             this.testers = DbHelper.ExecuteCount <ExamResult>(new SqlParam[]
             {
                 sqlParam
             });
             commandText = string.Format("SELECT COUNT(*) FROM [{0}Exam_ExamResult] WHERE [examid]={1} AND [score]>{2}", DbConfigs.Prefix, this.examresult.examid, this.examresult.score);
             if (this.examresult.score > 0.0)
             {
                 this.display = FPUtils.StrToInt(DbHelper.ExecuteScalar(commandText).ToString(), 0) + 1;
             }
             this.examtopicresultlist = ExamBll.GetExamResultTopicList(this.resultid);
         }
     }
 }
Esempio n. 14
0
 // Token: 0x0600004C RID: 76 RVA: 0x000080D4 File Offset: 0x000062D4
 protected override void View()
 {
     this.examconfig = ExamConifgs.GetExamConfig();
     this.examinfo   = DbHelper.ExecuteModel <ExamInfo>(this.examid);
     if (this.examinfo.id == 0)
     {
         this.ShowErr("对不起,该试卷不存在或已被删除。");
     }
     else
     {
         this.sortid   = this.examinfo.sortid;
         this.sortinfo = SortBll.GetSortInfo(this.sortid);
         if (this.ispost)
         {
             string    @string   = FPRequest.GetString("action");
             int       @int      = FPRequest.GetInt("examtopicid");
             int       int2      = FPRequest.GetInt("tid");
             ExamTopic examTopic = DbHelper.ExecuteModel <ExamTopic>(@int);
             if (@string == "delete")
             {
                 DbHelper.ExecuteDelete <ExamTopic>(@int);
                 if (this.paper == 1)
                 {
                     StringBuilder stringBuilder = new StringBuilder();
                     stringBuilder.AppendFormat("UPDATE [{0}Exam_ExamInfo] SET [total]=[total]-{1},[questions]=[questions]-{2} WHERE [id]={3}", new object[]
                     {
                         DbConfigs.Prefix,
                         examTopic.perscore * (double)examTopic.questions,
                         examTopic.questions,
                         this.examid
                     });
                     DbHelper.ExecuteSql(stringBuilder.ToString());
                 }
             }
             else if (@string == "addpaper")
             {
                 if (this.examinfo.papers == 4)
                 {
                     this.ShowErr("对不起,一场考试最多只能添加4份试卷。");
                     return;
                 }
                 string text = string.Format("UPDATE [{0}Exam_ExamInfo] SET [papers]=[papers]+1 WHERE [id]={1}", DbConfigs.Prefix, this.examid);
                 DbHelper.ExecuteSql(text);
                 this.paper = this.examinfo.papers + 1;
             }
             else if (@string == "delpaper")
             {
                 if (this.examinfo.papers == 1)
                 {
                     this.ShowErr("对不起,一场考试必须有一份试卷。");
                     return;
                 }
                 StringBuilder stringBuilder = new StringBuilder();
                 stringBuilder.AppendFormat("UPDATE [{0}Exam_ExamInfo] SET [papers]=[papers]-1 WHERE [id]={1}", DbConfigs.Prefix, this.examid);
                 stringBuilder.AppendFormat("DELETE FROM [{0}Exam_ExamTopic] WHERE [examid]={1} AND [paper]={2}", DbConfigs.Prefix, this.examid, this.paper);
                 stringBuilder.AppendFormat("UPDATE [{0}Exam_ExamTopic] SET [paper]=[paper]-1 WHERE [examid]={1} AND [paper]>{2}", DbConfigs.Prefix, this.examid, this.paper);
                 DbHelper.ExecuteSql(stringBuilder.ToString());
                 this.examinfo.papers = this.examinfo.papers - 1;
                 if (this.paper > this.examinfo.papers)
                 {
                     this.paper = this.examinfo.papers;
                 }
                 List <ExamTopic> examTopicList = ExamBll.GetExamTopicList(this.examid, 1);
                 double           num           = 0.0;
                 int num2 = 0;
                 foreach (ExamTopic examTopic2 in examTopicList)
                 {
                     num  += examTopic2.perscore * (double)examTopic2.questions;
                     num2 += examTopic2.questions;
                 }
                 string sqlstring = string.Format("UPDATE [{0}Exam_ExamInfo] SET [questions]={1},[total]={2} WHERE [id]={3}", new object[]
                 {
                     DbConfigs.Prefix,
                     num2,
                     num,
                     this.examid
                 });
                 DbHelper.ExecuteSql(sqlstring);
             }
             else if (@string == "saveas")
             {
                 if (this.examinfo.papers == 4)
                 {
                     this.ShowErr("对不起,一场考试最多只能添加4份试卷。");
                     return;
                 }
                 string text = string.Format("UPDATE [{0}Exam_ExamInfo] SET [papers]=[papers]+1 WHERE [id]={1}", DbConfigs.Prefix, this.examid);
                 DbHelper.ExecuteSql(text);
                 this.examtopiclist   = ExamBll.GetExamTopicList(this.examid, this.paper);
                 this.examinfo.papers = this.examinfo.papers + 1;
                 for (int i = 0; i < this.examtopiclist.Count; i++)
                 {
                     this.examtopiclist[i].paper = this.examinfo.papers;
                     DbHelper.ExecuteInsert <ExamTopic>(this.examtopiclist[i]);
                 }
             }
             else if (@string == "deletetopic")
             {
                 string text2 = "";
                 foreach (int num3 in FPUtils.SplitInt(examTopic.questionlist))
                 {
                     if (int2 != num3 && num3 > 0)
                     {
                         if (text2 != "")
                         {
                             text2 += ",";
                         }
                         text2 += num3;
                     }
                 }
                 examTopic.questionlist = text2;
                 if (examTopic.questionlist.Length > 0)
                 {
                     examTopic.curquestions = FPUtils.SplitInt(examTopic.questionlist).Length;
                 }
                 else
                 {
                     examTopic.curquestions = 0;
                 }
                 SqlParam[] sqlparams = new SqlParam[]
                 {
                     DbHelper.MakeSet("questionlist", examTopic.questionlist),
                     DbHelper.MakeSet("curquestions", examTopic.curquestions),
                     DbHelper.MakeAndWhere("id", @int)
                 };
                 DbHelper.ExecuteUpdate <ExamTopic>(sqlparams);
             }
             else if (@string == "display")
             {
                 this.examtopiclist = ExamBll.GetExamTopicList(this.examid, this.paper);
                 string text = "";
                 foreach (ExamTopic examTopic3 in this.examtopiclist)
                 {
                     DataTable dataTable = new DataTable();
                     dataTable.Columns.Add("display", typeof(int));
                     dataTable.Columns.Add("qid", typeof(int));
                     foreach (int num4 in FPUtils.SplitInt(examTopic3.questionlist))
                     {
                         DataRow dataRow = dataTable.NewRow();
                         dataRow["display"] = FPRequest.GetInt("display_" + num4);
                         dataRow["qid"]     = num4;
                         dataTable.Rows.Add(dataRow);
                     }
                     string text3 = "";
                     foreach (DataRow dataRow2 in dataTable.Select("1=1", "display asc"))
                     {
                         if (text3 != "")
                         {
                             text3 += ",";
                         }
                         text3 += dataRow2["qid"].ToString();
                     }
                     if (text != "")
                     {
                         text += "|";
                     }
                     text += string.Format("UPDATE [{0}Exam_ExamTopic] SET [questionlist]='{1}' WHERE [id]={2}", DbConfigs.Prefix, text3, examTopic3.id);
                 }
                 DbHelper.ExecuteSql(text);
             }
             base.Response.Redirect(this.pagename + string.Format("?examid={0}&paper={1}&examtopicid={2}", this.examid, this.paper, @int));
         }
         this.examtopiclist = ExamBll.GetExamTopicList(this.examid, this.paper);
         SqlParam[] sqlparams2 = new SqlParam[]
         {
             DbHelper.MakeAndWhere("examid", this.examid),
             DbHelper.MakeAndWhere("paper", this.paper)
         };
         this.examinfo.questions = FPUtils.StrToInt(DbHelper.ExecuteSum <ExamTopic>("questions", sqlparams2));
         base.SaveRightURL();
     }
 }
Esempio n. 15
0
        // Token: 0x0600006D RID: 109 RVA: 0x00009C14 File Offset: 0x00007E14
        protected override void View()
        {
            if (this.id > 0)
            {
                this.sortinfo  = DbHelper.ExecuteModel <SortInfo>(this.id);
                this.parentid  = this.sortinfo.parentid;
                this.channelid = this.sortinfo.channelid;
                this.appid     = this.sortinfo.appid;
            }
            else
            {
                SortInfo sortInfo = SortBll.GetSortInfo(this.parentid);
                this.appid = sortInfo.appid;
            }
            if (this.ispost)
            {
                this.sortinfo.hidden = 0;
                this.sortinfo.types  = "";
                this.sortinfo        = FPRequest.GetModel <SortInfo>(this.sortinfo);
                if (this.sortinfo.channelid == 0)
                {
                    this.ShowErr("请选择栏目频道。");
                    return;
                }
                if (this.sortinfo.name == "")
                {
                    this.ShowErr("栏目名称不能为空。");
                    return;
                }
                if (this.isfile)
                {
                    HttpPostedFile postedFile = FPRequest.Files["uploadimg"];
                    UpLoad         upLoad     = new UpLoad();
                    string         json       = upLoad.FileSaveAs(postedFile, "image", this.user, false, false, 16, 16);
                    JsonData       jsonData   = JsonMapper.ToObject(json);
                    if (jsonData["error"].ToString() == "")
                    {
                        if (this.sortinfo.icon != "")
                        {
                            if (File.Exists(FPUtils.GetMapPath(this.sortinfo.icon)))
                            {
                                File.Delete(FPUtils.GetMapPath(this.sortinfo.icon));
                            }
                        }
                        this.sortinfo.icon = jsonData["filename"].ToString();
                    }
                }
                string   text      = "0";
                SortInfo sortInfo2 = new SortInfo();
                if (this.sortinfo.id > 0)
                {
                    if (DbHelper.ExecuteUpdate <SortInfo>(this.sortinfo) > 0)
                    {
                        if (this.sortinfo.parentid != this.parentid)
                        {
                            text = this.sortinfo.parentlist;
                            if (this.sortinfo.parentid > 0)
                            {
                                sortInfo2 = DbHelper.ExecuteModel <SortInfo>(this.sortinfo.parentid);
                                this.sortinfo.parentlist = sortInfo2.parentlist + "," + this.sortinfo.id;
                            }
                            else
                            {
                                this.sortinfo.parentlist = "0," + this.sortinfo.id.ToString();
                            }
                            StringBuilder stringBuilder = new StringBuilder();
                            stringBuilder.AppendFormat("UPDATE [{0}WMS_SortInfo] SET [parentlist]='{1}' WHERE [id]={2}|", DbConfigs.Prefix, this.sortinfo.parentlist, this.sortinfo.id);
                            if (DbConfigs.DbType == DbType.Access)
                            {
                                stringBuilder.AppendFormat("UPDATE [{0}WMS_SortInfo] SET [parentlist] =REPLACE([parentlist], '{1}', '{2}', 1, 1) WHERE [id] IN (SELECT [id] FROM [{0}WMS_SortInfo]  WHERE [parentlist] LIKE '{3},%')|", new object[]
                                {
                                    DbConfigs.Prefix,
                                    text,
                                    this.sortinfo.parentlist,
                                    text
                                });
                            }
                            else
                            {
                                stringBuilder.AppendFormat("UPDATE [{0}WMS_SortInfo] SET [parentlist] =STUFF([parentlist],1,{1},'{2}') WHERE [id] IN (SELECT [id] FROM [{0}WMS_SortInfo]  WHERE [parentlist] LIKE '{3},%')|", new object[]
                                {
                                    DbConfigs.Prefix,
                                    text.Length,
                                    this.sortinfo.parentlist,
                                    text
                                });
                            }
                            stringBuilder.AppendFormat("UPDATE [{0}WMS_SortInfo] SET [subcounts]=[subcounts]-1 WHERE [id]={1}|", DbConfigs.Prefix, this.parentid);
                            stringBuilder.AppendFormat("UPDATE [{0}WMS_SortInfo] SET [subcounts]=[subcounts]+1 WHERE [id]={1}", DbConfigs.Prefix, this.sortinfo.parentid);
                            DbHelper.ExecuteSql(stringBuilder.ToString());
                        }
                        if (this.sortinfo.channelid != this.channelid && this.parentid == 0)
                        {
                            string sqlstring = string.Format("UPDATE [{0}WMS_SortInfo] SET [channelid]={1} WHERE [id] IN (SELECT [id] FROM [{0}WMS_SortInfo]  WHERE [parentlist] LIKE '{2},%')", DbConfigs.Prefix, this.sortinfo.channelid, this.sortinfo.parentlist);
                            DbHelper.ExecuteSql(sqlstring);
                        }
                    }
                    base.AddMsg("更新栏目成功!");
                }
                else
                {
                    SqlParam[] sqlparams = new SqlParam[]
                    {
                        DbHelper.MakeAndWhere("parentid", this.parentid),
                        DbHelper.MakeAndWhere("channelid", this.channelid)
                    };
                    this.sortinfo.display = FPUtils.StrToInt(DbHelper.ExecuteMax <SortInfo>("display", sqlparams).ToString()) + 1;
                    this.id = DbHelper.ExecuteInsert <SortInfo>(this.sortinfo);
                    if (this.id > 0)
                    {
                        if (this.sortinfo.parentid > 0)
                        {
                            sortInfo2 = DbHelper.ExecuteModel <SortInfo>(this.sortinfo.parentid);
                            text      = sortInfo2.parentlist + "," + this.id;
                        }
                        else
                        {
                            text = text + "," + this.id;
                        }
                        StringBuilder stringBuilder = new StringBuilder();
                        stringBuilder.AppendFormat("UPDATE [{0}WMS_SortInfo] SET [parentlist]='{1}' WHERE [id]={2}|", DbConfigs.Prefix, text, this.id);
                        stringBuilder.AppendFormat("UPDATE [{0}WMS_SortInfo] SET [subcounts]=[subcounts]+1 WHERE [id]={1}", DbConfigs.Prefix, this.sortinfo.parentid);
                        DbHelper.ExecuteSql(stringBuilder.ToString());
                    }
                    base.AddMsg("添加栏目成功!");
                }
                FPCache.Remove("FP_SORTTREE" + this.sortinfo.channelid);
                this.link = "sortmanage.aspx?channelid=" + this.sortinfo.channelid;
            }
            SqlParam[] sqlparams2 = new SqlParam[]
            {
                DbHelper.MakeAndWhere("parentid", 0),
                DbHelper.MakeAndWhere("channelid", this.channelid),
                DbHelper.MakeAndWhere("id", WhereType.NotEqual, this.id)
            };
            OrderByParam orderby = DbHelper.MakeOrderBy("display", OrderBy.ASC);

            this.channellist = DbHelper.ExecuteList <ChannelInfo>(orderby, new SqlParam[0]);
            this.sortlist    = DbHelper.ExecuteList <SortInfo>(orderby, sqlparams2);
            this.sortapplist = DbHelper.ExecuteList <SortAppInfo>(OrderBy.ASC);
            SqlParam sqlParam = DbHelper.MakeAndWhere("parentid", 0);

            this.typelist = DbHelper.ExecuteList <TypeInfo>(orderby, new SqlParam[]
            {
                sqlParam
            });
            base.SaveRightURL();
        }
Esempio n. 16
0
        // Token: 0x06000090 RID: 144 RVA: 0x0000C21C File Offset: 0x0000A41C
        protected override void View()
        {
            if (this.id > 0)
            {
                this.department = DbHelper.ExecuteModel <Department>(this.id);
                this.parentid   = this.department.parentid;
            }
            if (this.ispost)
            {
                this.department = FPRequest.GetModel <Department>(this.department);
                string     text       = "0";
                Department department = new Department();
                if (this.department.id > 0)
                {
                    if (DbHelper.ExecuteUpdate <Department>(this.department) > 0)
                    {
                        if (this.department.parentid != this.parentid)
                        {
                            text = this.department.parentlist;
                            if (this.department.parentid > 0)
                            {
                                department = DbHelper.ExecuteModel <Department>(this.department.parentid);
                                this.department.parentlist = department.parentlist + "," + department.id;
                            }
                            else
                            {
                                this.department.parentlist = "0," + this.department.id.ToString();
                            }
                            StringBuilder stringBuilder = new StringBuilder();
                            stringBuilder.AppendFormat("UPDATE [{0}WMS_Department] SET [parentlist]='{1}' WHERE [id]={2};", DbConfigs.Prefix, this.department.parentlist, this.id);
                            if (DbConfigs.DbType == DbType.Access)
                            {
                                stringBuilder.AppendFormat("UPDATE [{0}WMS_Department] SET [parentlist]=REPLACE([parentlist], '{1}', '{2}', 1, 1) WHERE [id] in (select [id] FROM [{0}WMS_Department] WHERE [parentlis] LIKE '{3},%');", new object[]
                                {
                                    DbConfigs.Prefix,
                                    text,
                                    this.department.parentlist,
                                    text
                                });
                            }
                            else
                            {
                                stringBuilder.AppendFormat("UPDATE [{0}WMS_Department] SET [parentlist]=STUFF([parentlist],1,{1},'{2}') WHERE [id] in (SELECT [id] FROM [{0}WMS_Department] WHERE [parentlis] LIKE '{3},%');", new object[]
                                {
                                    DbConfigs.Prefix,
                                    text.Length,
                                    this.department.parentlist,
                                    text
                                });
                            }
                            stringBuilder.AppendFormat("UPDATE [{0}WMS_Department] SET [subcounts]=[subcounts]-1 WHERE [id]={1};", DbConfigs.Prefix, this.parentid);
                            stringBuilder.AppendFormat("UPDATE [{0}WMS_Department] SET [subcounts]=[subcounts]+1 WHERE [id]={1};", DbConfigs.Prefix, this.department.parentid);
                            DbHelper.ExecuteSql(stringBuilder.ToString());
                        }
                    }
                }
                else
                {
                    SqlParam sqlParam = DbHelper.MakeAndWhere("parentid", this.parentid);
                    this.department.display = FPUtils.StrToInt(DbHelper.ExecuteMax <Department>("display", new SqlParam[]
                    {
                        sqlParam
                    }).ToString()) + 1;
                    this.id = DbHelper.ExecuteInsert <Department>(this.department);
                    if (this.id > 0)
                    {
                        if (this.department.parentid > 0)
                        {
                            department = DbHelper.ExecuteModel <Department>(this.department.parentid);
                            text       = department.parentlist + "," + this.id;
                        }
                        else
                        {
                            text = text + "," + this.id;
                        }
                        StringBuilder stringBuilder = new StringBuilder();
                        stringBuilder.AppendFormat("UPDATE [{0}WMS_Department] SET [parentlist] = '{1}' WHERE [id]={2};", DbConfigs.Prefix, text, this.id);
                        stringBuilder.AppendFormat("UPDATE [{0}WMS_Department] SET [subcounts] = [subcounts]+1 WHERE [id]={1};", DbConfigs.Prefix, this.department.parentid);
                        DbHelper.ExecuteSql(stringBuilder.ToString());
                    }
                }
                base.Response.Redirect("departmentmanage.aspx");
            }
            SqlParam[] sqlparams = new SqlParam[]
            {
                DbHelper.MakeAndWhere("parentid", 0),
                DbHelper.MakeAndWhere("id", WhereType.NotEqual, this.id)
            };
            OrderByParam orderby = DbHelper.MakeOrderBy("display", OrderBy.ASC);

            this.departmentlist = DbHelper.ExecuteList <Department>(orderby, sqlparams);
            base.SaveRightURL();
        }
Esempio n. 17
0
 // Token: 0x0600009F RID: 159 RVA: 0x0000D124 File Offset: 0x0000B324
 protected override void View()
 {
     this.roleinfo = DbHelper.ExecuteModel <RoleInfo>(this.rid);
     if (this.roleinfo.id == 0)
     {
         this.ShowErr("对不起,该角色不存在或已被删除。");
     }
     else
     {
         if (this.ispost)
         {
             string   @string = FPRequest.GetString("sorts");
             string   text    = "";
             string[] array   = FPUtils.SplitString(@string);
             int      i       = 0;
             while (i < array.Length)
             {
                 string text2 = array[i];
                 if (text != "")
                 {
                     text += ",";
                 }
                 if (text2.Length > 1)
                 {
                     if (FPUtils.StrToInt(text2.Substring(1, text2.Length - 1)) != 0)
                     {
                         text += text2.Substring(1, text2.Length - 1);
                     }
                 }
                 //IL_E4:
                 i++;
                 //continue;
                 //goto IL_E4;
             }
             this.roleinfo.sorts = text;
             DbHelper.ExecuteUpdate <RoleInfo>(this.roleinfo);
             if (this.roleinfo.id == this.roleid)
             {
                 base.ResetUser();
             }
             base.Response.Redirect(this.pagename + "?rid=" + this.rid);
         }
         List <ChannelInfo> channelList = ChannelBll.GetChannelList();
         foreach (ChannelInfo channelInfo in channelList)
         {
             if (this.zNodes != "")
             {
                 this.zNodes += ",";
             }
             object obj = this.zNodes;
             this.zNodes = string.Concat(new object[]
             {
                 obj,
                 "{ id: ",
                 channelInfo.id,
                 "0, pId: 0, name: \"",
                 channelInfo.name,
                 "\",open:true, icon: \"",
                 this.webpath,
                 (this.sysconfig.adminpath == "") ? "" : (this.sysconfig.adminpath + "/"),
                 "images/sysmenu1.gif\" }"
             });
             string sortTree = this.GetSortTree(channelInfo.id, 0);
             if (sortTree != "")
             {
                 this.zNodes = this.zNodes + "," + sortTree;
             }
         }
         base.SaveRightURL();
     }
 }
Esempio n. 18
0
 // Token: 0x060000BD RID: 189 RVA: 0x00012850 File Offset: 0x00010A50
 protected override void View()
 {
     this.channelinfo = ChannelBll.GetChannelInfo("exam_question");
     if (this.channelinfo.id == 0)
     {
         this.ShowErr("对不起,目前系统尚未创建题目库频道。");
     }
     else
     {
         string sqlstring = string.Format("SELECT COUNT([uid]) FROM (SELECT DISTINCT [uid] FROM [{0}Exam_ExamResult] WHERE [channelid]={1} AND [status]>0) AS TA", DbConfigs.Prefix, this.channelinfo.id);
         this.examusers   = this.GetScalarTotal(sqlstring);
         sqlstring        = string.Format("SELECT AVG([score]) FROM [{0}Exam_ExamResult] WHERE [channelid]={1} AND [uid]={2} AND [status]>0", DbConfigs.Prefix, this.channelinfo.id, this.userid);
         this.avg_my      = this.GetScalarTotal(sqlstring);
         sqlstring        = string.Format("SELECT AVG([score]) FROM [{0}Exam_ExamResult] WHERE [channelid]={1} AND [status]>0", DbConfigs.Prefix, this.channelinfo.id);
         this.avg_total   = this.GetScalarTotal(sqlstring);
         sqlstring        = string.Format("SELECT COUNT(*) FROM (SELECT [uid],AVG([score]) AS [scoreavg] FROM [{0}Exam_ExamResult] WHERE [channelid]={1} AND [status]>0 GROUP BY [uid]) AS TA WHERE [scoreavg]>{2}", DbConfigs.Prefix, this.channelinfo.id, this.avg_my);
         this.avg_display = FPUtils.StrToInt(this.GetScalarTotal(sqlstring)) + 1;
         sqlstring        = string.Format("SELECT SUM([answers]) AS [answers],SUM([wrongs]) AS [wrongs] FROM [{0}Exam_ExamLogInfo] WHERE [channelid]={1}", DbConfigs.Prefix, this.channelinfo.id);
         ExamLogInfo examLogInfo = this.GetExamLogInfo(sqlstring);
         this.accuracy_total   = examLogInfo.accuracy;
         sqlstring             = string.Format("SELECT SUM([answers]) AS [answers],SUM([wrongs]) AS [wrongs] FROM [{0}Exam_ExamLogInfo] WHERE [channelid]={1} AND [uid]={2}", DbConfigs.Prefix, this.channelinfo.id, this.userid);
         examLogInfo           = this.GetExamLogInfo(sqlstring);
         this.accuracy_my      = examLogInfo.accuracy;
         sqlstring             = string.Format("SELECT COUNT(*) FROM (SELECT [uid],SUM(wrongs) AS [wrongs] FROM [{0}Exam_ExamLogInfo] WHERE [channelid]={1} GROUP BY [uid]) AS TA WHERE [wrongs]<{2}", DbConfigs.Prefix, this.channelinfo.id, examLogInfo.wrongs);
         this.accuracy_display = FPUtils.StrToInt(this.GetScalarTotal(sqlstring)) + 1;
         SqlParam[] sqlparams = new SqlParam[]
         {
             DbHelper.MakeAndWhere("channelid", this.channelinfo.id),
             DbHelper.MakeAndWhere("status", WhereType.GreaterThan, 0),
             DbHelper.MakeAndWhere("uid", this.userid)
         };
         List <ExamResult> list = DbHelper.ExecuteList <ExamResult>(OrderBy.ASC, sqlparams);
         int num = 1;
         foreach (ExamResult examResult in list)
         {
             if (this.examresult != "")
             {
                 this.examresult += ",";
             }
             this.examresult += string.Format("['', {0}]", examResult.score);
             num++;
         }
         this.userexamlog = ExamBll.GetExamLogList(this.channelinfo.id, this.userid);
         List <SortAppInfo> sortAppList = SortBll.GetSortAppList("exam_");
         foreach (SortAppInfo sortAppInfo in sortAppList)
         {
             if (this.sortappidlist != "")
             {
                 this.sortappidlist += ",";
             }
             this.sortappidlist += sortAppInfo.id;
         }
         SqlParam[] sqlparams2 = new SqlParam[]
         {
             DbHelper.MakeAndWhere("parentid", 0),
             DbHelper.MakeAndWhere("channelid", this.channelinfo.id),
             DbHelper.MakeAndWhere("appid", WhereType.In, this.sortappidlist),
             DbHelper.MakeAndWhere("hidden", 0)
         };
         OrderByParam    orderby = DbHelper.MakeOrderBy("display", OrderBy.ASC);
         List <SortInfo> list2   = DbHelper.ExecuteList <SortInfo>(orderby, sqlparams2);
         foreach (SortInfo sortInfo in list2)
         {
             if (this.userexamlog.ContainsKey(sortInfo.id))
             {
                 examLogInfo = this.userexamlog[sortInfo.id];
             }
             else
             {
                 examLogInfo = new ExamLogInfo();
             }
             examLogInfo.sortid    = sortInfo.id;
             examLogInfo.sortname  = sortInfo.name;
             examLogInfo.questions = sortInfo.posts;
             examLogInfo.subcounts = sortInfo.subcounts;
             this.examloglist.Add(examLogInfo);
         }
     }
 }
Esempio n. 19
0
 // Token: 0x0600031B RID: 795 RVA: 0x0000D178 File Offset: 0x0000B378
 protected override void View()
 {
     this.regconfig = RegConfigs.GetRegConfig();
     if (this.reurl == "")
     {
         this.reurl = "index.aspx";
     }
     if (this.userid > 0)
     {
         base.Response.Redirect(this.reurl);
     }
     else if (this.ispost)
     {
         string @string = FPRequest.GetString("username");
         string string2 = FPRequest.GetString("password");
         if (@string == "")
         {
             this.ShowErr("帐号不能为空");
         }
         else if (string2 == "")
         {
             this.ShowErr("密码不能为空");
         }
         else
         {
             if (this.isseccode)
             {
                 if (FPRequest.GetString("verify").Equals(""))
                 {
                     this.ShowErr("验证码不能为空");
                     return;
                 }
                 if (string.Compare(this.Session["FP_VERIFY"].ToString().ToLower(), FPRequest.GetString("verify").ToLower(), true) != 0)
                 {
                     this.ShowErr("验证码错误");
                     return;
                 }
             }
             UserInfo userInfo = UserBll.CheckLogin(@string, string2);
             if (userInfo.id > 0)
             {
                 if (userInfo.roleid == 4)
                 {
                     this.ShowErr("对不起,该用户已被禁止登录");
                 }
                 else if (userInfo.roleid == 3)
                 {
                     if (this.regconfig.regverify == 1)
                     {
                         this.ShowErr("您需要等待一些时间, 待系统管理员审核您的帐户后才可登录使用");
                     }
                     else if (this.regconfig.regverify == 2)
                     {
                         this.ShowErr("请您到您的邮箱中点击激活链接来激活您的帐号");
                     }
                     else
                     {
                         this.ShowErr("抱歉, 您的用户身份尚未得到验证");
                     }
                 }
                 else
                 {
                     WMSCookie.WriteUserCookie(userInfo, FPUtils.StrToInt(FPRequest.GetString("expires"), -1), this.sysconfig.passwordkey);
                     this.Session["FP_OLUSERINFO"] = userInfo;
                     this.Session["FP_ROLEINFO"]   = userInfo.RoleInfo;
                     this.Session["FP_PERMISSION"] = new PermissionBll().GetPermissionList(userInfo.RoleInfo.permission);
                     SysBll.InsertLog(userInfo.id, userInfo.username, "用户登录", "登录用户:" + userInfo.username, true);
                     base.AddMsg("登录成功, 返回登录前页面");
                     base.SetMetaRefresh(2, this.reurl);
                     if (!this.iscuserr)
                     {
                         base.Response.Redirect(this.reurl);
                     }
                 }
             }
             else
             {
                 SysBll.InsertLog(userInfo.id, userInfo.username, "用户登录", "输入用户:" + @string + ",密码:" + string2, false);
                 this.ShowErr("帐号或密码错误");
             }
         }
     }
 }
Esempio n. 20
0
        // Token: 0x06000033 RID: 51 RVA: 0x00003758 File Offset: 0x00001958
        public string FileSaveAs(HttpPostedFile postedFile, string filetype, UserInfo user, bool isthumbnail, bool iswatermark, int imgmaxwidth, int imgmaxheight)
        {
            string result;

            try
            {
                string   fileExt       = UpLoad.GetFileExt(postedFile.FileName);
                string   fileName      = Path.GetFileName(postedFile.FileName);
                string   text          = this.GetNewFileName() + "." + fileExt;
                int      contentLength = postedFile.ContentLength;
                string[] array         = FPUtils.SplitString(AttachBll.GetAttachTypeArray(filetype), "\r\n");
                string[] array2        = new string[array.Length];
                int[]    array3        = new int[array.Length];
                string   text2         = "";
                for (int i = 0; i < array.Length; i++)
                {
                    string[] array4 = FPUtils.SplitString(array[i], ",", 2);
                    array2[i] = array4[0];
                    array3[i] = FPUtils.StrToInt(array4[1], 0);
                    if (text2 != "")
                    {
                        text2 += "、";
                    }
                    text2 += array4[0];
                }
                int inArrayID = FPUtils.GetInArrayID(fileExt, array2, true);
                if (inArrayID < 0)
                {
                    SysBll.InsertLog(user.id, user.username, "上传文件", "上传文件:" + fileName + ",类型不合法", false);
                    result = string.Concat(new string[]
                    {
                        "{\"error\": \"只允许上传【",
                        text2,
                        "】类型的文件!\", \"filename\": \"\", \"filesize\": \"",
                        contentLength.ToString(),
                        "\", \"originalname\": \"",
                        fileName,
                        "\"}"
                    });
                }
                else if (postedFile.ContentLength > array3[inArrayID] * 1024)
                {
                    SysBll.InsertLog(user.id, user.username, "上传文件", "上传文件:" + fileName + ",文件大小超过范围", false);
                    result = string.Concat(new object[]
                    {
                        "{\"error\": \"该类型文件上传不得超过【",
                        array3[inArrayID],
                        "KB】\", \"filename\": \"\", \"filesize\": \"",
                        contentLength.ToString(),
                        "\", \"originalname\": \"",
                        fileName,
                        "\"}"
                    });
                }
                else
                {
                    string upLoadPath = this.GetUpLoadPath();
                    string mapPath    = FPUtils.GetMapPath(upLoadPath);
                    if (!Directory.Exists(mapPath))
                    {
                        Directory.CreateDirectory(mapPath);
                    }
                    postedFile.SaveAs(mapPath + text);
                    if (imgmaxwidth <= 0)
                    {
                        imgmaxwidth = this.sysconfig.attachimgmaxwidth;
                    }
                    if (imgmaxheight <= 0)
                    {
                        imgmaxheight = this.sysconfig.attachimgmaxheight;
                    }
                    if (this.IsImage(fileExt) && (imgmaxwidth > 0 || imgmaxheight > 0))
                    {
                        FPThumb.MakeThumbnailImage(mapPath + text, mapPath + text, imgmaxwidth, imgmaxheight);
                    }
                    string strPath = upLoadPath + Path.GetFileNameWithoutExtension(text) + "_small." + fileExt;
                    if (this.IsImage(fileExt) && isthumbnail && this.sysconfig.thumbnailwidth > 0 && this.sysconfig.thumbnailheight > 0)
                    {
                        FPThumb.MakeThumbnailImage(mapPath + text, FPUtils.GetMapPath(strPath), this.sysconfig.thumbnailwidth, this.sysconfig.thumbnailheight);
                    }
                    if (this.IsWaterMark(fileExt) && iswatermark)
                    {
                        WaterMark.AddImageSignPic(mapPath + text, mapPath + text, FPUtils.GetMapPath(WebConfig.WebPath + this.sysconfig.watermarkpic), this.sysconfig.watermarkstatus, this.sysconfig.attachimgquality, this.sysconfig.watermarkopacity);
                    }
                    SysBll.InsertLog(user.id, user.username, "上传文件", "上传文件:" + fileName, true);
                    result = string.Concat(new string[]
                    {
                        "{\"error\": \"\", \"filename\": \"",
                        upLoadPath,
                        text,
                        "\", \"filesize\": \"",
                        contentLength.ToString(),
                        "\", \"originalname\": \"",
                        fileName,
                        "\"}"
                    });
                }
            }
            catch (Exception ex)
            {
                SysBll.InsertLog(user.id, user.username, "上传文件", "错误:" + ex.Message, false);
                result = "{\"error\": \"上传过程中发生意外错误!\", \"filename\": \"\", \"filesize\": \"0\", \"originalname\": \"\"}";
            }
            return(result);
        }