Exemplo n.º 1
0
        // Token: 0x0600026A RID: 618 RVA: 0x000084E4 File Offset: 0x000066E4
        public static int CheckSMS(string clientsms, string serversms)
        {
            string[] array  = FPUtils.SplitString(serversms, "|", 3);
            string[] array2 = FPUtils.SplitString(serversms, "|", 3);
            int      result;

            if (array2[0] != array[0])
            {
                result = 0;
            }
            else if (array2[1] != array[1])
            {
                result = -1;
            }
            else
            {
                DateTime dateTime = Convert.ToDateTime(array2[2]);
                DateTime t        = Convert.ToDateTime(array[2]);
                if (dateTime.AddMinutes(5.0) < t)
                {
                    result = -2;
                }
                else
                {
                    result = 1;
                }
            }
            return(result);
        }
Exemplo n.º 2
0
 // Token: 0x06000048 RID: 72 RVA: 0x00006580 File Offset: 0x00004780
 protected override void View()
 {
     if (this.ispost)
     {
         if (this.action == "delete")
         {
             string @string = FPRequest.GetString("chkid");
             DbHelper.ExecuteDelete <TaskInfo>(@string);
             TaskManager.Reset();
         }
         else if (this.action == "download")
         {
             int      @int     = FPRequest.GetInt("tid");
             TaskInfo taskInfo = DbHelper.ExecuteModel <TaskInfo>(@int);
             string   text     = FPUtils.SplitString(taskInfo.type, ",", 2)[1];
             if (text == "")
             {
                 this.ShowErr("任务类型不正确。");
                 return;
             }
             if (!File.Exists(FPUtils.GetMapPath(this.webpath + "bin/" + text + ".dll")))
             {
                 this.ShowErr("任务类库DLL不存在或已被删除。");
                 return;
             }
             using (FPZip fpzip = new FPZip())
             {
                 if (File.Exists(FPUtils.GetMapPath(this.webpath + "cache/task.config")))
                 {
                     File.Delete(FPUtils.GetMapPath(this.webpath + "cache/task.config"));
                 }
                 FPSerializer.Save <TaskInfo>(taskInfo, FPUtils.GetMapPath(this.webpath + "cache/task.config"));
                 fpzip.AddFile(FPUtils.GetMapPath(this.webpath + "cache/task.config"), "");
                 fpzip.AddFile(FPUtils.GetMapPath(this.webpath + "bin/" + text + ".dll"), "");
                 fpzip.ZipDown(FPUtils.UrlEncode(taskInfo.name + ".task"));
             }
         }
         else if (this.action == "run")
         {
             int      @int     = FPRequest.GetInt("tid");
             TaskInfo taskInfo = DbHelper.ExecuteModel <TaskInfo>(@int);
             if (taskInfo.id == 0)
             {
                 this.ShowErr("对不起,该任务不存在或已被删除。");
                 return;
             }
             try
             {
                 TaskManager.Execute(taskInfo);
             }
             catch (Exception ex)
             {
                 this.ShowErr("执行计划任务失败:" + ex.Message);
                 return;
             }
         }
     }
     this.tasklist = DbHelper.ExecuteList <TaskInfo>(OrderBy.ASC);
     base.SaveRightURL();
 }
Exemplo n.º 3
0
        // Token: 0x0600008F RID: 143 RVA: 0x0000E224 File Offset: 0x0000C424
        protected List <ExamQuestion> GetQuestionList(ExamResultTopic resultinfo)
        {
            SqlParam            sqlParam = DbHelper.MakeAndWhere("id", WhereType.In, resultinfo.questionlist);
            List <ExamQuestion> list     = DbHelper.ExecuteList <ExamQuestion>(new SqlParam[]
            {
                sqlParam
            });

            int[]               array  = FPUtils.SplitInt(resultinfo.questionlist);
            string[]            array2 = FPUtils.SplitString(resultinfo.answerlist, "§", array.Length);
            string[]            array3 = FPUtils.SplitString(resultinfo.optionlist, "|", array.Length);
            List <ExamQuestion> list2  = new List <ExamQuestion>();
            int num = 0;

            foreach (int num2 in array)
            {
                foreach (ExamQuestion examQuestion in list)
                {
                    if (examQuestion.id == num2)
                    {
                        examQuestion.useranswer = array2[num];
                        examQuestion.optionlist = array3[num];
                        list2.Add(examQuestion);
                    }
                }
                num++;
            }
            return(list2);
        }
Exemplo n.º 4
0
        // Token: 0x06000030 RID: 48 RVA: 0x00003E24 File Offset: 0x00002024
        public static string GetQuestionRandom(int channelid, int count, string type, string sidlist, string qidlist)
        {
            StringBuilder stringBuilder = new StringBuilder();

            stringBuilder.AppendFormat("SELECT [id] FROM [{0}Exam_ExamQuestion] WHERE [status]=1", DbConfigs.Prefix);
            if (channelid > 0)
            {
                stringBuilder.AppendFormat(" AND [channelid]={0}", channelid);
            }
            if (type != "")
            {
                stringBuilder.AppendFormat(" AND [type] IN({0})", type);
            }
            if (sidlist != "")
            {
                stringBuilder.AppendFormat(" AND [sortid] IN({0})", sidlist);
            }
            if (qidlist != "")
            {
                stringBuilder.AppendFormat(" AND [id] NOT IN({0})", qidlist);
            }
            IDataReader dataReader = DbHelper.ExecuteReader(CommandType.Text, stringBuilder.ToString());
            string      text       = "";

            while (dataReader.Read())
            {
                if (text != "")
                {
                    text += ",";
                }
                text += dataReader["id"].ToString();
            }
            dataReader.Close();
            return(QuestionBll.GetRandom(FPUtils.SplitString(text), count));
        }
Exemplo n.º 5
0
        // Token: 0x06000096 RID: 150 RVA: 0x0000E908 File Offset: 0x0000CB08
        protected List <ExamQuestion> GetQuestionList(ExamResultTopic resultinfo)
        {
            SqlParam            sqlParam = DbHelper.MakeAndWhere("id", WhereType.In, resultinfo.questionlist);
            List <ExamQuestion> list     = DbHelper.ExecuteList <ExamQuestion>(new SqlParam[]
            {
                sqlParam
            });

            int[]               array  = FPUtils.SplitInt(resultinfo.questionlist);
            string[]            array2 = FPUtils.SplitString(resultinfo.answerlist, "§", array.Length);
            string[]            array3 = FPUtils.SplitString(resultinfo.scorelist, "|", array.Length);
            string[]            array4 = FPUtils.SplitString(resultinfo.optionlist, "|", array.Length);
            List <ExamQuestion> list2  = new List <ExamQuestion>();

            SqlParam[] sqlparams = new SqlParam[]
            {
                DbHelper.MakeAndWhere("qid", WhereType.In, resultinfo.questionlist),
                DbHelper.MakeAndWhere("uid", this.userid)
            };
            List <ExamNote> list3 = DbHelper.ExecuteList <ExamNote>(sqlparams);
            int             num   = 0;

            foreach (int num2 in array)
            {
                foreach (ExamQuestion examQuestion in list)
                {
                    if (examQuestion.id == num2)
                    {
                        examQuestion.useranswer = array2[num];
                        examQuestion.userscore  = (double)FPUtils.StrToFloat(array3[num]);
                        examQuestion.optionlist = array4[num];
                        if (examQuestion.type == 1 || examQuestion.type == 2)
                        {
                            examQuestion.answer = this.OptionAnswer(examQuestion.optionlist, examQuestion.answer);
                        }
                        foreach (ExamNote examNote in list3)
                        {
                            if (examNote.qid == examQuestion.id)
                            {
                                examQuestion.note = examNote.note;
                            }
                        }
                        if (this.examloglist.ContainsKey(examQuestion.sortid))
                        {
                            ExamLogInfo examLogInfo = this.examloglist[examQuestion.sortid];
                            if (FPUtils.InArray(examQuestion.id, examLogInfo.favlist))
                            {
                                examQuestion.isfav = 1;
                            }
                        }
                        list2.Add(examQuestion);
                    }
                }
                num++;
            }
            return(list2);
        }
Exemplo n.º 6
0
        // Token: 0x0600008B RID: 139 RVA: 0x0000BE3C File Offset: 0x0000A03C
        protected override void View()
        {
            string @string = FPRequest.GetString("uid");

            this.uname = this.GetUserName(@string);
            if (@string == "")
            {
                this.reurl = "usermanage.aspx";
            }
            if (this.ispost)
            {
                string string2 = FPRequest.GetString("username");
                if (string2 == "")
                {
                    this.ShowErr("充值用户名不能为空");
                    return;
                }
                this.credits = FPRequest.GetInt("credits");
                if (this.credits == 0)
                {
                    this.ShowErr("充值积分必须大于零或小于零");
                    return;
                }
                string text = FPRequest.GetString("note");
                if (text == "")
                {
                    text = "用户积分充值";
                }
                foreach (string value in FPUtils.SplitString(string2))
                {
                    SqlParam sqlParam = DbHelper.MakeAndWhere("username", value);
                    UserInfo userInfo = DbHelper.ExecuteModel <UserInfo>(new SqlParam[]
                    {
                        sqlParam
                    });
                    if (userInfo.id <= 0)
                    {
                        this.ShowErr("对不起,该充值用户不存在");
                        return;
                    }
                    UserBll.UpdateUserCredit(new CreditInfo
                    {
                        uid     = userInfo.id,
                        name    = text,
                        type    = 1,
                        credits = this.credits,
                        doid    = this.userid,
                        doname  = this.username
                    });
                }
            }
            base.SaveRightURL();
        }
Exemplo n.º 7
0
        // Token: 0x060000E3 RID: 227 RVA: 0x00016B74 File Offset: 0x00014D74
        private static string DelSameAnser(string strIm)
        {
            string[] array = FPUtils.DelArraySame(FPUtils.SplitString(strIm));
            string   text  = "";

            foreach (string str in array)
            {
                if (text != "")
                {
                    text += ",";
                }
                text += str;
            }
            return(text);
        }
Exemplo n.º 8
0
        // Token: 0x06000099 RID: 153 RVA: 0x0000ED58 File Offset: 0x0000CF58
        private string OptionAnswer(string optionlist, string answer)
        {
            string[] array  = FPUtils.SplitString("A,B,C,D,E,F");
            int[]    array2 = FPUtils.SplitInt(optionlist);
            string   text   = "";

            for (int i = 0; i < array2.Length; i++)
            {
                if (FPUtils.InArray(array[array2[i]], answer))
                {
                    if (text != "")
                    {
                        text += ",";
                    }
                    text += array[i];
                }
            }
            return(text);
        }
