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.关于我们; model.user_id = 0; model.category_id = 0; model.title = Convert.ToString(txttitle.Text); model.subtitle = ""; model.contents = Convert.ToString(txtcontents.Text); model.img_src = ""; model.click = 0; model.upvote = 0; model.status = (int)EnumCollection.YesOrNot.是; 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 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.新闻动态; model.user_id = 0; model.category_id = Convert.ToInt32(ddlCategory.SelectedValue); model.title = Convert.ToString(txttitle.Text.Trim()); model.subtitle = Convert.ToString(txtsubtitle.Text.Trim()); model.contents = Convert.ToString(txtcontents.Text.Trim()); model.img_src = Convert.ToString(txtimg_src.Text.Trim()); model.click = 0; model.upvote = 0; model.status = (int)EnumCollection.examine_status.审核通过; 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 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.精品微课问题讨论; model.user_id = 0; model.category_id = this.chapter; model.title = Convert.ToString(txttitle.Text); model.subtitle = ""; model.contents = Convert.ToString(txtcontents.Text); model.img_src = ""; model.click = 0; model.upvote = 0; model.status = (int)EnumCollection.examine_status.审核通过; model.add_time = System.DateTime.Now; int id = bll.Add(model); if (id > 0) { #region 保存图片 string[] albumArr = Request.Form.GetValues("hid_photo_name"); if (albumArr != null && albumArr.Length > 0) { for (int i = 0; i < albumArr.Length; i++) { string[] imgArr = albumArr[i].Split('|'); if (imgArr.Length == 3) { var img = new Model.common_albums { group_id = (int)EnumCollection.img_group.精品微课问题讨论图片, rc_type = 0, rc_data_id = id, add_time = DateTime.Now, original_path = imgArr[1], thumb_path = imgArr[2], remark = "" }; new BLL.common_albums().Add(img); } } } #endregion 保存图片 AddAdminLog(EnumCollection.ActionEnum.Add.ToString(), "添加问题讨论信息,主键:" + id); //记录日志 return(true); } else { return(false); } }
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); } }
//保存 protected void btnSubmit_Click(object sender, EventArgs e) { ChkAdminLevel("_ybd_common_article", EnumCollection.ActionEnum.Add.ToString()); //检查权限 #region string strError = string.Empty; if (txtgroup_id.Text.Trim() == "" || txtgroup_id.Text.Trim().Length > 4) { strError += "分组为空或超出长度![br]"; } if (txtuser_id.Text.Trim() == "" || txtuser_id.Text.Trim().Length > 4) { strError += "发布者id为空或超出长度![br]"; } if (txtcategory_id.Text.Trim() == "" || txtcategory_id.Text.Trim().Length > 4) { strError += "分类id为空或超出长度![br]"; } if (txttitle.Text.Trim() == "" || txttitle.Text.Trim().Length > 200) { strError += "标题为空或超出长度![br]"; } if (txtsubtitle.Text.Trim() == "" || txtsubtitle.Text.Trim().Length > 200) { strError += "副标题为空或超出长度![br]"; } if (txtcontents.Text.Trim() == "" || txtcontents.Text.Trim().Length > 4000) { strError += "内容为空或超出长度![br]"; } if (txtimg_src.Text.Trim() == "" || txtimg_src.Text.Trim().Length > 255) { strError += "封面图为空或超出长度![br]"; } if (txtclick.Text.Trim() == "" || txtclick.Text.Trim().Length > 4) { strError += "点击量为空或超出长度![br]"; } if (txtupvote.Text.Trim() == "" || txtupvote.Text.Trim().Length > 4) { strError += "点赞数为空或超出长度![br]"; } if (txtstatus.Text.Trim() == "" || txtstatus.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.common_article model = new Model.common_article(); BLL.common_article bll = new BLL.common_article(); model.group_id = Convert.ToInt32(txtgroup_id.Text); model.user_id = Convert.ToInt32(txtuser_id.Text); model.category_id = Convert.ToInt32(txtcategory_id.Text); model.title = Convert.ToString(txttitle.Text); model.subtitle = Convert.ToString(txtsubtitle.Text); model.contents = Convert.ToString(txtcontents.Text); model.img_src = Convert.ToString(txtimg_src.Text); model.click = Convert.ToInt32(txtclick.Text); model.upvote = Convert.ToInt32(txtupvote.Text); model.status = Convert.ToInt32(txtstatus.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("保存过程中发生错误!", ""); } }