Exemple #1
0
 //竞赛登录模块
 public void OCLogin(int page, int OCid)
 {
     if (Convert.ToInt32(Session["Login"]) == 1)
     {
         Response.Write(JsHelper.Jump("Home", "OnlineCP?id=" + OCid));
     }
     else
     {
         Response.Write(JsHelper.Messagebox("请先登录!", "OnlineCon?page=" + page));
     }
 }
Exemple #2
0
        //搜索功能
        public void Search(string mysearch)
        {
            SetSessionAndCookie();
            string regex  = @"^-?\d+\.?\d*$";
            bool   result = Regex.IsMatch(mysearch, regex);

            if (result)
            {
                int     id  = Convert.ToInt32(mysearch);
                Problem pro = entity.Problem.Where(p => p.ID == id).FirstOrDefault();
                if (pro != null)
                {
                    Response.Write(JsHelper.Jump("Home", "Problem?id=" + id));
                }
                else
                {
                    Response.Write(JsHelper.mygoback("没有此题"));
                }
            }
            else
            {
                Problem        mypro   = null;
                List <Problem> prolist = entity.Problem.OrderBy(p => p.ID).ToList();
                foreach (Problem p in prolist)
                {
                    if (p.Name.Equals(mysearch))
                    {
                        mypro = p;
                        break;
                    }
                    else if (p.Describe.Contains(mysearch))
                    {
                        mypro = p;
                        break;
                    }
                }
                if (mypro == null)
                {
                    Response.Write(JsHelper.mygoback("没有此题"));
                }
                else
                {
                    Response.Write(JsHelper.Jump("Home", "Problem?id=" + mypro.ID));
                }
            }
            //Response.Write(JsHelper.Jump("Home", "Index"));
        }
Exemple #3
0
        //回复处理模块
        public void AnswerDiscuss(FormCollection col)
        {
            SetSessionAndCookie();
            string discussid = col["Discussid"];
            string answerid  = col["Answerid"];
            string answerdis = col["Answer"];
            Answer answer    = new Answer();

            answer.UserID     = Convert.ToInt32(answerid);
            answer.DiscussID  = Convert.ToInt32(discussid);
            answer.AnswerTime = DateTime.Now;
            answer.Content    = answerdis;
            entity.Answer.Add(answer);
            entity.SaveChanges();

            int disid = Convert.ToInt32(Session["DiscussID"]);
            int page  = Convert.ToInt32(Session["AnswerListPage"]);

            Response.Write(JsHelper.Jump("Home", "AnswerList?id=" + disid + "&page=" + page));
        }
Exemple #4
0
        //添加问题讨论模块
        public void DisucssSubmit(FormCollection col)
        {
            SetSessionAndCookie();
            int    id       = Convert.ToInt32(Session["UId"]);
            string title    = col["title"];
            string describe = col["describe"];

            Discuss discuss = new Discuss();

            discuss.UserID             = id;
            discuss.QuestionTime       = DateTime.Now;
            discuss.Title              = title;
            discuss.ProblemDescription = describe;
            entity.Discuss.Add(discuss);
            entity.SaveChanges();

            Session["DiscussID"] = discuss.ID;
            int disid = discuss.ID;

            Response.Write(JsHelper.Jump("Home", "AnswerList?id=" + disid));
        }