Exemplo n.º 9
0
        // Token: 0x06000065 RID: 101 RVA: 0x0000A910 File Offset: 0x00008B10
        protected string OptionInt(int ascount, int optiondisplay)
        {
            string text = "";

            for (int i = 0; i < ascount; i++)
            {
                if (text != "")
                {
                    text += ",";
                }
                text += i.ToString();
            }
            if (optiondisplay == 0)
            {
                string[] array = FPUtils.SplitString(text);
                text = QuestionBll.GetRandom(array, array.Length);
            }
            return(text);
        }
Exemplo n.º 10
0
        // Token: 0x06000025 RID: 37 RVA: 0x00003000 File Offset: 0x00001200
        public static string Send(string msgtos, string subject, string message)
        {
            string result;

            if (msgtos == "")
            {
                result = "发送地址不能为空。";
            }
            else
            {
                if (subject == "")
                {
                    subject = "无标题";
                }
                MailMessage mailMessage = new MailMessage();
                mailMessage.From = new MailAddress(Email.emailconfig.sysemail, Email.emailconfig.fromname, Encoding.UTF8);
                foreach (string addresses in FPUtils.SplitString(msgtos, ";"))
                {
                    mailMessage.To.Add(addresses);
                }
                mailMessage.Subject      = subject;
                mailMessage.Body         = message;
                mailMessage.Priority     = MailPriority.Normal;
                mailMessage.BodyEncoding = Encoding.UTF8;
                mailMessage.IsBodyHtml   = true;
                SmtpClient smtpClient = new SmtpClient();
                smtpClient.Host        = Email.emailconfig.smtp;
                smtpClient.Port        = Email.emailconfig.port;
                smtpClient.EnableSsl   = (Email.emailconfig.ssl == 1);
                smtpClient.Credentials = new NetworkCredential(Email.emailconfig.username, Email.emailconfig.password);
                try
                {
                    smtpClient.Send(mailMessage);
                    result = "";
                }
                catch (SmtpException ex)
                {
                    result = ex.Message;
                }
            }
            return(result);
        }
Exemplo n.º 11
0
 // Token: 0x06000324 RID: 804 RVA: 0x0000E0D0 File Offset: 0x0000C2D0
 protected override void View()
 {
     this.fulluserinfo = DbHelper.ExecuteModel <FullUserInfo>(this.userid);
     if (this.fulluserinfo.id == 0)
     {
         this.ShowErr("对不起,该用户不存在或已被删除。");
     }
     else
     {
         this.bday = FPUtils.SplitString(this.fulluserinfo.bday, ",", 3);
         if (this.ispost)
         {
             this.fulluserinfo = FPRequest.GetModel <FullUserInfo>(this.fulluserinfo);
             DbHelper.ExecuteUpdate <FullUserInfo>(this.fulluserinfo);
             this.user = this.fulluserinfo;
             base.ResetUser();
             base.AddMsg("信息更新成功!");
         }
     }
 }
Exemplo n.º 12
0
        // Token: 0x06000097 RID: 151 RVA: 0x0000EBC4 File Offset: 0x0000CDC4
        protected string FmAnswer(string content, int tid, string uanswer)
        {
            string[] array  = FPUtils.SplitString(content, "(#answer)");
            string[] array2 = FPUtils.SplitString(uanswer, ",", array.Length);
            content = "";
            int num = 0;

            foreach (string str in array)
            {
                if (num < array.Length - 1)
                {
                    content = content + str + string.Format("<input type=\"text\" id=\"answer_{0}\" name=\"answer_{0}\" value=\"{1}\" class=\"tkt\"/>", tid, array2[num]);
                }
                else
                {
                    content += str;
                }
                num++;
            }
            return(content);
        }
Exemplo n.º 13
0
        // Token: 0x06000098 RID: 152 RVA: 0x0000EC64 File Offset: 0x0000CE64
        protected string Option(string[] opstr, int ascount, string optionlist)
        {
            string[] array  = FPUtils.SplitString("A,B,C,D,E,F");
            int[]    array2 = FPUtils.SplitInt(optionlist, ",", ascount);
            string   text   = "";

            if (ascount > opstr.Length)
            {
                ascount = opstr.Length;
            }
            for (int i = 0; i < ascount; i++)
            {
                if (optionlist != "")
                {
                    string text2 = text;
                    text = string.Concat(new string[]
                    {
                        text2,
                        array[i],
                        ".",
                        opstr[array2[i]],
                        "<br/>"
                    });
                }
                else
                {
                    string text2 = text;
                    text = string.Concat(new string[]
                    {
                        text2,
                        array[i],
                        ".",
                        opstr[i],
                        "<br/>"
                    });
                }
            }
            return(text);
        }
Exemplo n.º 14
0
        // Token: 0x06000050 RID: 80 RVA: 0x00008A80 File Offset: 0x00006C80
        protected string Option(string[] opstr, int ascount)
        {
            string[] array = FPUtils.SplitString("A,B,C,D,E,F");
            string   text  = "";

            if (ascount > opstr.Length)
            {
                ascount = opstr.Length;
            }
            for (int i = 0; i < ascount; i++)
            {
                string text2 = text;
                text = string.Concat(new string[]
                {
                    text2,
                    array[i],
                    ".",
                    opstr[i],
                    "<br/>"
                });
            }
            return(text);
        }
Exemplo n.º 15
0
        // Token: 0x06000320 RID: 800 RVA: 0x0000DF28 File Offset: 0x0000C128
        private bool InRestrictArray(string usernametxt, string restrict)
        {
            bool result;

            if (restrict == null || restrict == "")
            {
                result = false;
            }
            else
            {
                restrict = Regex.Escape(restrict).Replace("\\*", "[\\w-]*");
                foreach (string text in FPUtils.SplitString(restrict.ToLower(), "|"))
                {
                    Regex regex = new Regex(string.Format("^{0}$", text));
                    if (regex.IsMatch(usernametxt.ToLower()) && !text.Trim().Equals(""))
                    {
                        return(true);
                    }
                }
                result = false;
            }
            return(result);
        }
Exemplo n.º 16
0
        // Token: 0x06000064 RID: 100 RVA: 0x0000A848 File Offset: 0x00008A48
        protected string Option(AsposeWordApp wd, string[] opstr, int ascount, string optionlist)
        {
            string[] array  = FPUtils.SplitString("A,B,C,D,E,F");
            int[]    array2 = FPUtils.SplitInt(optionlist, ",", ascount);
            string   result = "";

            if (ascount > opstr.Length)
            {
                ascount = opstr.Length;
            }
            for (int i = 0; i < ascount; i++)
            {
                if (optionlist != "")
                {
                    wd.Writeln(array[i] + "." + opstr[array2[i]], 12.0, false, "left");
                }
                else
                {
                    wd.Writeln(array[i] + "." + opstr[i], 12.0, false, "left");
                }
            }
            return(result);
        }
Exemplo n.º 17
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("注册失败,请检查输入是否正确。");
                         }
                     }
                 }
             }
         }
     }
 }
Exemplo n.º 18
0
 // Token: 0x06000053 RID: 83 RVA: 0x00007374 File Offset: 0x00005574
 protected override void View()
 {
     if (this.ispost)
     {
         if (!this.isperm)
         {
             this.ShowErr("对不起,您没有权限操作。");
             return;
         }
         int     @int    = FPRequest.GetInt("appid");
         AppInfo appInfo = DbHelper.ExecuteModel <AppInfo>(@int);
         string  mapPath = FPUtils.GetMapPath(this.webpath + appInfo.installpath);
         if (this.action == "delete")
         {
             if (DbHelper.ExecuteDelete <AppInfo>(@int) > 0)
             {
                 foreach (string text in FPUtils.SplitString(appInfo.files))
                 {
                     if (text.StartsWith("bin/"))
                     {
                         if (File.Exists(FPUtils.GetMapPath(WebConfig.WebPath + text)))
                         {
                             File.Delete(FPUtils.GetMapPath(WebConfig.WebPath + text));
                         }
                     }
                     if (File.Exists(mapPath + "/" + text))
                     {
                         if (text.EndsWith(".sql"))
                         {
                             if (text.ToLower().EndsWith("access_un.sql") && DbConfigs.DbType == DbType.Access)
                             {
                                 string sqlstring = FPFile.ReadFile(mapPath + "/" + text);
                                 DbHelper.ExecuteSql(sqlstring);
                             }
                             else if (text.ToLower().EndsWith("sqlserver_un.sql") && DbConfigs.DbType == DbType.SqlServer)
                             {
                                 string sqlstring = FPFile.ReadFile(mapPath + "/" + text);
                                 DbHelper.ExecuteSql(sqlstring);
                             }
                         }
                         File.Delete(mapPath + "/" + text);
                     }
                 }
                 if (Directory.Exists(mapPath))
                 {
                     DirectoryInfo directoryInfo = new DirectoryInfo(mapPath);
                     if (directoryInfo.GetFiles().Length == 0)
                     {
                         directoryInfo.Delete(true);
                     }
                 }
                 SqlParam sqlParam = DbHelper.MakeAndWhere("appid", @int);
                 DbHelper.ExecuteDelete <SortAppInfo>(new SqlParam[]
                 {
                     sqlParam
                 });
             }
             FPCache.Remove("FP_SORTTREE");
             base.Response.Redirect("appmanage.aspx");
         }
     }
     this.applist = DbHelper.ExecuteList <AppInfo>(OrderBy.ASC);
     base.SaveRightURL();
 }
