Song.Site/Mobile/QuesNoteAdd.ashx.cs

(开头部分) 2KB

这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using WeiSha.Common;
using Song.ServiceInterfaces;
using VTemplate.Engine;

namespace Song.Site.Mobile
{
    /// <summary>
    /// 添加笔记
    /// </summary>
    public class QuesNoteAdd : BasePage
    {
        int qid = WeiSha.Common.Request.QueryString["qid"].Int32 ?? 0;  //试题id
        int stnid = WeiSha.Common.Request.QueryString["stnid"].Int32 ?? 0;   //笔记id
        protected override void InitPageTemplate(HttpContext context)
        {
            //如果没有提交
            if (Request.ServerVariables["REQUEST_METHOD"] == "GET")
            {               
                Song.Entities.Student_Notes note=null;
                note = Business.Do<IStudent>().NotesSingle(stnid);
                if (note == null && qid > 0 && Extend.LoginState.Accounts.IsLogin)
                {
                    Song.Entities.Accounts st = Extend.LoginState.Accounts.CurrentUser;
                    note = Business.Do<IStudent>().NotesSingle(qid, st.Ac_ID);
                }
                this.Document.SetValue("note", note);
                return;
            }

            if (Request.ServerVariables["REQUEST_METHOD"] == "POST")
            {
                if (!Extend.LoginState.Accounts.IsLogin) return;
                //提交的信息
                string tbNote = WeiSha.Common.Request.Form["tbNote"].String;                
                Song.Entities.Accounts st = Extend.LoginState.Accounts.CurrentUser;
                Song.Entities.Student_Notes note = null;
                note = Business.Do<IStudent>().NotesSingle(stnid);
                //如果笔记id取不到记录,用试题id取
                if (note == null && qid > 0)
                    note = Business.Do<IStudent>().NotesSingle(qid, st.Ac_ID);
                //如果提交信息为空,则为删除
                if (string.IsNullOrWhiteSpace(tbNote))
                {
                    if(note!=null)
                        Business.Do<IStudent>().NotesDelete(note.Stn_ID);
                    return;
                }
                Song.Entities.Student_Notes sn = note != null ? note : new Entities.Student_Notes();
                sn.Stn_Context = tbNote;
                sn.Qus_ID = qid;
                sn.Ac_ID = st.Ac_ID;
                sn.Org_ID = this.Organ.Org_ID;
                try
                {
                    if (stnid > 0)
                        Business.Do<IStudent>().NotesSave(sn);
后面还有 12 行代码,解锁后查看完整代码

24 小时内免费解锁 3 个项目,之后 1 积分/个。 规则说明

AI 解读

登录后可用,每次 10 积分,解读结果公开显示在下面。

还没有人解读过这个文件。