Ejemplo n.º 1
0
 protected void Button1_Click(object sender, EventArgs e)
 {
     if (txtNotifyTitle.Text.Trim().Length != 0)
     {
         UserCookiesInfo UserCookiesInfo = BllOperationAboutUser.GetUserCookiesInfo();
         CoursesNotifyInfo CoursesNotifyInfo1 = new CoursesNotifyInfo
         {
             courseNotifyInfoId = courseNotifyId,
             courseNo = Request["courseNo"].ToString().Trim(),
             classID = Server.UrlDecode(Request["classId"].Trim()),
             termTag = Request["termtag"].Trim(),
             courseNotifyInfoTitle = CommonUtility.JavascriptStringFilter(txtNotifyTitle.Text),
             courseNotifyInfoContent = Textarea1.Value,
             isTop = 0,
             notifyType = 0,//默认是通知类型
             publishUserNo = UserCookiesInfo.userName,
             updateTime = DateTime.Now,
             attachmentIds = hidAttachmentId.Value
         };
         DalOperationAboutCourseNotifyInfo DalOperationAboutCourseNotifyInfo = new DalOperationAboutCourseNotifyInfo();
         DalOperationAboutCourseNotifyInfo.UpdateCourseNotifyInfo(CoursesNotifyInfo1);
         Javascript.RefreshParentWindow("修改成功!", "CInfoCourseNotify.aspx?page="+pageIndex+"&courseNo=" + CoursesNotifyInfo1.courseNo+"&classID="+Server.UrlEncode(Server.UrlDecode(Request["classID"])), Page);
     }
     else { Javascript.Alert("标题不能为空!", Page); }
 }
Ejemplo n.º 2
0
    protected void btnNotifyAdd_Click(object sender, EventArgs e)
    {
        if (txtNotifyTitle.Text.Trim().Length != 0)
        {

            UserCookiesInfo UserCookiesInfo = BllOperationAboutUser.GetUserCookiesInfo();
            CoursesNotifyInfo CoursesNotifyInfo = new CoursesNotifyInfo
            {
                courseNo = Request["courseNo"],
                termTag = Request["termtag"],
                classID = Server.UrlDecode(Request["classID"]),
                courseNotifyInfoTitle = CommonUtility.JavascriptStringFilter(txtNotifyTitle.Text),
                courseNotifyInfoContent = Textarea1.Value,
                isTop = 0,
                notifyType = 0,//通知与作业已分开,这里为了不为空,默认存值为0
                publishUserNo = UserCookiesInfo.userName,
                updateTime = DateTime.Now,
                attachmentIds = hidAttachmentId.Value
            };
            DalOperationAboutCourseNotifyInfo DalOperationAboutCourseNotifyInfo = new DalOperationAboutCourseNotifyInfo();
            DalOperationAboutCourseNotifyInfo.InsertCourseNotifyInfo(CoursesNotifyInfo);
            Javascript.RefreshParentWindow("添加成功!", "CInfoCourseNotify.aspx?courseNo=" + CoursesNotifyInfo.courseNo + "&classID=" + Server.UrlEncode(Server.UrlDecode(Request["classID"].ToString().Trim())) + "&termtag=" + Request["termtag"].Trim(), Page);
        }
        else
        {
            Javascript.Alert("请提交标题!", Page);
        }
    }