Exemplo n.º 19
0
 // Token: 0x06000057 RID: 87 RVA: 0x00007994 File Offset: 0x00005B94
 protected override void View()
 {
     this.appinfo = DbHelper.ExecuteModel <AppInfo>(this.appid);
     if (this.appinfo.id == 0)
     {
         this.ShowErr("该应用不存在或已被删除。");
     }
     else
     {
         if (this.ispost)
         {
             string mapPath  = FPUtils.GetMapPath(this.webpath + "cache");
             string fileName = Path.GetFileName(FPRequest.Files["uploadfile"].FileName);
             string a        = Path.GetExtension(fileName).ToLower();
             if (a != ".fpk" && a != ".zip")
             {
                 this.ShowErr("对不起,该文件不是方配系统应用更新文件类型。");
                 return;
             }
             if (!Directory.Exists(mapPath))
             {
                 Directory.CreateDirectory(mapPath);
             }
             if (File.Exists(mapPath + "\\" + fileName))
             {
                 File.Delete(mapPath + "\\" + fileName);
             }
             FPRequest.Files["uploadfile"].SaveAs(mapPath + "\\" + fileName);
             if (Directory.Exists(mapPath + "\\" + Path.GetFileNameWithoutExtension(fileName)))
             {
                 Directory.Delete(mapPath + "\\" + Path.GetFileNameWithoutExtension(fileName), true);
             }
             FPZip.UnZipFile(mapPath + "\\" + fileName, "");
             File.Delete(mapPath + "\\" + fileName);
             if (!File.Exists(mapPath + "\\" + Path.GetFileNameWithoutExtension(fileName) + "\\app.config"))
             {
                 Directory.Delete(mapPath + "\\" + Path.GetFileNameWithoutExtension(fileName), true);
                 this.ShowErr("应用配置文件不存在或有错误。");
                 return;
             }
             AppInfo appInfo = FPSerializer.Load <AppInfo>(mapPath + "\\" + Path.GetFileNameWithoutExtension(fileName) + "\\app.config");
             if (this.appinfo.guid == "")
             {
                 this.ShowErr("对不起,该应用标识码错误,更新失败。");
                 return;
             }
             SqlParam sqlParam = DbHelper.MakeAndWhere("guid", this.appinfo.guid);
             this.appinfo = DbHelper.ExecuteModel <AppInfo>(new SqlParam[]
             {
                 sqlParam
             });
             if (this.appinfo.id == 0)
             {
                 this.ShowErr("对不起,该应用不存在或已被删除。");
                 return;
             }
             Version v  = new Version(FPUtils.StrToDecimal(appInfo.version).ToString("0.0"));
             Version v2 = new Version(FPUtils.StrToDecimal(this.appinfo.version).ToString("0.0"));
             if (v < v2)
             {
                 this.ShowErr("对不起,您更新的版本比安装版本还低,不能更新");
                 return;
             }
             this.appinfo.name    = appInfo.name;
             this.appinfo.version = appInfo.version;
             this.appinfo.notes   = appInfo.notes;
             this.appinfo.author  = appInfo.author;
             string mapPath2   = FPUtils.GetMapPath(this.webpath + this.appinfo.installpath);
             string sourcePath = mapPath + "\\" + Path.GetFileNameWithoutExtension(fileName);
             this.appinfo.files = appupdate.CopyDirectory(sourcePath, mapPath2, "", this.appinfo.files);
             if (DbHelper.ExecuteUpdate <AppInfo>(this.appinfo) > 0)
             {
                 foreach (string strContent in appInfo.sortapps.Split(new char[]
                 {
                     '|'
                 }))
                 {
                     string[] array2 = FPUtils.SplitString(strContent, ",", 4);
                     if (!(array2[0] == ""))
                     {
                         SqlParam[] sqlparams = new SqlParam[]
                         {
                             DbHelper.MakeAndWhere("appid", this.appinfo.id),
                             DbHelper.MakeAndWhere("name", array2[0])
                         };
                         SortAppInfo sortAppInfo = DbHelper.ExecuteModel <SortAppInfo>(sqlparams);
                         if (sortAppInfo.id > 0)
                         {
                             sortAppInfo.name      = array2[0];
                             sortAppInfo.markup    = array2[1];
                             sortAppInfo.indexpage = array2[2];
                             sortAppInfo.viewpage  = array2[3];
                             DbHelper.ExecuteUpdate <SortAppInfo>(sortAppInfo);
                         }
                         else
                         {
                             sortAppInfo.appid     = this.appinfo.id;
                             sortAppInfo.name      = array2[0];
                             sortAppInfo.markup    = array2[1];
                             sortAppInfo.indexpage = array2[2];
                             sortAppInfo.viewpage  = array2[3];
                             DbHelper.ExecuteInsert <SortAppInfo>(sortAppInfo);
                         }
                     }
                 }
             }
             Directory.Delete(mapPath + "\\" + Path.GetFileNameWithoutExtension(fileName), true);
             CacheBll.RemoveSortCache();
             base.Response.Redirect("appmanage.aspx");
         }
         base.SaveRightURL();
     }
 }
Exemplo n.º 20
0
 // Token: 0x0600000D RID: 13 RVA: 0x000029C8 File Offset: 0x00000BC8
 protected override void View()
 {
     this.appinfo = DbHelper.ExecuteModel <AppInfo>(this.id);
     if (this.appinfo.id == 0)
     {
         this.ShowErr("对不起,该应用已被删除或不存在。");
     }
     else
     {
         string mapPath = FPUtils.GetMapPath(this.webpath + this.appinfo.installpath);
         if (this.ispost)
         {
             string @string = FPRequest.GetString("setpath");
             if (@string == "")
             {
                 this.ShowErr("对不起,应用默认安装目录名称不能为空。");
             }
             else
             {
                 string pattern = "^[a-zA-Z0-9_\\w]+$";
                 if (this.err == 0 && !Regex.IsMatch(@string.Trim(), pattern, RegexOptions.IgnoreCase))
                 {
                     base.AddErr("默认安装目录名称只能由数字、字母或下划线组成。");
                 }
                 this.appinfo.setpath = @string;
                 DbHelper.ExecuteUpdate <AppInfo>(this.appinfo);
                 FPSerializer.Save <AppInfo>(this.appinfo, FPUtils.GetMapPath(this.webpath + this.appinfo.installpath + "/app.config"));
                 string str = this.appinfo.name + ".fpk";
                 if (this.appinfo.files != "")
                 {
                     using (FPZip fpzip = new FPZip())
                     {
                         foreach (string text in FPUtils.SplitString(this.appinfo.files))
                         {
                             if (text.StartsWith("bin/"))
                             {
                                 fpzip.AddFile(FPUtils.GetMapPath(WebConfig.WebPath + text), text);
                             }
                             else
                             {
                                 fpzip.AddFile(mapPath + "/" + text, text);
                             }
                         }
                         fpzip.ZipDown(FPUtils.UrlEncode(str));
                     }
                 }
                 else
                 {
                     using (FPZip fpzip = new FPZip())
                     {
                         DirectoryInfo directoryInfo = new DirectoryInfo(mapPath);
                         foreach (DirectoryInfo directoryInfo2 in directoryInfo.GetDirectories())
                         {
                             fpzip.AddDirectory(directoryInfo2.FullName);
                         }
                         foreach (FileInfo fileInfo in directoryInfo.GetFiles())
                         {
                             if (fileInfo.Name != "site.config")
                             {
                                 fpzip.AddFile(fileInfo.FullName, "");
                             }
                         }
                         string mapPath2 = FPUtils.GetMapPath(this.webpath + "sites/" + this.appinfo.installpath + "/site.config");
                         if (File.Exists(mapPath2))
                         {
                             SiteConfig siteConfig = SiteConfigs.LoadConfig(mapPath2);
                             if (siteConfig.inherits != "")
                             {
                                 if (siteConfig.inherits.EndsWith(".Controller"))
                                 {
                                     fpzip.AddFile(FPUtils.GetMapPath(this.webpath + "bin/" + siteConfig.inherits.Replace(".Controller", "") + ".dll"), "bin/" + siteConfig.inherits.Replace(".Controller", "") + ".dll");
                                 }
                                 else
                                 {
                                     fpzip.AddFile(FPUtils.GetMapPath(this.webpath + "bin/" + siteConfig.inherits + ".dll"), "bin/" + siteConfig.inherits + ".dll");
                                 }
                             }
                             if (siteConfig.import != "")
                             {
                                 foreach (string text in siteConfig.import.Split(new string[]
                                 {
                                     "\r\n",
                                     ";",
                                     ",",
                                     "|"
                                 }, StringSplitOptions.RemoveEmptyEntries))
                                 {
                                     fpzip.AddFile(FPUtils.GetMapPath(this.webpath + "bin/" + text + ".dll"), "bin/" + text + ".dll");
                                 }
                             }
                         }
                         fpzip.ZipDown(FPUtils.UrlEncode(str));
                     }
                 }
             }
         }
     }
 }
Exemplo n.º 21
0
        // 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();
        }
Exemplo n.º 22
0
 // Token: 0x06000006 RID: 6 RVA: 0x000023A8 File Offset: 0x000005A8
 protected override void View()
 {
     this.link = "dbreset.aspx";
     if (this.ispost)
     {
         if (DbConfigs.DbType == FangPage.Data.DbType.Access)
         {
             this.ShowErr("对不起,本操作不支持Access数据库版本,请安装SqlServer版本。");
             return;
         }
         if (this.action == "table")
         {
             string @string = FPRequest.GetString("tablename");
             if (string.IsNullOrEmpty(@string))
             {
                 this.ShowErr("没有选择要重置的表。");
                 return;
             }
             string   text  = "";
             string[] array = FPUtils.SplitString(FPFile.ReadFile(FPUtils.GetMapPath("sqlreset.sql")), "GO\r\n", 8);
             string   text2 = "";
             foreach (string text3 in FPUtils.SplitString(@string))
             {
                 if (text != "")
                 {
                     text += "GO\r\n";
                 }
                 text = text + "TRUNCATE TABLE " + text3;
                 if (text3.EndsWith("WMS_UserInfo"))
                 {
                     if (text2 != "")
                     {
                         text2 += "GO\r\n";
                     }
                     text2 += array[0];
                 }
                 else if (text3.EndsWith("WMS_UserGrade"))
                 {
                     if (text2 != "")
                     {
                         text2 += "GO\r\n";
                     }
                     text2 += array[1];
                 }
                 else if (text3.EndsWith("WMS_RoleInfo"))
                 {
                     if (text2 != "")
                     {
                         text2 += "GO\r\n";
                     }
                     text2 += array[2];
                 }
                 else if (text3.EndsWith("WMS_Permission"))
                 {
                     if (text2 != "")
                     {
                         text2 += "GO\r\n";
                     }
                     text2 += array[3];
                 }
                 else if (text3.EndsWith("WMS_MenuInfo"))
                 {
                     if (text2 != "")
                     {
                         text2 += "GO\r\n";
                     }
                     text2 += array[4];
                 }
                 else if (text3.EndsWith("WMS_DesktopInfo"))
                 {
                     if (text2 != "")
                     {
                         text2 += "GO\r\n";
                     }
                     text2 += array[5];
                 }
                 else if (text3.EndsWith("WMS_ChannelInfo"))
                 {
                     if (text2 != "")
                     {
                         text2 += "GO\r\n";
                     }
                     text2 += array[6];
                 }
                 else if (text3.EndsWith("WMS_AttachType"))
                 {
                     if (text2 != "")
                     {
                         text2 += "GO\r\n";
                     }
                     text2 += array[7];
                 }
             }
             if (text2 != "")
             {
                 if (text != "")
                 {
                     text += "GO\r\n";
                 }
                 text += text2;
             }
             DbHelper.ExecuteSql(text);
         }
         else if (this.action == "system")
         {
             this.dbtablelist = DbHelper.GetDbTableList();
             string text = "";
             foreach (object obj in this.dbtablelist.Rows)
             {
                 DataRow dataRow = (DataRow)obj;
                 if (dataRow["TABLE_NAME"].ToString().StartsWith(DbConfigs.Prefix))
                 {
                     if (text != "")
                     {
                         text += "|";
                     }
                     text = text + "TRUNCATE TABLE " + dataRow["TABLE_NAME"].ToString();
                 }
             }
             DbHelper.ExecuteSql(text);
             text = FPFile.ReadFile(FPUtils.GetMapPath("sqlreset.sql")).Replace("|", "");
             DbHelper.ExecuteSql(text);
             this.link = this.adminpath + "logout.aspx";
         }
     }
     this.dbtablelist = DbHelper.GetDbTableList();
     base.SaveRightURL();
 }
