private void SetClassroomIsShow() { int id = RequestHelper.GetFormInt("id"); BLL.classroom_info bll = new BLL.classroom_info(); Model.classroom_info model = bll.GetModel(id); if (model != null) { if (model.is_show == (int)EnumCollection.course_is_show.是) { model.is_show = (int)EnumCollection.course_is_show.否; } else { model.is_show = (int)EnumCollection.course_is_show.是; } bll.Update(model); HttpContext.Current.Response.Write("1"); HttpContext.Current.Response.End(); } else { HttpContext.Current.Response.Write("0"); HttpContext.Current.Response.End(); } }
protected void Page_Load(object sender, EventArgs e) { this.class_id = RequestHelper.GetQueryInt("class_id", 0); this.adminInfo = GetAdminInfo(); if (this.adminInfo == null) { JscriptMsg("登录超时,请重新登录", "/admin/login.aspx"); return; } Model.classroom_info ciModel = new BLL.classroom_info().GetModel(this.class_id); if (ciModel == null) { JscriptMsg("没有此课堂", "back"); return; } else { this.lblName.Text = ciModel.name; } if (!Page.IsPostBack) { ChkAdminLevel("_classroom_chapter", EnumCollection.ActionEnum.View.ToString()); //检查权限 BindData(); } }
//保存 protected void btnSubmit_Click(object sender, EventArgs e) { ChkAdminLevel("_ybd_classroom_info", EnumCollection.ActionEnum.Modify.ToString()); //检查权限 BLL.classroom_info bll = new BLL.classroom_info(); Model.classroom_info model = bll.GetModel(this.id); model.name = Convert.ToString(txtname.Text); model.avatar = Convert.ToString(txtavatar.Text); model.user_id = Convert.ToInt32(txtuser_id.Text); model.user_name = Convert.ToString(txtuser_name.Text); model.info = Convert.ToString(txtinfo.Text); model.qrcode = Convert.ToString(txtqrcode.Text); model.is_show = Convert.ToInt32(txtis_show.Text); model.add_time = Convert.ToDateTime(txtadd_time.Text); if (bll.Update(model)) { AddAdminLog(EnumCollection.ActionEnum.Modify.ToString(), "修改课堂信息信息,主键:" + id); //记录日志 JscriptMsg("修改课堂信息信息成功!", "Manage.aspx"); } else { JscriptMsg("保存过程中发生错误!", ""); } }
protected Model.sys_manager admin_info; //管理员信息 protected void Page_Load(object sender, EventArgs e) { admin_info = GetAdminInfo(); this.action = RequestHelper.GetQueryString("action"); this.class_id = RequestHelper.GetQueryInt("class_id"); if (this.class_id > 0) { Model.classroom_info model = new BLL.classroom_info().GetModel(this.class_id); if (model == null) { JscriptMsg("没有此课堂!", "back"); return; } else { this.classroom_name = model.name; } } if (!Page.IsPostBack) { ChkAdminLevel("_classroom_video_materials", EnumCollection.ActionEnum.View.ToString()); //检查权限 this.txtpath.Attributes.Add("readonly", "true"); } }
private void BindData() { #region 组装查询条件 string whereStr = " group_id = " + (int)EnumCollection.examination_group.课堂作业 + " and parent_id = " + this.chapter; //string whereStr = " 1 = 1 "; string _keywords = keywords.Replace("'", ""); if (!string.IsNullOrEmpty(_keywords)) { if (Utils.IsSafeSqlString(_keywords)) { whereStr += " and (name like '%" + _keywords + "%')"; } else { JscriptMsg("搜索关键词中包含危险字符,检索终止!", Utils.CombUrlTxt("work_list.aspx", "keywords={0}", "")); return; } } //if (this.chapter > 0) //{ // whereStr += " parent_id = " + this.chapter; //} #endregion Model.course_chapter ccModel = new BLL.course_chapter().GetModel(chapter); if (ccModel != null) { chapter_name = ccModel.name; Model.classroom_info ciModel = new BLL.classroom_info().GetModel(ccModel.course_id); if (ciModel != null) { class_name = ciModel.name; } else { JscriptMsg("传递参数错误", "back"); return; } } else { JscriptMsg("传递参数错误", "back"); return; } this.page = RequestHelper.GetQueryInt("page", 1); txtKeywords.Text = this.keywords; BLL.common_examination bll = new BLL.common_examination(); this.rptList.DataSource = bll.GetListByPage(whereStr, "ID DESC", this.page, this.pageSize); this.rptList.DataBind(); this.totalCount = bll.GetRecordCount(whereStr); //绑定页码 txtPageNum.Text = this.pageSize.ToString(); string pageUrl = Utils.CombUrlTxt("work_list.aspx", "keywords={0}&page={1}&chapter={2}", this.keywords, "__id__", this.chapter + ""); PageContent.InnerHtml = Utils.OutPageList(this.pageSize, this.page, this.totalCount, pageUrl, 8); }
//批量删除 protected void btnDelete_Click(object sender, EventArgs e) { ChkAdminLevel("_classroom_list", EnumCollection.ActionEnum.Delete.ToString()); //检查权限 int sucCount = 0; int errorCount = 0; BLL.classroom_info bll = new BLL.classroom_info(); for (int i = 0; i < rptList.Items.Count; i++) { int id = Convert.ToInt32(((HiddenField)rptList.Items[i].FindControl("hidId")).Value); CheckBox cb = (CheckBox)rptList.Items[i].FindControl("chkId"); if (cb.Checked) { if (bll.Delete(id)) { sucCount += 1; } else { errorCount += 1; } } } AddAdminLog(EnumCollection.ActionEnum.Delete.ToString(), "删除课堂信息" + sucCount + "条,失败" + errorCount + "条"); //记录日志 JscriptMsg("删除成功" + sucCount + "条,失败" + errorCount + "条!", Utils.CombUrlTxt("classroom_list.aspx", "keywords={0}", this.keywords)); }
private void BindData() { #region 组装查询条件 string whereStr = " 1 = 1 "; string _keywords = keywords.Replace("'", ""); if (!string.IsNullOrEmpty(_keywords)) { if (Utils.IsSafeSqlString(_keywords)) { whereStr += " and (Title like '%" + _keywords + "%')"; } else { JscriptMsg("搜索关键词中包含危险字符,检索终止!", Utils.CombUrlTxt("Manage.aspx", "keywords={0}", "")); return; } } #endregion this.page = RequestHelper.GetQueryInt("page", 1); txtKeywords.Text = this.keywords; BLL.classroom_info bll = new BLL.classroom_info(); this.rptList.DataSource = bll.GetListByPage(whereStr, "ID DESC", this.page, this.pageSize); this.rptList.DataBind(); this.totalCount = bll.GetRecordCount(whereStr); //绑定页码 txtPageNum.Text = this.pageSize.ToString(); string pageUrl = Utils.CombUrlTxt("Manage.aspx", "keywords={0}&page={1}", this.keywords, "__id__"); PageContent.InnerHtml = Utils.OutPageList(this.pageSize, this.page, this.totalCount, pageUrl, 8); }
private void BindData() { string whereStr = " group_id = " + (int)EnumCollection.chapter_group.课堂 + " and course_id = " + class_id; BLL.classroom_info bll = new BLL.classroom_info(); this.rptList.DataSource = bll.GetListNew(whereStr, "0"); this.rptList.DataBind(); }
protected string GetClassRoomName(int id) { Model.classroom_info model = new BLL.classroom_info().GetModel(id); if (model != null) { return(model.name); } return(""); }
protected string ReturnClassroomName(int id) { Model.course_chapter chapter = new BLL.course_chapter().GetModel(id); if (chapter != null) { Model.classroom_info classroom = new BLL.classroom_info().GetModel(chapter.course_id); if (classroom != null) { return(classroom.name); } } return(""); }
protected void Page_Load(object sender, EventArgs e) { this.action = RequestHelper.GetQueryString("action"); this.id = RequestHelper.GetQueryInt("id"); this.chapter = RequestHelper.GetQueryInt("chapter"); if (this.id > 0) { if (!new BLL.common_examination().Exists(this.id)) { JscriptMsg("记录不存在或已被删除!", "back"); return; } } if (this.chapter > 0) { Model.course_chapter model = new BLL.course_chapter().GetModel(this.chapter); if (model == null) { JscriptMsg("没有此章节!", "back"); return; } else { this.lblChapterName.Text = model.name; Model.classroom_info ciModel = new BLL.classroom_info().GetModel(model.course_id); if (ciModel != null) { this.lblClassName.Text = ciModel.name; } else { JscriptMsg("没有此课堂!", "back"); return; } } } if (!Page.IsPostBack) { ChkAdminLevel("_classroom_work_materials", EnumCollection.ActionEnum.View.ToString()); //检查权限 if (action == EnumCollection.ActionEnum.Modify.ToString()) //修改 { addRow = this.id; ShowInfo(this.id); } } }
private void Bind() { string where = ""; if (adminInfo.role_type == 2)//课堂教师 { Model.user_info user = new BLL.user_info().GetModel(" phone = '" + adminInfo.user_name + "' "); where += " user_id = " + user.id; } DataTable dt = new BLL.classroom_info().GetList(where); this.ddlClass.DataSource = dt; this.ddlClass.DataTextField = "name"; this.ddlClass.DataValueField = "id"; this.ddlClass.DataBind(); }
private void BindInfo() { BLL.classroom_info bll = new BLL.classroom_info(); Model.classroom_info model = bll.GetModel(this.id); if (model == null) { JscriptMsg("信息不存在或已被删除!", "back"); return; } txtname.Text = model.name + ""; txtavatar.Text = model.avatar + ""; txtuser_id.Text = model.user_id + ""; txtuser_name.Text = model.user_name + ""; txtinfo.Text = model.info + ""; txtqrcode.Text = model.qrcode + ""; txtis_show.Text = model.is_show + ""; txtadd_time.Text = model.add_time + ""; }
private void BindData() { #region 组装查询条件 string whereStr = " 1 = 1 "; string _keywords = keywords.Replace("'", ""); if (!string.IsNullOrEmpty(_keywords)) { if (Utils.IsSafeSqlString(_keywords)) { whereStr += " and (name like '%" + _keywords + "%')"; } else { JscriptMsg("搜索关键词中包含危险字符,检索终止!", Utils.CombUrlTxt("classroom_list.aspx", "keywords={0}", "")); return; } } if (this.adminInfo.role_type == 2) { Model.user_info user = new BLL.user_info().GetModel(" phone = '" + this.adminInfo.user_name + "' "); if (user == null) { JscriptMsg("此用户没有创建课堂,请确认后重新登录", "/admin/login.aspx"); return; } whereStr += " and user_id = " + user.id; } #endregion this.page = RequestHelper.GetQueryInt("page", 1); txtKeywords.Text = this.keywords; BLL.classroom_info bll = new BLL.classroom_info(); this.rptList.DataSource = bll.GetListByPage(whereStr, "ID DESC", this.page, this.pageSize); this.rptList.DataBind(); this.totalCount = bll.GetRecordCount(whereStr); //绑定页码 txtPageNum.Text = this.pageSize.ToString(); string pageUrl = Utils.CombUrlTxt("classroom_list.aspx", "keywords={0}&page={1}", this.keywords, "__id__"); PageContent.InnerHtml = Utils.OutPageList(this.pageSize, this.page, this.totalCount, pageUrl, 8); }
private bool DoAdd() { Model.common_article model = new Model.common_article(); BLL.common_article bll = new BLL.common_article(); model.group_id = (int)EnumCollection.article_group.课堂公告; if (adminInfo.role_type == 2)//教师 { Model.user_info user = new BLL.user_info().GetModel(" phone = '" + adminInfo.user_name + "' "); model.user_id = user.id; } else if (adminInfo.role_type == 1)//超管 { Model.classroom_info ciModel = new BLL.classroom_info().GetModel(this.class_id); if (ciModel != null) { model.user_id = ciModel.user_id; } } model.category_id = Convert.ToInt32(ddlClassroom.SelectedValue); //model.category_id = this.class_id; model.title = Convert.ToString(txttitle.Text); model.subtitle = ""; model.contents = Convert.ToString(txtcontents.Text); model.img_src = Convert.ToString(txtimg_src.Text); model.click = 0; model.upvote = 0; model.status = 1; model.add_time = System.DateTime.Now; int id = bll.Add(model); if (id > 0) { AddAdminLog(EnumCollection.ActionEnum.Add.ToString(), "添加课堂公告信息,主键:" + id); //记录日志 return(true); } else { return(false); } }
private void BindData() { string whereStr = " 1 = 1 "; if (this.class_id > 0) { this.ddlClass.SelectedValue = this.class_id + ""; } else { class_id = Convert.ToInt32(this.ddlClass.SelectedValue); } whereStr += " and group_id = " + (int)EnumCollection.chapter_group.课堂 + " and course_id = " + class_id + " and chapter_level = 1 "; BLL.classroom_info bll = new BLL.classroom_info(); this.rptList.DataSource = bll.GetListNew(whereStr, "0"); this.rptList.DataBind(); }
protected Model.sys_manager admin_info; //管理员信息 protected void Page_Load(object sender, EventArgs e) { admin_info = GetAdminInfo(); this.action = RequestHelper.GetQueryString("action"); this.id = RequestHelper.GetQueryInt("id"); this.class_id = RequestHelper.GetQueryInt("class_id"); this.page = RequestHelper.GetQueryInt("page", 1); if (this.id > 0) { if (!new BLL.common_resource().Exists(this.id)) { JscriptMsg("记录不存在或已被删除!", "back"); return; } } if (this.class_id > 0) { Model.classroom_info model = new BLL.classroom_info().GetModel(this.class_id); if (model == null) { JscriptMsg("没有此课堂!", "back"); return; } else { this.user_id = model.user_id; this.classroom_name = model.name; } } if (!Page.IsPostBack) { ChkAdminLevel("_classroom_file_materials", EnumCollection.ActionEnum.View.ToString()); //检查权限 this.txtpath.Attributes.Add("readonly", "true"); if (action == EnumCollection.ActionEnum.Modify.ToString()) //修改 { ShowInfo(this.id); } } }
private void BindData() { BLL.course_chapter ccBll = new BLL.course_chapter(); Model.course_chapter chapter = ccBll.GetModel(this.chapter); if (chapter == null) { JscriptMsg("没有此节", "back"); return; } this.chapter_name = chapter.name; Model.course_chapter pModel = ccBll.GetModel(chapter.parent_id); if (pModel == null) { JscriptMsg("没有此章", "back"); return; } this.parent_name = pModel.name; Model.classroom_info ciModel = new BLL.classroom_info().GetModel(pModel.course_id); if (ciModel == null) { JscriptMsg("没有此课堂", "back"); return; } this.class_name = ciModel.name; Model.user_info user = new BLL.user_info().GetModel(" phone = '" + adminInfo.user_name + "' "); if (user == null) { JscriptMsg("没有此教师", "back"); return; } if (ciModel.user_id != user.id) { JscriptMsg("此课堂不属于你", "back"); return; } Model.common_examination exaModel = new BLL.common_examination().GetModel(this.exa_id); if (exaModel == null) { JscriptMsg("没有此作业", "back"); return; } this.examination = exaModel.name; #region 组装查询条件 string whereStr = " 1 = 1 "; DataTable dtids = new BLL.examination_question().GetList(" exa_id = " + this.exa_id); string ids = string.Empty; foreach (DataRow item in dtids.Rows) { ids += Convert.ToInt32(item["q_id"]) + ","; } ids = Utils.DelLastComma(ids); if (!string.IsNullOrEmpty(ids)) { whereStr += " and id in (" + ids + ") "; } string _keywords = keywords.Replace("'", ""); if (!string.IsNullOrEmpty(_keywords)) { if (Utils.IsSafeSqlString(_keywords)) { whereStr += " and (Title like '%" + _keywords + "%')"; } else { JscriptMsg("搜索关键词中包含危险字符,检索终止!", Utils.CombUrlTxt("currect_question_list.aspx", "keywords={0}", "")); return; } } if (this.type > 0) { this.ddlType.SelectedValue = this.type + ""; whereStr += " and type = " + this.type; } #endregion this.page = RequestHelper.GetQueryInt("page", 1); txtKeywords.Text = this.keywords; BLL.common_questions bll = new BLL.common_questions(); this.rptList.DataSource = bll.GetListByPage(whereStr, "ID", this.page, this.pageSize); this.rptList.DataBind(); this.totalCount = bll.GetRecordCount(whereStr); //绑定页码 txtPageNum.Text = this.pageSize.ToString(); string pageUrl = Utils.CombUrlTxt("currect_question_list.aspx", "keywords={0}&page={1}&type={2}", this.keywords, "__id__", this.type + ""); PageContent.InnerHtml = Utils.OutPageList(this.pageSize, this.page, this.totalCount, pageUrl, 8); }
//保存 protected void btnSubmit_Click(object sender, EventArgs e) { ChkAdminLevel("_ybd_classroom_info", EnumCollection.ActionEnum.Add.ToString()); //检查权限 #region string strError = string.Empty; if (txtname.Text.Trim() == "" || txtname.Text.Trim().Length > 50) { strError += "课堂名称为空或超出长度![br]"; } if (txtavatar.Text.Trim() == "" || txtavatar.Text.Trim().Length > 255) { strError += "课堂头像/背景图为空或超出长度![br]"; } if (txtuser_id.Text.Trim() == "" || txtuser_id.Text.Trim().Length > 4) { strError += "创建者ID为空或超出长度![br]"; } if (txtuser_name.Text.Trim() == "" || txtuser_name.Text.Trim().Length > 50) { strError += "创建者姓名为空或超出长度![br]"; } if (txtinfo.Text.Trim() == "" || txtinfo.Text.Trim().Length > 4000) { strError += "课堂简介为空或超出长度![br]"; } if (txtqrcode.Text.Trim() == "" || txtqrcode.Text.Trim().Length > 255) { strError += "课堂二维码为空或超出长度![br]"; } if (txtis_show.Text.Trim() == "" || txtis_show.Text.Trim().Length > 4) { strError += "是否公开为空或超出长度![br]"; } if (txtadd_time.Text.Trim() == "" || txtadd_time.Text.Trim().Length > 8) { strError += "创建时间为空或超出长度![br]"; } if (strError != string.Empty) { JscriptMsg(strError, "", "Error"); return; } #endregion Model.classroom_info model = new Model.classroom_info(); BLL.classroom_info bll = new BLL.classroom_info(); model.name = Convert.ToString(txtname.Text); model.avatar = Convert.ToString(txtavatar.Text); model.user_id = Convert.ToInt32(txtuser_id.Text); model.user_name = Convert.ToString(txtuser_name.Text); model.info = Convert.ToString(txtinfo.Text); model.qrcode = Convert.ToString(txtqrcode.Text); model.is_show = Convert.ToInt32(txtis_show.Text); model.add_time = Convert.ToDateTime(txtadd_time.Text); int id = bll.Add(model); if (id > 0) { AddAdminLog(EnumCollection.ActionEnum.Add.ToString(), "添加课堂信息信息,主键:" + id); //记录日志 JscriptMsg("添加课堂信息信息成功!", "Manage.aspx", ""); } else { JscriptMsg("保存过程中发生错误!", ""); } }