Ejemplo n.º 3
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!CommonUtility.SafeCheckByParams<string>(Request["courseNotifyId"], ref courseNotifyId))
        {
            Javascript.GoHistory(-1, Page);
            return;
        }
        if (!IsPostBack)
        {
            DalOperationAboutCourseNotifyInfo DalOperationAboutCourseNotifyInfo = new DalOperationAboutCourseNotifyInfo();
            CoursesNotifyInfo = DalOperationAboutCourseNotifyInfo.GetCourseNotifyInfoById(courseNotifyId);
            txtNotifyTitle.Text = CoursesNotifyInfo.courseNotifyInfoTitle;
            Textarea1.Value = CoursesNotifyInfo.courseNotifyInfoContent;

            hidAttachmentId.Value = CoursesNotifyInfo.attachmentIds;
            if (CoursesNotifyInfo.attachmentIds.Length > 0)
            {
                DalOperationAttachments dalOperationAttachments = new DalOperationAttachments();
                ltlAttachment.Text = dalOperationAttachments.GetAttachmentsList(CoursesNotifyInfo.attachmentIds, ref iframeCount, true, string.Empty);
            }

        }
    }
        /// <summary>
        /// 更新课程通知
        /// </summary>
        /// <param name="coursesNotifyInfo">课程通知实体</param>
        public void UpdateCourseNotifyInfo(CoursesNotifyInfo coursesNotifyInfo)
        {
            try
            {
                string commandString = " UPDATE [USTA].[dbo].[usta_CoursesNotifyInfo] SET [courseNotifyInfoTitle] = @courseNotifyInfoTitle,[courseNotifyInfoContent] = @courseNotifyInfoContent  ,[updateTime] = @updateTime ,[publishUserNo] = @publishUserNo ,[notifyType] = @notifyType ,[attachmentIds] = @attachmentIds  WHERE courseNotifyInfoId=@courseNotifyInfoId";

                SqlParameter[] parameters = {
                    new SqlParameter("@courseNotifyInfoId", SqlDbType.Int,4),
                    new SqlParameter("@courseNotifyInfoTitle", SqlDbType.NChar,50),
                    new SqlParameter("@courseNotifyInfoContent", SqlDbType.NText),
                    new SqlParameter("@updateTime", SqlDbType.DateTime),
                    new SqlParameter("@publishUserNo", SqlDbType.NChar,20),
                    new SqlParameter("@notifyType", SqlDbType.SmallInt,2),

                    new SqlParameter("@attachmentIds", SqlDbType.NVarChar,200),
                    new SqlParameter("@classId",SqlDbType.NVarChar,50),
                    new SqlParameter("@termtag",SqlDbType.NVarChar,50)
                    };
                parameters[0].Value = coursesNotifyInfo.courseNotifyInfoId;
                parameters[1].Value = coursesNotifyInfo.courseNotifyInfoTitle;
                parameters[2].Value = coursesNotifyInfo.courseNotifyInfoContent;
                parameters[3].Value = coursesNotifyInfo.updateTime;
                parameters[4].Value = coursesNotifyInfo.publishUserNo;
                parameters[5].Value = coursesNotifyInfo.notifyType;

                parameters[6].Value = coursesNotifyInfo.attachmentIds;
                parameters[7].Value = coursesNotifyInfo.classID;
                parameters[8].Value = coursesNotifyInfo.termTag;

                SqlHelper.ExecuteNonQuery(conn, CommandType.Text, commandString, parameters);
            }
            catch (Exception ex)
            {
               MongoDBLog.LogRecord(ex);
                CommonUtility.RedirectUrl();
            }
            finally
            {
                conn.Close();
            }
        }
        /// <summary>
        /// 添加一项课程通知
        /// </summary>
        /// <param name="coursesNotifyInfo">课程通知实体</param>
        public void InsertCourseNotifyInfo(CoursesNotifyInfo coursesNotifyInfo)
        {
            try
            {
                string commandString = "INSERT INTO [USTA].[dbo].[usta_CoursesNotifyInfo]([courseNotifyInfoTitle],[courseNotifyInfoContent],[publishUserNo],[notifyType],[courseNo] ,[attachmentIds],classID,termTag) VALUES (@courseNotifyInfoTitle ,@courseNotifyInfoContent ,@publishUserNo ,@notifyType,@courseNo ,@attachmentIds,@classId,@termtag)";

                SqlParameter[] parameters = {
                    new SqlParameter("@courseNotifyInfoTitle", SqlDbType.NChar,50),
                    new SqlParameter("@courseNotifyInfoContent", SqlDbType.NText),

                    new SqlParameter("@publishUserNo", SqlDbType.NChar,20),
                    new SqlParameter("@notifyType", SqlDbType.SmallInt,2),
                    new SqlParameter("@courseNo", SqlDbType.NChar,20),
                    new SqlParameter("@attachmentIds", SqlDbType.NVarChar,200),
                    new SqlParameter("@classId", SqlDbType.NVarChar,50),
                    new SqlParameter("@termtag", SqlDbType.NVarChar,50)};
                parameters[0].Value = coursesNotifyInfo.courseNotifyInfoTitle;
                parameters[1].Value = coursesNotifyInfo.courseNotifyInfoContent;

                parameters[2].Value = coursesNotifyInfo.publishUserNo;
                parameters[3].Value = coursesNotifyInfo.notifyType;
                parameters[4].Value = coursesNotifyInfo.courseNo;
                parameters[5].Value = coursesNotifyInfo.attachmentIds;
                parameters[6].Value = coursesNotifyInfo.classID;
                parameters[7].Value = coursesNotifyInfo.termTag;
                SqlHelper.ExecuteNonQuery(conn, CommandType.Text, commandString, parameters);
            }
            catch (Exception ex)
            {
               MongoDBLog.LogRecord(ex);
                CommonUtility.RedirectUrl();
            }
            finally
            {
                conn.Close();
            }
        }
 /// <summary>
 /// 通过课程通知的主键来查找某个通知
 /// </summary>
 /// <param name="courseNotifyInfoId">课程通知编号</param>
 /// <returns>课程通知对象</returns>
 public CoursesNotifyInfo GetCourseNotifyInfoById(int courseNotifyInfoId)
 {
     CoursesNotifyInfo CoursesNotifyInfo=null;
     string commandString = "SELECT [courseNotifyInfoId],[courseNotifyInfoTitle] ,[courseNotifyInfoContent] ,[updateTime] ,[publishUserNo]  ,[notifyType]  ,[courseNo]  ,[attachmentIds],[scanCount] FROM [USTA].[dbo].[usta_CoursesNotifyInfo] WHERE courseNotifyInfoId=@courseNotifyInfoId";
     SqlParameter[] parameters = new SqlParameter[1]{new SqlParameter("@courseNotifyInfoId",courseNotifyInfoId)
     };
     SqlDataReader dr = SqlHelper.ExecuteReader(conn,CommandType.Text,commandString,parameters);
     while(dr.Read())
     {
         CoursesNotifyInfo = new CoursesNotifyInfo
         {
             courseNotifyInfoId = int.Parse(dr["courseNotifyInfoId"].ToString()),
             courseNotifyInfoTitle = dr["courseNotifyInfoTitle"].ToString().Trim(),
             courseNotifyInfoContent = dr["courseNotifyInfoContent"].ToString().Trim(),
             updateTime = Convert.ToDateTime(dr["updateTime"].ToString()),
             publishUserNo = dr["publishUserNo"].ToString().Trim(),
             notifyType = int.Parse(dr["notifyType"].ToString()),
             courseNo = dr["courseNo"].ToString().Trim(),
             attachmentIds = dr["attachmentIds"].ToString(),
             scanCount = int.Parse(dr["scanCount"].ToString())
         };
     }
     dr.Close();
     conn.Close();
     return CoursesNotifyInfo;
 }