Exemplo n.º 23
0
        // Token: 0x060000B8 RID: 184 RVA: 0x00011E2C File Offset: 0x0001002C
        protected override void View()
        {
            if (this.ispost)
            {
                if (!this.isperm)
                {
                    this.ShowErrMsg("对不起,您没有权限阅卷。");
                    return;
                }
                this.examresult = ExamBll.GetExamResult(this.resultid);
                if (this.examresult.id == 0)
                {
                    this.ShowErrMsg("对不起,该考试不存在或已被删除。");
                    return;
                }
                int status = this.examresult.status;
                this.examresult.status = 2;
                this.examresult.exnote = FPRequest.GetString("exnote");
                if (DbHelper.ExecuteUpdate <ExamResult>(this.examresult) <= 0)
                {
                    this.ShowErrMsg("保存出现错误。");
                    return;
                }
                List <ExamResultTopic> examResultTopicList = ExamBll.GetExamResultTopicList(this.resultid);
                int    num   = 0;
                double score = this.examresult.score;
                this.examresult.score  = 0.0;
                this.examresult.score1 = 0.0;
                this.examresult.score2 = 0.0;
                this.examresult.wrongs = 0;
                foreach (ExamResultTopic examResultTopic in examResultTopicList)
                {
                    if (examResultTopic.questions == 0)
                    {
                        num++;
                    }
                    else
                    {
                        int[]    array  = FPUtils.SplitInt(examResultTopic.questionlist);
                        string[] array2 = FPUtils.SplitString(examResultTopic.answerlist, "§", array.Length);
                        string[] array3 = FPUtils.SplitString(examResultTopic.scorelist, "|", array.Length);
                        examResultTopicList[num].scorelist   = "";
                        examResultTopicList[num].correctlist = "";
                        examResultTopicList[num].score       = 0.0;
                        int num2 = 0;
                        foreach (ExamQuestion examQuestion in QuestionBll.GetQuestionList(examResultTopic.questionlist))
                        {
                            string a = array2[num2];
                            if (examResultTopicList[num].scorelist != "")
                            {
                                ExamResultTopic examResultTopic2 = examResultTopicList[num];
                                examResultTopic2.scorelist += "|";
                            }
                            double num3 = 0.0;
                            if (examQuestion.type == 1 || examQuestion.type == 2)
                            {
                                num3 = (double)FPRequest.GetFloat("score_" + examQuestion.id);
                                this.examresult.score1 += num3;
                            }
                            else if (examQuestion.type == 3)
                            {
                                num3 = (double)FPRequest.GetFloat("score_" + examQuestion.id);
                                this.examresult.score1 += num3;
                            }
                            else if (examQuestion.type == 4)
                            {
                                num3 = (double)FPRequest.GetFloat("score_" + examQuestion.id);
                                this.examresult.score1 += num3;
                            }
                            else if (examQuestion.type == 5)
                            {
                                num3 = (double)FPRequest.GetFloat("score_" + examQuestion.id);
                                this.examresult.score2 += num3;
                            }
                            else if (examQuestion.type == 6)
                            {
                                num3 = (double)FPRequest.GetFloat("score_" + examQuestion.id);
                                this.examresult.score2 += num3;
                            }
                            this.examresult.score          += num3;
                            examResultTopicList[num].score += num3;
                            ExamResultTopic examResultTopic3 = examResultTopicList[num];
                            examResultTopic3.scorelist += num3.ToString();
                            if (examResultTopicList[num].correctlist != "")
                            {
                                ExamResultTopic examResultTopic4 = examResultTopicList[num];
                                examResultTopic4.correctlist += "|";
                            }
                            bool iswrong = false;
                            if (num3 >= examResultTopic.perscore * 0.6)
                            {
                                ExamResultTopic examResultTopic5 = examResultTopicList[num];
                                examResultTopic5.correctlist += "1";
                            }
                            else
                            {
                                ExamResultTopic examResultTopic6 = examResultTopicList[num];
                                examResultTopic6.correctlist += "0";
                                examResultTopicList[num].wrongs++;
                                this.examresult.wrongs++;
                                if (a == "")
                                {
                                    this.examresult.unanswer++;
                                }
                                iswrong = true;
                            }
                            SortInfo sortInfo = SortBll.GetSortInfo(examQuestion.sortid);
                            ExamBll.UpdateExamLog(sortInfo, this.examresult.uid, examQuestion, iswrong);
                            num2++;
                        }
                        DbHelper.ExecuteUpdate <ExamResultTopic>(examResultTopicList[num]);
                        num++;
                    }
                }
                ExpInfo       examExpByScore = ExamBll.GetExamExpByScore(this.examresult.score, this.examresult.examid);
                StringBuilder stringBuilder  = new StringBuilder();
                if (status == 0)
                {
                    stringBuilder.AppendFormat("UPDATE [{0}Exam_ExamResult] SET [score1]={1},[score2]={2},[score]={3},[wrongs]={4},[exp]={5} WHERE [id]={6}|", new object[]
                    {
                        DbConfigs.Prefix,
                        this.examresult.score1,
                        this.examresult.score2,
                        this.examresult.score,
                        this.examresult.wrongs,
                        examExpByScore.exp,
                        this.examresult.id
                    });
                    stringBuilder.AppendFormat("UPDATE [{0}Exam_ExamInfo] SET [exams]=[exams]+1,[score]=[score]+{1} WHERE [id]={2}", DbConfigs.Prefix, this.examresult.score, this.examresult.examid);
                }
                else
                {
                    stringBuilder.AppendFormat("UPDATE [{0}Exam_ExamResult] SET [score1]={1},[score2]={2},[score]={3},[exp]={4} WHERE [id]={5}|", new object[]
                    {
                        DbConfigs.Prefix,
                        this.examresult.score1,
                        this.examresult.score2,
                        this.examresult.score,
                        examExpByScore.exp,
                        this.examresult.id
                    });
                    stringBuilder.AppendFormat("UPDATE [{0}Exam_ExamInfo] SET [score]=[score]-{1} WHERE [id]={2}|", DbConfigs.Prefix, score, this.examresult.examid);
                    stringBuilder.AppendFormat("UPDATE [{0}Exam_ExamInfo] SET [score]=[score]+{1} WHERE [id]={2}", DbConfigs.Prefix, this.examresult.score, this.examresult.examid);
                    stringBuilder.AppendFormat("UPDATE [{0}WMS_UserInfo] SET [exp]=[exp]-{1} WHERE [id]={2}", DbConfigs.Prefix, this.examresult.exp, this.examresult.uid);
                }
                this.msg = DbHelper.ExecuteSql(stringBuilder.ToString());
                UserBll.UpdateUserExp(this.examresult.uid, examExpByScore.exp);
                if (this.msg != "")
                {
                    this.ShowErrMsg(this.msg);
                    return;
                }
            }
            Hashtable hashtable = new Hashtable();

            hashtable["error"]   = 0;
            hashtable["message"] = "";
            base.Response.AddHeader("Content-Type", "text/html; charset=UTF-8");
            base.Response.Write(JsonMapper.ToJson(hashtable));
            base.Response.End();
        }
Exemplo n.º 24
0
 // Token: 0x06000039 RID: 57 RVA: 0x00005364 File Offset: 0x00003564
 protected override void View()
 {
     this.examconfiginfo = ExamConifgs.GetExamConfig();
     if (this.ispost)
     {
         if (this.action == "save")
         {
             this.examconfiginfo.showanswer = 0;
             this.examconfiginfo            = FPRequest.GetModel <ExamConfig>(this.examconfiginfo);
             if (this.examconfiginfo.testcount == 0)
             {
                 this.examconfiginfo.testcount = 80;
             }
             if (this.examconfiginfo.testtime == 0)
             {
                 this.examconfiginfo.testtime = 60;
             }
             ExamConifgs.SaveConfig(this.examconfiginfo);
             base.AddMsg("考试配置保存成功。");
         }
         else if (this.action == "reset" || this.action == "clear")
         {
             ChannelInfo channelInfo = new ChannelInfo();
             channelInfo = ChannelBll.GetChannelInfo("exam_question");
             if (channelInfo.id > 0)
             {
                 SortAppInfo sortAppInfo = SortBll.GetSortAppInfo("exam_question");
                 if (sortAppInfo.id > 0)
                 {
                     SqlParam        sqlParam = DbHelper.MakeAndWhere("appid", sortAppInfo.id);
                     List <SortInfo> sortlist = DbHelper.ExecuteList <SortInfo>(new SqlParam[]
                     {
                         sqlParam
                     });
                     SortBll.ResetSortPosts <ExamQuestion>(sortlist);
                     sqlParam = DbHelper.MakeAndWhere("type", WhereType.In, "1,2");
                     List <ExamQuestion> list = DbHelper.ExecuteList <ExamQuestion>(new SqlParam[]
                     {
                         sqlParam
                     });
                     for (int i = 0; i < list.Count; i++)
                     {
                         string text = "";
                         int    num  = 0;
                         foreach (string text2 in FPUtils.SplitString(list[i].content, "§"))
                         {
                             if (text2 != "")
                             {
                                 if (text != "")
                                 {
                                     text += "§";
                                 }
                                 text += text2;
                                 num++;
                             }
                         }
                         list[i].content = text;
                         list[i].ascount = num;
                         DbHelper.ExecuteUpdate <ExamQuestion>(list[i]);
                     }
                     base.AddMsg("题库统计重置成功。");
                 }
             }
         }
         else if (this.action == "clear")
         {
             DbHelper.ExecuteDelete <ExamQuestion>(new SqlParam[0]);
             SortAppInfo sortAppInfo = SortBll.GetSortAppInfo("exam_question");
             if (sortAppInfo.id > 0)
             {
                 SqlParam        sqlParam = DbHelper.MakeAndWhere("appid", sortAppInfo.id);
                 List <SortInfo> sortlist = DbHelper.ExecuteList <SortInfo>(new SqlParam[]
                 {
                     sqlParam
                 });
                 SortBll.ResetSortPosts <ExamQuestion>(sortlist);
             }
             base.AddMsg("题库清空成功。");
         }
     }
 }
Exemplo n.º 25
0
 // Token: 0x06000061 RID: 97 RVA: 0x00009A40 File Offset: 0x00007C40
 protected override void View()
 {
     this.channelinfo = ChannelBll.GetChannelInfo("exam_question");
     if (this.channelinfo.id == 0)
     {
         this.ShowErr("对不起,目前系统尚未创建题目库频道。");
     }
     else if (this.ispost)
     {
         this.examinfo          = DbHelper.ExecuteModel <ExamInfo>(this.examid);
         this.examinfo.passmark = this.examinfo.passmark * this.examinfo.total / 100.0;
         this.examtopiclist     = ExamBll.GetExamTopicList(this.examid, this.paper);
         int num = 0;
         for (int i = 0; i < this.examtopiclist.Count; i++)
         {
             this.examtopiclist[i].questionlist = QuestionBll.GetTopicQuestion(this.channelinfo.id, this.examtopiclist[i]);
             string[] array = FPUtils.SplitString(this.examtopiclist[i].questionlist);
             if (this.examinfo.display == 0)
             {
                 this.examtopiclist[i].questionlist = QuestionBll.GetRandom(array, array.Length);
             }
             num += array.Length;
             this.examtopiclist[i].questions = array.Length;
         }
         this.examinfo.questions = num;
         AsposeWordApp asposeWordApp = new AsposeWordApp();
         if (this.papersize == "a4")
         {
             asposeWordApp.Open(FPUtils.GetMapPath("images\\exampaper_a4.doc"));
         }
         else
         {
             asposeWordApp.Open(FPUtils.GetMapPath("images\\exampaper_a3.doc"));
         }
         asposeWordApp.InsertText("examtitle", this.examinfo.name);
         asposeWordApp.InsertText("subtitle", this.GetPaper(this.paper));
         asposeWordApp.MoveToBookmark("content");
         DataTable  dataTable = new DataTable();
         DataColumn column    = new DataColumn("s0", Type.GetType("System.String"));
         dataTable.Columns.Add(column);
         int num2 = 1;
         foreach (ExamTopic examTopic in this.examtopiclist)
         {
             column = new DataColumn("s" + num2, Type.GetType("System.String"));
             dataTable.Columns.Add(column);
             num2++;
         }
         column = new DataColumn("s" + num2, Type.GetType("System.String"));
         dataTable.Columns.Add(column);
         DataRow dataRow = dataTable.NewRow();
         dataRow["s0"] = "题  号";
         num2          = 1;
         foreach (ExamTopic examTopic in this.examtopiclist)
         {
             dataRow["s" + num2] = this.GetNum(num2);
             num2++;
         }
         dataRow["s" + num2] = "总  分";
         dataTable.Rows.Add(dataRow);
         dataRow       = dataTable.NewRow();
         dataRow["s0"] = "得  分";
         num2          = 1;
         foreach (ExamTopic examTopic in this.examtopiclist)
         {
             dataRow["s" + num2] = "";
             num2++;
         }
         dataRow["s" + num2] = "";
         dataTable.Rows.Add(dataRow);
         asposeWordApp.InsertTable(dataTable, true);
         asposeWordApp.InsertLineBreak();
         num2 = 1;
         foreach (ExamTopic examTopic in this.examtopiclist)
         {
             asposeWordApp.InsertScoreTable(true, true, string.Concat(new object[]
             {
                 examTopic.title,
                 "  (共",
                 examTopic.questions,
                 "题,每题",
                 examTopic.perscore,
                 "分,共",
                 (double)examTopic.questions * examTopic.perscore,
                 "分)"
             }));
             foreach (ExamQuestion examQuestion in this.GetQuestionList(examTopic.questionlist))
             {
                 if (examQuestion.type == 1 || examQuestion.type == 2)
                 {
                     if (this.papertype == 1)
                     {
                         asposeWordApp.Writeln(string.Concat(new object[]
                         {
                             num2,
                             "、",
                             examQuestion.title,
                             "  ",
                             examQuestion.answer
                         }), 12.0, false, "left");
                         asposeWordApp.Writeln(this.Option(asposeWordApp, examQuestion.option, examQuestion.ascount, examQuestion.optionlist), 12.0, false, "left");
                         if (examQuestion.explain != "")
                         {
                             asposeWordApp.Writeln("答案解析:" + examQuestion.explain, 12.0, false, "left");
                         }
                     }
                     else
                     {
                         asposeWordApp.Writeln(num2 + "、" + examQuestion.title, 12.0, false, "left");
                         asposeWordApp.Writeln(this.Option(asposeWordApp, examQuestion.option, examQuestion.ascount, examQuestion.optionlist), 12.0, false, "left");
                     }
                 }
                 else if (examQuestion.type == 3)
                 {
                     if (this.papertype == 1)
                     {
                         asposeWordApp.Writeln((string.Concat(new object[]
                         {
                             num2,
                             "、",
                             examQuestion.title,
                             "  (",
                             examQuestion.answer
                         }) == "Y") ? "正确" : "错误)", 12.0, false, "left");
                         if (examQuestion.explain != "")
                         {
                             asposeWordApp.Writeln("答案解析:" + examQuestion.explain, 12.0, false, "left");
                         }
                     }
                     else
                     {
                         asposeWordApp.Writeln(string.Concat(new object[]
                         {
                             num2,
                             "、",
                             examQuestion.title,
                             "  (    )"
                         }), 12.0, false, "left");
                     }
                 }
                 else if (examQuestion.type == 4)
                 {
                     if (this.papertype == 1)
                     {
                         asposeWordApp.Writeln(num2 + "、" + this.FmAnswer(examQuestion.title), 12.0, false, "left");
                         asposeWordApp.Writeln("答案:" + examQuestion.answer, 12.0, false, "left");
                         if (examQuestion.explain != "")
                         {
                             asposeWordApp.Writeln("答案解析:" + examQuestion.explain, 12.0, false, "left");
                         }
                     }
                     else
                     {
                         asposeWordApp.Writeln(num2 + "、" + this.FmAnswer(examQuestion.title), 12.0, false, "left");
                     }
                 }
                 else if (examQuestion.type == 5)
                 {
                     if (this.papertype == 1)
                     {
                         asposeWordApp.Writeln(num2 + "、" + examQuestion.title, 12.0, false, "left");
                         asposeWordApp.Writeln("答:" + examQuestion.answer, 12.0, false, "left");
                         if (examQuestion.explain != "")
                         {
                             asposeWordApp.Writeln("答案解析:" + examQuestion.explain, 12.0, false, "left");
                         }
                     }
                     else
                     {
                         asposeWordApp.Writeln(num2 + "、" + examQuestion.title, 12.0, false, "left");
                         asposeWordApp.InsertLineBreak(6);
                     }
                 }
                 else if (examQuestion.type == 6)
                 {
                     asposeWordApp.Writeln(num2 + "、" + examQuestion.title, 12.0, false, "left");
                 }
                 num2++;
             }
         }
         if (this.papertype == 0)
         {
             asposeWordApp.InsertPagebreak();
             asposeWordApp.Writeln("参考答案", 12.0, true, "center");
             num2 = 1;
             foreach (ExamTopic examTopic in this.examtopiclist)
             {
                 asposeWordApp.InsertLineBreak();
                 asposeWordApp.Writeln(examTopic.title, 12.0, true, "left");
                 foreach (ExamQuestion examQuestion in this.GetQuestionList(examTopic.questionlist))
                 {
                     if (examQuestion.type == 3)
                     {
                         asposeWordApp.Write((num2 + "、" + examQuestion.answer == "Y") ? "正确" : "错误  ", 12.0, false, "left");
                     }
                     else if (examQuestion.type == 6)
                     {
                         asposeWordApp.Write(num2 + "、请按题目打字  ", 12.0, false, "left");
                     }
                     else
                     {
                         asposeWordApp.Write(string.Concat(new object[]
                         {
                             num2,
                             "、",
                             examQuestion.answer,
                             "  "
                         }), 12.0, false, "left");
                     }
                     num2++;
                 }
             }
         }
         asposeWordApp.Save(base.Response, this.examinfo.name + this.GetPaper(this.paper) + ".doc");
     }
 }