Ejemplo n.º 7
0
        /// <summary>
        /// 查询课程通知
        /// </summary>
        /// <param name="courseNotifyInfoId">课程通知编号</param>
        /// <returns>课程通知实体</returns>
        public CoursesNotifyInfo FindCourseNotifyById(int courseNotifyInfoId)
        {
            CoursesNotifyInfo coursesNotify = null;
            try
            {
                string sql = "SELECT courseNotifyInfoId,courseNotifyInfoTitle,courseNotifyInfoContent,updateTime,publishUserNo,courseNo,isTop,attachmentIds,notifyType,scanCount FROM usta_CoursesNotifyInfo  WHERE courseNotifyInfoId=@courseNotifyInfoId";
                SqlParameter[] parameters = new SqlParameter[1]{
                 new SqlParameter("@courseNotifyInfoId",courseNotifyInfoId)};

                SqlDataReader dr = SqlHelper.ExecuteReader(conn, CommandType.Text, sql, parameters);
                while (dr.Read())
                {
                    coursesNotify = new CoursesNotifyInfo
                    {
                        courseNotifyInfoId = int.Parse(dr["courseNotifyInfoId"].ToString()),
                        courseNotifyInfoTitle = dr["courseNotifyInfoTitle"].ToString().Trim(),
                        publishUserNo = dr["publishUserNo"].ToString().Trim(),
                        updateTime = Convert.ToDateTime(dr["updateTime"].ToString()),
                        courseNo = dr["courseNo"].ToString(),
                        isTop = int.Parse(dr["isTop"].ToString()),
                        notifyType = int.Parse(dr["notifyType"].ToString()),
                        attachmentIds = dr["attachmentIds"].ToString(),
                        courseNotifyInfoContent = dr["courseNotifyInfoContent"].ToString(),
                        scanCount = int.Parse(dr["scanCount"].ToString())
                    };
                }

            }
            catch (Exception ex)
            {
                MongoDBLog.LogRecord(ex);
                CommonUtility.RedirectUrl();
            }
            finally
            {
                conn.Close();
            }
            return coursesNotify;
        }