Exemplo n.º 26
0
 // Token: 0x060000C8 RID: 200 RVA: 0x0001373C File Offset: 0x0001193C
 protected override void View()
 {
     base.Response.Expires      = 0;
     base.Response.CacheControl = "no-cache";
     base.Response.Cache.SetNoStore();
     this.channelinfo = ChannelBll.GetChannelInfo("exam_question");
     if (this.channelinfo.id == 0)
     {
         this.ShowErr("对不起,目前系统尚未创建题目库频道。");
     }
     else
     {
         this.examinfo = DbHelper.ExecuteModel <ExamInfo>(this.examid);
         if (this.examinfo.id == 0)
         {
             this.ShowErr("对不起,该考试不存在或已被删除。");
         }
         else
         {
             if (this.examinfo.status == 0)
             {
                 if (!this.isperm && this.examinfo.uid != this.userid)
                 {
                     this.ShowErr("对不起,该考试已关闭。");
                     return;
                 }
             }
             this.sortid   = this.examinfo.sortid;
             this.sortinfo = SortBll.GetSortInfo(this.sortid);
             if (this.sortinfo.id == 0)
             {
                 SqlParam sqlParam = DbHelper.MakeAndWhere("sortid", this.sortid);
                 DbHelper.ExecuteDelete <ExamInfo>(new SqlParam[]
                 {
                     sqlParam
                 });
                 this.ShowErr("对不起,考试栏目不存在或已被删除。");
             }
             else if (this.ispost)
             {
                 if (this.examinfo.examroles != "")
                 {
                     if (!base.ischecked(this.roleid, this.examinfo.examroles) && !this.isperm)
                     {
                         this.ShowErr("对不起,您所在的角色不允许参加本场考试。");
                         return;
                     }
                 }
                 if (this.examinfo.examdeparts != "")
                 {
                     if (!base.ischecked(this.user.departid, this.examinfo.examdeparts) && !this.isperm)
                     {
                         this.ShowErr("对不起,您所在的部门不允许参加本场考试。");
                         return;
                     }
                 }
                 if (this.examinfo.examuser != "")
                 {
                     if (!base.ischecked(this.userid, this.examinfo.examuser) && !this.isperm)
                     {
                         this.ShowErr("对不起,您不允许参加本场考试。");
                         return;
                     }
                 }
                 if (this.examinfo.islimit == 1)
                 {
                     if (this.examinfo.starttime > DateTime.Now)
                     {
                         this.ShowErr("对不起,本场考试尚未到考试时间。");
                         return;
                     }
                     if (this.examinfo.endtime < DateTime.Now)
                     {
                         this.ShowErr("对不起,本场考试已超过考试期限。");
                         return;
                     }
                 }
                 SqlParam[] sqlparams = new SqlParam[]
                 {
                     DbHelper.MakeAndWhere("examid", this.examid),
                     DbHelper.MakeAndWhere("uid", this.userid),
                     DbHelper.MakeAndWhere("status", 0)
                 };
                 int num = DbHelper.ExecuteCount <ExamResult>(sqlparams);
                 if (num > 0)
                 {
                     this.ShowErr("对不起,本场考试您已经考过但尚未完成,请到考试历史那里查找。");
                 }
                 else
                 {
                     if (this.examinfo.repeats > 0)
                     {
                         SqlParam[] sqlparams2 = new SqlParam[]
                         {
                             DbHelper.MakeAndWhere("examid", this.examid),
                             DbHelper.MakeAndWhere("uid", this.userid),
                             DbHelper.MakeAndWhere("status", WhereType.GreaterThanEqual, 1)
                         };
                         num = DbHelper.ExecuteCount <ExamResult>(sqlparams2);
                         if (num >= this.examinfo.repeats)
                         {
                             this.ShowErr("对不起,本场考试限制次数为" + this.examinfo.repeats + "次,您已考完不能再考。");
                             return;
                         }
                     }
                     if (this.examinfo.credits > 0 && !this.isperm && this.examinfo.uid != this.userid)
                     {
                         if (this.user.credits < this.examinfo.credits)
                         {
                             this.ShowErr("对不起,您的积分余额不足,不能参加本场考试。");
                             return;
                         }
                         UserBll.UpdateUserCredit(this.userid, "参加考试", 0, this.examinfo.credits * -1);
                     }
                     Random           random        = new Random();
                     int              paper         = random.Next(this.examinfo.papers) + 1;
                     List <ExamTopic> examTopicList = ExamBll.GetExamTopicList(this.examid, paper);
                     int              num2          = 0;
                     for (int i = 0; i < examTopicList.Count; i++)
                     {
                         examTopicList[i].questionlist = QuestionBll.GetTopicQuestion(this.channelinfo.id, examTopicList[i]);
                         string[] array = FPUtils.SplitString(examTopicList[i].questionlist);
                         if (this.examinfo.display == 0)
                         {
                             examTopicList[i].questionlist = QuestionBll.GetRandom(array, array.Length);
                         }
                         examTopicList[i].optionlist = "";
                         foreach (ExamQuestion examQuestion in QuestionBll.GetQuestionList(examTopicList[i].questionlist))
                         {
                             if (examTopicList[i].optionlist != "")
                             {
                                 ExamTopic examTopic = examTopicList[i];
                                 examTopic.optionlist += "|";
                             }
                             if (examQuestion.type == 1 || examQuestion.type == 2)
                             {
                                 ExamTopic examTopic2 = examTopicList[i];
                                 examTopic2.optionlist += this.OptionInt(examQuestion.ascount, this.examinfo.optiondisplay);
                             }
                             else
                             {
                                 ExamTopic examTopic3 = examTopicList[i];
                                 examTopic3.optionlist += "*";
                             }
                         }
                         num2 += array.Length;
                         examTopicList[i].questions = array.Length;
                     }
                     ExamResult examResult = new ExamResult();
                     examResult.uid         = this.userid;
                     examResult.examid      = this.examid;
                     examResult.channelid   = this.channelinfo.id;
                     examResult.sortid      = this.examinfo.sortid;
                     examResult.examtype    = this.examinfo.examtype;
                     examResult.showanswer  = this.examinfo.showanswer;
                     examResult.allowdelete = this.examinfo.allowdelete;
                     examResult.examname    = this.examinfo.name;
                     examResult.examtime    = this.examinfo.examtime;
                     examResult.total       = this.examinfo.total;
                     examResult.passmark    = this.examinfo.passmark;
                     examResult.credits     = this.examinfo.credits;
                     examResult.questions   = num2;
                     examResult.islimit     = this.examinfo.islimit;
                     if (examResult.islimit == 1)
                     {
                         examResult.starttime = this.examinfo.starttime;
                         examResult.endtime   = this.examinfo.endtime;
                     }
                     else
                     {
                         examResult.starttime = DbUtils.GetDateTime();
                         examResult.endtime   = examResult.starttime.AddMinutes((double)this.examinfo.examtime);
                     }
                     examResult.examdatetime = DbUtils.GetDateTime();
                     examResult.status       = 0;
                     examResult.paper        = paper;
                     examResult.ip           = this.ip;
                     examResult.mac          = ExamConifgs.GetMacAddress(this.ip);
                     examResult.id           = DbHelper.ExecuteInsert <ExamResult>(examResult);
                     if (examResult.id > 0)
                     {
                         foreach (ExamTopic examTopic4 in examTopicList)
                         {
                             DbHelper.ExecuteInsert <ExamResultTopic>(new ExamResultTopic
                             {
                                 resultid     = examResult.id,
                                 type         = examTopic4.type,
                                 title        = examTopic4.title,
                                 perscore     = examTopic4.perscore,
                                 display      = examTopic4.display,
                                 questions    = examTopic4.questions,
                                 questionlist = examTopic4.questionlist,
                                 optionlist   = examTopic4.optionlist
                             });
                         }
                         if (this.examinfo.examdeparts == "" && this.examinfo.examuser == "" && this.examinfo.examroles == "")
                         {
                             string text = string.Format("UPDATE [{0}Exam_ExamInfo] SET [exams]=[exams]+1 WHERE [id]={1}", DbConfigs.Prefix, this.examid);
                             DbHelper.ExecuteSql(text.ToString());
                         }
                     }
                     base.Response.Redirect("exam.aspx?resultid=" + examResult.id);
                 }
             }
         }
     }
 }
Exemplo n.º 27
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();
     }
 }
Exemplo n.º 28
0
 // Token: 0x060000E2 RID: 226 RVA: 0x000161B4 File Offset: 0x000143B4
 protected override void View()
 {
     this.channelinfo = ChannelBll.GetChannelInfo("exam_question");
     if (this.channelinfo.id == 0)
     {
         this.ShowErr("对不起,目前系统尚未创建题目库频道。");
     }
     else if (this.ispost)
     {
         if (this.qidlist == "")
         {
             this.ShowErr("对不起,题目为空不能提交。");
         }
         else
         {
             List <ExamQuestion> questionList = QuestionBll.GetQuestionList(this.qidlist);
             this.examresult.uid         = this.userid;
             this.examresult.channelid   = this.channelinfo.id;
             this.examresult.examid      = 0;
             this.examresult.examtype    = 0;
             this.examresult.showanswer  = 1;
             this.examresult.allowdelete = 1;
             this.examresult.examname    = ((this.testtype == 1) ? "专项智能练习" : "快速智能练习");
             this.examresult.examtime    = FPRequest.GetInt("utime") / 60;
             this.examresult.total       = 100.0;
             this.examresult.passmark    = 60.0;
             this.examresult.credits     = 0;
             this.examresult.questions   = questionList.Count;
             this.examresult.utime       = FPRequest.GetInt("utime");
             this.examresult.starttime   = FPRequest.GetDateTime("starttime");
             this.examresult.endtime     = DbUtils.GetDateTime();
             this.examresult.status      = 1;
             this.examresult.id          = DbHelper.ExecuteInsert <ExamResult>(this.examresult);
             if (this.examresult.id > 0)
             {
                 ExamResultTopic examResultTopic = new ExamResultTopic();
                 examResultTopic.resultid     = this.examresult.id;
                 examResultTopic.type         = 0;
                 examResultTopic.title        = ((this.testtype == 1) ? "专项智能练习" : "快速智能练习");
                 examResultTopic.perscore     = Math.Round(this.examresult.total / (double)this.examresult.questions, 1);
                 examResultTopic.display      = 1;
                 examResultTopic.questions    = questionList.Count;
                 examResultTopic.questionlist = this.qidlist;
                 int num = 0;
                 foreach (ExamQuestion examQuestion in QuestionBll.GetQuestionList(examResultTopic.questionlist))
                 {
                     if (examResultTopic.optionlist != "")
                     {
                         ExamResultTopic examResultTopic2 = examResultTopic;
                         examResultTopic2.optionlist += "|";
                     }
                     if (examQuestion.type == 1 || examQuestion.type == 2)
                     {
                         ExamResultTopic examResultTopic3 = examResultTopic;
                         examResultTopic3.optionlist += this.OptionInt(examQuestion.ascount);
                     }
                     else
                     {
                         ExamResultTopic examResultTopic4 = examResultTopic;
                         examResultTopic4.optionlist += "*";
                     }
                     string text = FPRequest.GetString("answer_" + examQuestion.id);
                     if (num == 0)
                     {
                         ExamResultTopic examResultTopic5 = examResultTopic;
                         examResultTopic5.answerlist += text;
                     }
                     else
                     {
                         ExamResultTopic examResultTopic6 = examResultTopic;
                         examResultTopic6.answerlist = examResultTopic6.answerlist + "§" + text;
                     }
                     if (examResultTopic.scorelist != "")
                     {
                         ExamResultTopic examResultTopic7 = examResultTopic;
                         examResultTopic7.scorelist += "|";
                     }
                     int    num2 = 0;
                     double num3 = 0.0;
                     if (examQuestion.type <= 3)
                     {
                         if (text == examQuestion.answer && text != "")
                         {
                             num2 = examQuestion.ascount;
                             num3 = examResultTopic.perscore;
                             this.examresult.score1 += num3;
                         }
                     }
                     else if (examQuestion.type == 4)
                     {
                         string[] array;
                         if (examQuestion.upperflg == 1)
                         {
                             array = FPUtils.SplitString(examQuestion.answer, ",");
                         }
                         else
                         {
                             array = FPUtils.SplitString(examQuestion.answer.ToLower(), ",");
                         }
                         text = testpost.DelSameAnser(text);
                         string[] array2;
                         if (examQuestion.upperflg == 1)
                         {
                             array2 = FPUtils.SplitString(text, ",", array.Length);
                         }
                         else
                         {
                             array2 = FPUtils.SplitString(text.ToLower(), ",", array.Length);
                         }
                         if (examQuestion.orderflg == 1)
                         {
                             for (int i = 0; i < array2.Length; i++)
                             {
                                 if (FPUtils.InArray(array2[i], array[i], "|"))
                                 {
                                     num2++;
                                 }
                             }
                         }
                         else
                         {
                             for (int i = 0; i < array2.Length; i++)
                             {
                                 if (FPUtils.InArray(array2[i], examQuestion.answer.Replace("|", ",")))
                                 {
                                     num2++;
                                 }
                             }
                         }
                         if (num2 > 0)
                         {
                             if (examQuestion.ascount <= 0)
                             {
                                 examQuestion.ascount = 1;
                             }
                             num3 = Math.Round(examResultTopic.perscore / (double)examQuestion.ascount * (double)num2, 1);
                             this.examresult.score2 += num3;
                         }
                     }
                     else if (examQuestion.type == 5)
                     {
                         foreach (string value in FPUtils.SplitString(examQuestion.answerkey))
                         {
                             if (text.IndexOf(value) >= 0)
                             {
                                 num2++;
                             }
                         }
                         if (num2 > 0 && text != "")
                         {
                             if (examQuestion.ascount > 0)
                             {
                                 examQuestion.ascount = 1;
                             }
                             num3 = Math.Round(examResultTopic.perscore / (double)examQuestion.ascount * (double)num2, 1);
                             this.examresult.score2 += num3;
                         }
                     }
                     else if (examQuestion.type == 6)
                     {
                         for (int k = 0; k < examQuestion.title.Length; k++)
                         {
                             if (text.IndexOf(examQuestion.title.Substring(k, 1)) >= 0)
                             {
                                 num2++;
                             }
                         }
                         if (num2 > 0)
                         {
                             num3 = Math.Round(examResultTopic.perscore / (double)examQuestion.title.Length * (double)num2, 1);
                             this.examresult.score2 += num3;
                         }
                     }
                     this.examresult.score += num3;
                     examResultTopic.score += num3;
                     ExamResultTopic examResultTopic8 = examResultTopic;
                     examResultTopic8.scorelist += num3.ToString();
                     if (examResultTopic.correctlist != "")
                     {
                         ExamResultTopic examResultTopic9 = examResultTopic;
                         examResultTopic9.correctlist += "|";
                     }
                     bool flag = false;
                     if (num3 >= examResultTopic.perscore * 0.6)
                     {
                         ExamResultTopic examResultTopic10 = examResultTopic;
                         examResultTopic10.correctlist += "1";
                     }
                     else
                     {
                         ExamResultTopic examResultTopic11 = examResultTopic;
                         examResultTopic11.correctlist += "0";
                         examResultTopic.wrongs++;
                         this.examresult.wrongs++;
                         if (text == "")
                         {
                             this.examresult.unanswer++;
                         }
                         flag = true;
                     }
                     string sqlstring;
                     if (flag)
                     {
                         sqlstring = string.Format("UPDATE [{0}Exam_ExamQuestion] SET [exams]=[exams]+1,[wrongs]=[wrongs]+1 WHERE [id]={1}", DbConfigs.Prefix, examQuestion.id);
                     }
                     else
                     {
                         sqlstring = string.Format("UPDATE [{0}Exam_ExamQuestion] SET [exams]=[exams]+1 WHERE [id]={1}", DbConfigs.Prefix, examQuestion.id);
                     }
                     DbHelper.ExecuteSql(sqlstring);
                     examQuestion.useranswer = text;
                     SortInfo sortInfo = SortBll.GetSortInfo(examQuestion.sortid);
                     ExamBll.UpdateExamLog(sortInfo, this.userid, examQuestion, flag);
                     num++;
                 }
                 DbHelper.ExecuteInsert <ExamResultTopic>(examResultTopic);
                 SqlParam[] sqlparams = new SqlParam[]
                 {
                     DbHelper.MakeSet("score1", this.examresult.score1),
                     DbHelper.MakeSet("score2", this.examresult.score2),
                     DbHelper.MakeSet("score", this.examresult.score),
                     DbHelper.MakeSet("wrongs", this.examresult.wrongs),
                     DbHelper.MakeAndWhere("id", this.examresult.id)
                 };
                 DbHelper.ExecuteUpdate <ExamResult>(sqlparams);
             }
         }
     }
 }
Exemplo n.º 29
0
 // Token: 0x06000069 RID: 105 RVA: 0x0000AB4C File Offset: 0x00008D4C
 protected override void View()
 {
     this.examconfig = ExamConifgs.GetExamConfig();
     if (this.id > 0)
     {
         this.questioninfo = DbHelper.ExecuteModel <ExamQuestion>(this.id);
         this.sortid       = this.questioninfo.sortid;
         this.type         = this.questioninfo.type;
         this.ascount      = this.questioninfo.ascount;
         if (this.type == 1 || this.type == 2 || this.type == 3)
         {
             this.questioninfo.answer = this.questioninfo.answer.ToLower();
         }
     }
     this.sortinfo = SortBll.GetSortInfo(this.sortid);
     if (this.examid > 0 && this.examtopicid > 0)
     {
         this.reurl = string.Concat(new object[]
         {
             "examtopicmanage.aspx?examid=",
             this.examid,
             "&examtopicid=",
             this.examtopicid
         });
     }
     if (this.examid > 0)
     {
         this.reurl = "examtopicmanage.aspx?examid=" + this.examid;
     }
     else if (this.examtopicid > 0)
     {
         this.reurl = "examtopicselect.aspx?examtopicid=" + this.examtopicid;
     }
     else
     {
         this.reurl = string.Concat(new object[]
         {
             "questionmanage.aspx?sortid=",
             this.sortid,
             "&type=",
             this.backtype
         });
     }
     if (this.ispost)
     {
         this.questioninfo.upperflg = 0;
         this.questioninfo.orderflg = 0;
         this.questioninfo.status   = 0;
         this.questioninfo.isclear  = 0;
         this.questioninfo          = FPRequest.GetModel <ExamQuestion>(this.questioninfo);
         if (this.questioninfo.isclear == 1)
         {
             this.questioninfo.title = questionadd.GetTextFromHTML(this.questioninfo.title);
         }
         this.questioninfo.channelid = this.sortinfo.channelid;
         if (this.questioninfo.type == 1 || this.questioninfo.type == 2)
         {
             this.questioninfo.ascount = FPRequest.GetInt("ascount" + this.questioninfo.type);
             this.questioninfo.content = "";
             for (int i = 0; i < this.questioninfo.ascount; i++)
             {
                 if (this.questioninfo.content != "")
                 {
                     ExamQuestion examQuestion = this.questioninfo;
                     examQuestion.content += "§";
                 }
                 if (this.questioninfo.isclear == 1)
                 {
                     ExamQuestion examQuestion2 = this.questioninfo;
                     examQuestion2.content += questionadd.GetTextFromHTML(FPRequest.GetString(string.Concat(new object[]
                     {
                         "option",
                         this.questioninfo.type,
                         "_",
                         i.ToString()
                     })));
                 }
                 else
                 {
                     ExamQuestion examQuestion3 = this.questioninfo;
                     examQuestion3.content += FPRequest.GetString(string.Concat(new object[]
                     {
                         "option",
                         this.questioninfo.type,
                         "_",
                         i.ToString()
                     }));
                 }
             }
         }
         else if (this.questioninfo.type == 3)
         {
             this.questioninfo.ascount = 2;
             this.questioninfo.content = "";
         }
         else if (this.questioninfo.type == 4)
         {
             this.questioninfo.ascount = FPUtils.SplitString(this.questioninfo.answer).Length;
             this.questioninfo.content = "";
         }
         else if (this.questioninfo.type == 5)
         {
             this.questioninfo.ascount = FPUtils.SplitString(this.questioninfo.answerkey).Length;
             this.questioninfo.content = "";
         }
         this.questioninfo.answer = FPRequest.GetString("answer" + this.questioninfo.type);
         if (this.questioninfo.id > 0)
         {
             DbHelper.ExecuteUpdate <ExamQuestion>(this.questioninfo);
             base.AddMsg("更新试题成功!");
         }
         else
         {
             this.questioninfo.uid = this.userid;
             this.questioninfo.id  = DbHelper.ExecuteInsert <ExamQuestion>(this.questioninfo);
             SortBll.UpdateSortPosts(this.questioninfo.sortid, 1);
             if (this.examid > 0)
             {
                 ExamTopic examTopic = DbHelper.ExecuteModel <ExamTopic>(this.examtopicid);
                 if (examTopic.curquestions >= examTopic.questions)
                 {
                     this.ShowErr("该大题题目数已满,不能再添加");
                     return;
                 }
                 examTopic.questionlist = ((examTopic.questionlist == "") ? this.questioninfo.id.ToString() : (examTopic.questionlist + "," + this.questioninfo.id));
                 examTopic.curquestions = FPUtils.SplitInt(examTopic.questionlist).Length;
                 SqlParam[] sqlparams = new SqlParam[]
                 {
                     DbHelper.MakeSet("questionlist", examTopic.questionlist),
                     DbHelper.MakeSet("curquestions", examTopic.curquestions),
                     DbHelper.MakeAndWhere("id", this.examtopicid)
                 };
                 DbHelper.ExecuteUpdate <ExamTopic>(sqlparams);
             }
             base.AddMsg("添加试题成功!");
         }
         if (this.action == "continue")
         {
             this.link = string.Format("questionadd.aspx?sortid={0}&examid={1}&examtopicid={2}&type={3}", new object[]
             {
                 this.sortid,
                 this.examid,
                 this.examtopicid,
                 this.backtype
             });
         }
         else
         {
             this.link = this.reurl;
         }
         if (File.Exists(FPUtils.GetMapPath(string.Concat(new object[]
         {
             this.webpath,
             "cache/qtxt_",
             this.id,
             ".jpg"
         }))))
         {
             File.Delete(FPUtils.GetMapPath(string.Concat(new object[]
             {
                 this.webpath,
                 "cache/qtxt_",
                 this.id,
                 ".jpg"
             })));
         }
     }
     base.SaveRightURL();
 }
Exemplo n.º 30
0
 // Token: 0x060000A4 RID: 164 RVA: 0x0000F8A4 File Offset: 0x0000DAA4
 protected override void View()
 {
     if (this.ispost)
     {
         this.examresult = ExamBll.GetExamResult(this.resultid);
         if (this.examresult.id == 0)
         {
             this.ShowErr("对不起,该考试不存在或已被删除。");
         }
         else if (this.examresult.uid != this.userid)
         {
             this.ShowErr("对不起,您不是该考试的主人。");
         }
         else if (this.examresult.status == 1)
         {
             this.ShowErr("对不起,该考试已完成,不能重复提交。");
         }
         else
         {
             this.examresult.utime   = FPRequest.GetInt("utime");
             this.examresult.endtime = DbUtils.GetDateTime();
             this.examresult.status  = 1;
             if (DbHelper.ExecuteUpdate <ExamResult>(this.examresult) > 0)
             {
                 List <ExamResultTopic> examResultTopicList = ExamBll.GetExamResultTopicList(this.resultid);
                 int num = 0;
                 foreach (ExamResultTopic examResultTopic in examResultTopicList)
                 {
                     if (examResultTopic.questions == 0)
                     {
                         num++;
                     }
                     else
                     {
                         examResultTopicList[num].answerlist  = "";
                         examResultTopicList[num].scorelist   = "";
                         examResultTopicList[num].correctlist = "";
                         List <ExamQuestion> questionList = QuestionBll.GetQuestionList(examResultTopic.questionlist);
                         string[]            array        = FPUtils.SplitString(examResultTopic.optionlist, "|", questionList.Count);
                         int num2 = 0;
                         foreach (ExamQuestion examQuestion in questionList)
                         {
                             string text = FPRequest.GetString("answer_" + examQuestion.id);
                             if (num2 == 0)
                             {
                                 ExamResultTopic examResultTopic2 = examResultTopicList[num];
                                 examResultTopic2.answerlist += text;
                             }
                             else
                             {
                                 ExamResultTopic examResultTopic3 = examResultTopicList[num];
                                 examResultTopic3.answerlist = examResultTopic3.answerlist + "§" + text;
                             }
                             if (examResultTopicList[num].scorelist != "")
                             {
                                 ExamResultTopic examResultTopic4 = examResultTopicList[num];
                                 examResultTopic4.scorelist += "|";
                             }
                             examQuestion.optionlist = array[num2];
                             int    num3 = 0;
                             double num4 = 0.0;
                             if (examQuestion.type == 1 || examQuestion.type == 2)
                             {
                                 num3 = examQuestion.ascount;
                                 examQuestion.answer = this.OptionAnswer(array[num2], examQuestion.answer);
                                 if (text == examQuestion.answer && text != "")
                                 {
                                     num4 = examResultTopic.perscore;
                                 }
                                 this.examresult.score1 += num4;
                             }
                             else if (examQuestion.type == 3)
                             {
                                 num3 = examQuestion.ascount;
                                 if (text == examQuestion.answer && text != "")
                                 {
                                     num4 = examResultTopic.perscore;
                                 }
                                 this.examresult.score1 += num4;
                             }
                             else if (examQuestion.type == 4)
                             {
                                 string[] array2;
                                 if (examQuestion.upperflg == 1)
                                 {
                                     array2 = FPUtils.SplitString(examQuestion.answer, ",");
                                 }
                                 else
                                 {
                                     array2 = FPUtils.SplitString(examQuestion.answer.ToLower(), ",");
                                 }
                                 text = exampost.DelSameAnser(text);
                                 string[] array3;
                                 if (examQuestion.upperflg == 1)
                                 {
                                     array3 = FPUtils.SplitString(text, ",", array2.Length);
                                 }
                                 else
                                 {
                                     array3 = FPUtils.SplitString(text.ToLower(), ",", array2.Length);
                                 }
                                 if (examQuestion.orderflg == 1)
                                 {
                                     for (int i = 0; i < array3.Length; i++)
                                     {
                                         if (FPUtils.InArray(array3[i], array2[i], "|"))
                                         {
                                             num3++;
                                         }
                                     }
                                 }
                                 else
                                 {
                                     for (int i = 0; i < array3.Length; i++)
                                     {
                                         if (FPUtils.InArray(array3[i], examQuestion.answer.Replace("|", ",")))
                                         {
                                             num3++;
                                         }
                                     }
                                 }
                                 if (num3 > 0)
                                 {
                                     if (examQuestion.ascount <= 0)
                                     {
                                         examQuestion.ascount = 1;
                                     }
                                     num4 = Math.Round(examResultTopic.perscore / (double)examQuestion.ascount * (double)num3, 1);
                                     this.examresult.score2 += num4;
                                 }
                             }
                             else if (examQuestion.type == 5)
                             {
                                 foreach (string value in FPUtils.SplitString(examQuestion.answerkey))
                                 {
                                     if (text.IndexOf(value) >= 0)
                                     {
                                         num3++;
                                     }
                                 }
                                 if (num3 > 0 && text != "")
                                 {
                                     if (examQuestion.ascount > 0)
                                     {
                                         examQuestion.ascount = 1;
                                     }
                                     num4 = Math.Round(examResultTopic.perscore / (double)examQuestion.ascount * (double)num3, 1);
                                     this.examresult.score2 += num4;
                                 }
                             }
                             else if (examQuestion.type == 6)
                             {
                                 for (int k = 0; k < examQuestion.title.Length; k++)
                                 {
                                     if (text.IndexOf(examQuestion.title.Substring(k, 1)) >= 0)
                                     {
                                         num3++;
                                     }
                                 }
                                 if (num3 > 0)
                                 {
                                     num4 = Math.Round(examResultTopic.perscore / (double)examQuestion.title.Length * (double)num3, 1);
                                     this.examresult.score2 += num4;
                                 }
                             }
                             this.examresult.score          += num4;
                             examResultTopicList[num].score += num4;
                             ExamResultTopic examResultTopic5 = examResultTopicList[num];
                             examResultTopic5.scorelist += num4.ToString();
                             if (examResultTopicList[num].correctlist != "")
                             {
                                 ExamResultTopic examResultTopic6 = examResultTopicList[num];
                                 examResultTopic6.correctlist += "|";
                             }
                             bool flag = false;
                             if (num4 >= examResultTopic.perscore * 0.6)
                             {
                                 ExamResultTopic examResultTopic7 = examResultTopicList[num];
                                 examResultTopic7.correctlist += "1";
                             }
                             else
                             {
                                 ExamResultTopic examResultTopic8 = examResultTopicList[num];
                                 examResultTopic8.correctlist += "0";
                                 examResultTopicList[num].wrongs++;
                                 this.examresult.wrongs++;
                                 if (text == "")
                                 {
                                     this.examresult.unanswer++;
                                 }
                                 flag = true;
                             }
                             string sqlstring;
                             if (flag)
                             {
                                 sqlstring = string.Format("UPDATE [{0}Exam_ExamQuestion] SET [exams]=[exams]+1,[wrongs]=[wrongs]+1 WHERE [id]={1}", DbConfigs.Prefix, examQuestion.id);
                             }
                             else
                             {
                                 sqlstring = string.Format("UPDATE [{0}Exam_ExamQuestion] SET [exams]=[exams]+1 WHERE [id]={1}", DbConfigs.Prefix, examQuestion.id);
                             }
                             DbHelper.ExecuteSql(sqlstring);
                             examQuestion.useranswer = text;
                             SortInfo sortInfo = SortBll.GetSortInfo(examQuestion.sortid);
                             ExamBll.UpdateExamLog(sortInfo, this.userid, examQuestion, flag);
                             num2++;
                         }
                         DbHelper.ExecuteUpdate <ExamResultTopic>(examResultTopicList[num]);
                         num++;
                     }
                 }
                 this.expinfo               = ExamBll.GetExamExpByScore(this.examresult.score, this.examresult.examid);
                 this.examresult.exnote     = this.expinfo.comment;
                 this.examresult.exp        = this.expinfo.exp;
                 this.examresult.getcredits = this.expinfo.credits;
                 StringBuilder stringBuilder = new StringBuilder();
                 stringBuilder.AppendFormat("UPDATE [{0}Exam_ExamResult] SET [score1]={1},[score2]={2},[score]={3},[wrongs]={4},[exp]={5},[exnote]='{6}' WHERE [id]={7}|", new object[]
                 {
                     DbConfigs.Prefix,
                     this.examresult.score1,
                     this.examresult.score2,
                     this.examresult.score,
                     this.examresult.wrongs,
                     this.examresult.exp,
                     this.examresult.exnote,
                     this.examresult.id
                 });
                 stringBuilder.AppendFormat("UPDATE [{0}Exam_ExamInfo] SET [score]=[score]+{1} WHERE [id]={2}", DbConfigs.Prefix, this.examresult.score, this.examresult.examid);
                 this.msg = DbHelper.ExecuteSql(stringBuilder.ToString());
                 if (this.examresult.exp > 0)
                 {
                     UserBll.UpdateUserExp(this.examresult.uid, this.examresult.exp);
                 }
                 if (this.examresult.getcredits > 0)
                 {
                     UserBll.UpdateUserCredit(new CreditInfo
                     {
                         uid     = this.examresult.uid,
                         name    = "考试奖励积分",
                         type    = 0,
                         credits = this.examresult.getcredits,
                         doid    = this.userid,
                         doname  = this.username
                     });
                 }
                 if (this.msg != "")
                 {
                     this.ShowErr(this.msg);
                 }
             }
         }
     }
 }