private void SetCaseIsShow() { int id = RequestHelper.GetFormInt("id"); BLL.common_resource bll = new BLL.common_resource(); Model.common_resource model = bll.GetModel(id); if (model != null) { if (model.is_del == (int)EnumCollection.YesOrNot.是) { model.is_del = (int)EnumCollection.YesOrNot.否; } else { model.is_del = (int)EnumCollection.YesOrNot.是; } bll.Update(model); HttpContext.Current.Response.Write("1"); HttpContext.Current.Response.End(); } else { HttpContext.Current.Response.Write("0"); HttpContext.Current.Response.End(); } }
private void SaveClassroomResource() { int class_id = RequestHelper.GetFormInt("class_id"); string ids = RequestHelper.GetFormString("ids"); string[] idArr = ids.Split(','); BLL.common_resource bll = new BLL.common_resource(); Model.common_resource model = null; Model.common_resource newModel = null; for (int i = 0; i < idArr.Length; i++) { int id = Convert.ToInt32(idArr[i]); model = bll.GetModel(id); if (model != null) { newModel = model; newModel.id = 0; newModel.from_id = (int)EnumCollection.resource_from.课堂; newModel.data_id = class_id; bll.Add(newModel); } } writeMsgSuccess("成功"); }
//保存 protected void btnSubmit_Click(object sender, EventArgs e) { ChkAdminLevel("_ybd_common_resource", EnumCollection.ActionEnum.Modify.ToString()); //检查权限 BLL.common_resource bll = new BLL.common_resource(); Model.common_resource model = bll.GetModel(this.id); model.from_id = Convert.ToInt32(txtfrom_id.Text); model.group_id = Convert.ToInt32(txtgroup_id.Text); model.type = Convert.ToInt32(txttype.Text); model.school_id = Convert.ToInt32(txtschool_id.Text); model.school_name = Convert.ToString(txtschool_name.Text); model.data_id = Convert.ToInt32(txtdata_id.Text); model.user_id = Convert.ToInt32(txtuser_id.Text); model.title = Convert.ToString(txttitle.Text); model.cover = Convert.ToString(txtcover.Text); model.path = Convert.ToString(txtpath.Text); model.qrcode = Convert.ToString(txtqrcode.Text); model.file_name = Convert.ToString(txtfile_name.Text); model.extend = Convert.ToString(txtextend.Text); model.likn_url = Convert.ToString(txtlikn_url.Text); model.share_user = Convert.ToString(txtshare_user.Text); model.sort = Convert.ToInt32(txtsort.Text); model.add_time = Convert.ToDateTime(txtadd_time.Text); model.is_del = Convert.ToInt32(txtis_del.Text); if (bll.Update(model)) { AddAdminLog(EnumCollection.ActionEnum.Modify.ToString(), "修改资源信息信息,主键:" + id); //记录日志 JscriptMsg("修改资源信息信息成功!", "Manage.aspx"); } else { JscriptMsg("保存过程中发生错误!", ""); } }
private bool DoEdit(int id) { BLL.common_resource bll = new BLL.common_resource(); Model.common_resource model = bll.GetModel(id); model.from_id = (int)EnumCollection.resource_from.课堂; model.group_id = (int)EnumCollection.resource_group.公共资源; model.type = (int)EnumCollection.resource_type.图文资源; model.school_id = 0; model.school_name = ""; model.data_id = class_id; model.user_id = user_id; model.title = Convert.ToString(txttitle.Text.Trim()); model.cover = ""; model.path = Convert.ToString(txtcontents.Text.Trim()); model.qrcode = "/QrCode.aspx?type=re&id=" + id; model.file_name = ""; model.extend = ""; model.likn_url = ""; model.share_user = ""; if (bll.Update(model)) { AddAdminLog(EnumCollection.ActionEnum.Modify.ToString(), "修改课堂知识点信息,主键:" + id); //记录日志 return(true); } else { return(false); } }
private void BindInfo() { BLL.common_resource bll = new BLL.common_resource(); Model.common_resource model = bll.GetModel(this.id); if (model == null) { JscriptMsg("信息不存在或已被删除!", "back"); return; } txtfrom_id.Text = model.from_id + ""; txtgroup_id.Text = model.group_id + ""; txttype.Text = model.type + ""; txtschool_id.Text = model.school_id + ""; txtschool_name.Text = model.school_name + ""; txtdata_id.Text = model.data_id + ""; txtuser_id.Text = model.user_id + ""; txttitle.Text = model.title + ""; txtcover.Text = model.cover + ""; txtpath.Text = model.path + ""; txtqrcode.Text = model.qrcode + ""; txtfile_name.Text = model.file_name + ""; txtextend.Text = model.extend + ""; txtlikn_url.Text = model.likn_url + ""; txtshare_user.Text = model.share_user + ""; txtsort.Text = model.sort + ""; txtadd_time.Text = model.add_time + ""; txtis_del.Text = model.is_del + ""; }
private bool DoEdit(int id) { BLL.common_resource bll = new BLL.common_resource(); Model.common_resource model = bll.GetModel(id); model.from_id = (int)EnumCollection.resource_from.课堂; model.group_id = (int)EnumCollection.resource_group.公共资源; model.type = (int)EnumCollection.resource_type.视频资源; model.school_id = 0; model.school_name = ""; model.data_id = class_id; model.user_id = admin_info.id; model.title = getStr(this.hdfVal.Value, 1); model.cover = this.txtcover.Text.Trim(); model.path = this.txtpath.Text.Trim(); model.file_name = this.hdfVal.Value; model.extend = getStr(this.hdfVal.Value, 2); model.likn_url = ""; model.qrcode = "/QrCode.aspx?type=re&id=" + id; model.share_user = ""; if (bll.Update(model)) { AddAdminLog(EnumCollection.ActionEnum.Modify.ToString(), "修改课堂视频资源信息,主键:" + id); //记录日志 return(true); } else { return(false); } }
private void ShowInfo(int _id) { BLL.common_resource bll = new BLL.common_resource(); Model.common_resource model = bll.GetModel(this.id); if (model == null) { JscriptMsg("信息不存在或已被删除!", "back"); return; } this.txttitle.Text = model.title + ""; this.txtcontents.Text = model.path + ""; }
private void ShowInfo(int _id) { BLL.common_resource bll = new BLL.common_resource(); Model.common_resource model = bll.GetModel(this.id); if (model == null) { JscriptMsg("信息不存在或已被删除!", "back"); return; } this.txtpath.Text = model.path + ""; this.hdfVal.Value = model.title + "." + model.extend; }
private bool DoAdd() { BLL.common_resource bll = new BLL.common_resource(); Model.common_resource model = new Model.common_resource(); model.from_id = (int)EnumCollection.resource_from.课堂; model.group_id = (int)EnumCollection.resource_group.公共资源; model.type = (int)EnumCollection.resource_type.图文资源; model.school_id = 0; model.school_name = ""; model.data_id = class_id; model.user_id = user_id; model.title = Convert.ToString(txttitle.Text.Trim()); model.cover = ""; model.path = Convert.ToString(txtcontents.Text.Trim()); model.qrcode = ""; model.file_name = ""; model.extend = ""; model.likn_url = ""; model.share_user = ""; model.add_time = System.DateTime.Now; Model.common_resource maxModel = bll.GetModel(" from_id = " + model.from_id + " and group_id = " + model.group_id + " and type = " + model.type + " and data_id = " + class_id + " order by sort desc "); if (maxModel != null) { model.sort = maxModel.sort + 1; } else { model.sort = 1; } int id = bll.Add(model); if (id > 0) { model.id = id; model.qrcode = "/QrCode.aspx?type=re&id=" + id; bll.Update(model); AddAdminLog(EnumCollection.ActionEnum.Add.ToString(), "添加课堂知识点信息,主键:" + id); //记录日志 return(true); } else { return(false); } }
private void ShowInfo(int _id) { BLL.common_resource bll = new BLL.common_resource(); Model.common_resource model = bll.GetModel(this.id); if (model == null) { JscriptMsg("信息不存在或已被删除!", "back"); return; } this.rbtnGroup.SelectedValue = model.group_id + ""; this.rbtnType.SelectedValue = model.type + ""; if (model.type == (int)EnumCollection.resource_type.图文资源) { this.txttitle.Text = model.title + ""; this.txtcontents.Text = model.path + ""; } else { this.txtpath.Text = model.path + ""; this.hdfVal.Value = model.title + "." + model.extend; } if (model.group_id == (int)EnumCollection.resource_group.共享资源) { string[] uidArr = model.share_user.Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries); for (int i = 0; i < this.ckbUser.Items.Count; i++) { for (int n = 0; n < uidArr.Length; n++) { if (uidArr[n] == this.ckbUser.Items[i].Value) { this.ckbUser.Items[i].Selected = true; } } } } }
private bool DoEdit(int id) { BLL.common_resource bll = new BLL.common_resource(); Model.common_resource model = bll.GetModel(id); model.from_id = (int)EnumCollection.resource_from.课堂; model.group_id = (int)EnumCollection.resource_group.公共资源; model.type = (int)EnumCollection.resource_type.文档资源; model.school_id = 0; model.school_name = ""; model.data_id = class_id; model.user_id = user_id; string fileNames = Utils.DelLastChar(this.hdfVal.Value, "|"); string path = Utils.DelLastChar(this.txtpath.Text, "|"); string[] files = fileNames.Split('|'); string[] paths = path.Split('|'); model.title = getStr(files[0], 1); model.cover = ""; model.path = paths[0]; model.file_name = files[0]; model.extend = getStr(files[0], 2); model.likn_url = ""; model.qrcode = "/QrCode.aspx?type=re&id=" + id; model.share_user = ""; if (bll.Update(model)) { AddAdminLog(EnumCollection.ActionEnum.Modify.ToString(), "修改资源信息,主键:" + id); //记录日志 return(true); } else { return(false); } }
//保存 protected void btnSubmit_Click(object sender, EventArgs e) { BLL.common_resource bll = new BLL.common_resource(); Model.common_resource model = null; if (action == EnumCollection.ActionEnum.Modify.ToString()) //修改 { ChkAdminLevel("_resource_list", EnumCollection.ActionEnum.Modify.ToString()); //检查权限 if (!DoEdit(this.id)) { JscriptMsg("保存过程中发生错误!", ""); return; } JscriptMsg("修改资源成功!", "resource_list.aspx?page=" + this.page + "&chapter=" + this.chapter + "&course_id=" + this.course_id); } else //添加 { ChkAdminLevel("_resource_list", EnumCollection.ActionEnum.Add.ToString()); //检查权限 #region 添加操作 if (Convert.ToInt32(this.rbtnType.SelectedValue) == (int)EnumCollection.resource_type.图文资源) { model = new Model.common_resource(); model.from_id = (int)EnumCollection.resource_from.精品微课; model.group_id = Convert.ToInt32(this.rbtnGroup.SelectedValue); model.type = Convert.ToInt32(this.rbtnType.SelectedValue); if (model.group_id != (int)EnumCollection.resource_group.学校资源) { model.school_id = 0; model.school_name = ""; } else { model.school_id = Convert.ToInt32(this.ddlSchool.SelectedValue); model.school_name = this.ddlSchool.SelectedItem.Text; } model.data_id = chapter; model.user_id = admin_info.id; model.title = Convert.ToString(txttitle.Text.Trim()); model.cover = ""; model.path = Convert.ToString(txtcontents.Text.Trim()); model.qrcode = ""; model.file_name = ""; model.extend = ""; model.likn_url = ""; model.add_time = System.DateTime.Now; Model.common_resource maxModel = bll.GetModel(" from_id = " + (int)EnumCollection.resource_from.精品微课 + " and data_id = " + chapter + " order by sort desc "); if (maxModel != null) { model.sort = maxModel.sort + 1; } else { model.sort = 1; } string userids = string.Empty; for (int i = 0; i < ckbUser.Items.Count; i++) { if (ckbUser.Items[i].Selected) { userids += "," + ckbUser.Items[i].Value + ","; } } model.share_user = userids; int id = bll.Add(model); if (id > 0) { model.id = id; model.qrcode = "/QrCode.aspx?type=re&id=" + id; bll.Update(model); AddAdminLog(EnumCollection.ActionEnum.Add.ToString(), "添加图文资源信息,主键:" + id); //记录日志 JscriptMsg("添加图文资源成功!", "resource_list.aspx?chapter=" + this.chapter + "&course_id=" + this.course_id); } else { JscriptMsg("保存过程中发生错误!", ""); return; } } else { string fileNames = Utils.DelLastChar(this.hdfVal.Value, "|"); string path = Utils.DelLastChar(this.txtpath.Text, "|"); string[] files = fileNames.Split(new char[] { '|' }, StringSplitOptions.RemoveEmptyEntries); string[] paths = path.Split(new char[] { '|' }, StringSplitOptions.RemoveEmptyEntries); int count = 0; Model.common_resource maxModel = null; for (int i = 0; i < files.Length; i++) { model = new Model.common_resource(); model.from_id = (int)EnumCollection.resource_from.精品微课; model.group_id = Convert.ToInt32(this.rbtnGroup.SelectedValue); model.type = Convert.ToInt32(this.rbtnType.SelectedValue); if (model.group_id == (int)EnumCollection.resource_group.公共资源) { model.school_id = 0; model.school_name = ""; } else { model.school_id = Convert.ToInt32(this.ddlSchool.SelectedValue); model.school_name = this.ddlSchool.SelectedItem.Text; } model.data_id = chapter; model.user_id = admin_info.id; string file = files[i]; model.title = getStr(file, 1); model.cover = ""; model.path = paths[i]; model.qrcode = ""; model.file_name = file; model.extend = getStr(file, 2); model.likn_url = ""; model.add_time = System.DateTime.Now; maxModel = bll.GetModel(" from_id = " + (int)EnumCollection.resource_from.精品微课 + " and data_id = " + chapter + " order by sort desc "); if (maxModel != null) { model.sort = maxModel.sort + 1; } else { model.sort = 1; } string userids = string.Empty; for (int j = 0; j < ckbUser.Items.Count; j++) { if (ckbUser.Items[j].Selected) { userids += "," + ckbUser.Items[j].Value + ","; } } model.share_user = userids; int id = bll.Add(model); if (id > 0) { model.id = id; model.qrcode = "/QrCode.aspx?type=re&id=" + id; bll.Update(model); AddAdminLog(EnumCollection.ActionEnum.Add.ToString(), "添加" + Enum.GetName(typeof(EnumCollection.resource_type), model.type) + "资源信息,主键:" + id); //记录日志 count++; } } JscriptMsg("添加" + Enum.GetName(typeof(EnumCollection.resource_type), model.type) + "资源成功!总文件" + files.Length + "个,成功" + count + "个", "resource_list.aspx?chapter=" + this.chapter + "&course_id=" + this.course_id); } #endregion } }
private bool DoEdit(int id) { BLL.common_resource bll = new BLL.common_resource(); Model.common_resource model = bll.GetModel(id); model.from_id = (int)EnumCollection.resource_from.精品微课; model.group_id = Convert.ToInt32(this.rbtnGroup.SelectedValue); model.type = Convert.ToInt32(this.rbtnType.SelectedValue); if (model.group_id != (int)EnumCollection.resource_group.学校资源) { model.school_id = 0; model.school_name = ""; } else { model.school_id = Convert.ToInt32(this.ddlSchool.SelectedValue); model.school_name = this.ddlSchool.SelectedItem.Text; } model.data_id = chapter; model.user_id = admin_info.id; if (model.type == (int)EnumCollection.resource_type.图文资源) { model.title = Convert.ToString(txttitle.Text.Trim()); model.cover = ""; model.path = Convert.ToString(txtcontents.Text.Trim()); model.qrcode = "/QrCode.aspx?type=re&id=" + id; model.file_name = ""; model.extend = ""; model.likn_url = ""; } else { string fileNames = Utils.DelLastChar(this.hdfVal.Value, "|"); string path = Utils.DelLastChar(this.txtpath.Text, "|"); string[] files = fileNames.Split('|'); string[] paths = path.Split('|'); model.title = getStr(files[0], 1); model.cover = ""; model.path = paths[0]; model.file_name = files[0]; model.extend = getStr(files[0], 2); model.likn_url = ""; model.qrcode = "/QrCode.aspx?type=re&id=" + id; } string userids = string.Empty; for (int i = 0; i < ckbUser.Items.Count; i++) { if (ckbUser.Items[i].Selected) { userids += "," + ckbUser.Items[i].Value + ","; } } model.share_user = userids; if (bll.Update(model)) { AddAdminLog(EnumCollection.ActionEnum.Modify.ToString(), "修改资源信息,主键:" + id); //记录日志 return(true); } else { return(false); } }
protected void Page_Load(object sender, EventArgs e) { string source_url = Request.QueryString["source_url"]; string code = Request.QueryString["code"]; string state = Request.QueryString["state"]; if (!string.IsNullOrEmpty(source_url)) { string location = Request.RawUrl; int index = location.IndexOf('='); source_url = location.Substring(index + 1, location.Length - index - 1); source_url = source_url.Replace('&', '*'); Utils.StringToTxt("wxOAuth_WeChat_GetCode————source_url==" + source_url); Utils.WriteCookie("wxOAuth_WeChatGrant", "True"); string url = WeChatContext.GetRedirectCode("/html/wxOAuth.aspx", source_url, true); Response.Redirect(url); } else if (!string.IsNullOrEmpty(code)) { string temp = Utils.UrlDecode(state); string decodeurl = temp.Replace('*', '&'); Utils.StringToTxt("wxOAuth_wxLogin————code==" + code + ";wxOAuth_state==" + decodeurl); WeiXin_Access_token access_token = WeChatContext.GetAccessModel(code); if (access_token != null) { SnsapiUserInfo userInfo = WeChatContext.GetSnsapiUserInfo(access_token.Access_token, access_token.Openid);//获取用户信息 if (userInfo != null) { user_info_entity entity = new user_info_entity(); //公众号openid存在 Model.user_oauths oaModel = new BLL.user_oauths().GetModel(" appid = '" + access_token.Openid + "'"); if (oaModel != null) { try { Utils.StringToTxt("wxOAuth_wxLogin————公众号openid存在,则更新openID=" + access_token.Openid + "和unionID=" + userInfo.unionid); Model.user_info model = new BLL.user_info().GetModel(oaModel.user_id); Utils.StringToTxt("wxOAuth_wxLogin————用户信息:" + Newtonsoft.Json.JsonConvert.SerializeObject(model)); Utils.StringToTxt("wxOAuth_wxLogin————认证信息:" + Newtonsoft.Json.JsonConvert.SerializeObject(oaModel)); //更新unionid(多应用唯一识别码) oaModel.appid = userInfo.openid; oaModel.unionid = userInfo.unionid; new BLL.user_oauths().Update(oaModel); if (model.school_id == 0)//没有学校,公共资源 { decodeurl += "&method=scan"; Response.Redirect(decodeurl); } else//有学校,学校资源 { int idindex = decodeurl.IndexOf('='); string id = decodeurl.Substring(idindex + 1, decodeurl.Length - idindex - 1); BLL.common_resource resBll = new BLL.common_resource(); Model.common_resource res = resBll.GetModel(Convert.ToInt32(id)); if (res != null) { if (res.from_id == (int)EnumCollection.resource_from.精品微课) //如果是精品微课的资源 { if (res.group_id == (int)EnumCollection.resource_group.公共资源) //若此资源是公共资源,查询此章节下的学校资源 { Model.common_resource newRes = resBll.GetModel(string.Format(" from_id = {0} and group_id = {1} and type = {2} and data_id = {3}", res.from_id, (int)EnumCollection.resource_group.学校资源, res.type, res.data_id)); if (newRes != null) { decodeurl = decodeurl.Replace("id=" + id, "id=" + newRes.id); Utils.StringToTxt("wxOAuth_wxLogin————学校资源=" + decodeurl); } decodeurl += "&method=scan"; Response.Redirect(decodeurl); } else if (res.group_id == (int)EnumCollection.resource_group.学校资源)//若此资源是学校资源,判断是否是本学校的 { if (model.school_id != res.school_id) { Response.Write("您没有权限查看此资源"); } else { decodeurl += "&method=scan"; Response.Redirect(decodeurl); } } } else if (res.from_id == (int)EnumCollection.resource_from.课堂)//如果是课堂的资源 { decodeurl += "&method=scan"; Response.Redirect(decodeurl); } } else { decodeurl += "&method=scan"; Response.Redirect(decodeurl); } } } catch (Exception ex) { Utils.StringToTxt("wxOAuth_wxLogin————获取数据库用户信息出现异常:" + ex.Message); Response.Write("获取数据库用户信息出现异常:" + ex.Message); return; } } else//不存在 { if (Utils.GetCookie("wxOAuth_WeChatGrant") == "True") { Utils.WriteCookie("wxOAuth_WeChatGrant", "False"); Utils.StringToTxt("wxOAuth_wxLogin————公众号openid不存在,是全新用户"); #region 创建用户 Model.user_info model = new Model.user_info(); model.group_id = (int)EnumCollection.user_group.普通用户; model.user_name = ""; model.phone = ""; model.salt = Utils.GetCheckCode(6); model.user_pwd = ""; model.nick_name = userInfo.nickname; model.avatar = userInfo.headimgurl; model.integral = 0; model.school_id = 0; model.school_name = ""; model.college = ""; model.job = ""; model.course = ""; model.line_way = ""; model.area = userInfo.country + userInfo.province + userInfo.city; model.address = ""; model.reg_ip = RequestHelper.GetIP(); model.add_time = System.DateTime.Now; BLL.user_info bll = new BLL.user_info(); int row = bll.Add(model); if (row > 0) { model.id = row; entity.UserInfo = model; entity.UserInfo.user_pwd = ""; entity.UserInfo.salt = ""; entity.UserInfo.reg_ip = ""; BLL.user_tree tBll = new BLL.user_tree(); //1 创建code string tree_code = string.Empty; do { tree_code = Utils.Number(6); } while (tBll.GetModel(" code = '" + tree_code + "'") != null); //添加关系 #region 添加关系 Model.user_tree tree = new Model.user_tree(); tree.user_id = row; tree.code = tree_code; tree.parent_code = "0"; tree.grand_code = "0"; int treeid = tBll.Add(tree); if (treeid > 0) { tree.id = treeid; entity.UserTree = tree; } #endregion #region 添加认证信息 Utils.StringToTxt("wxOAuth_wxLogin————用户信息:" + Newtonsoft.Json.JsonConvert.SerializeObject(model)); Model.user_oauths model1 = new Model.user_oauths(); model1.user_id = row; model1.type = (int)EnumCollection.user_oauths.公众号微信登录; model1.name = EnumCollection.user_oauths.公众号微信登录.ToString(); model1.appid = userInfo.openid; model1.unionid = userInfo.unionid; int oaid = new BLL.user_oauths().Add(model1); if (row > 0) { model1.id = row; entity.UserOAuths = model1; Utils.StringToTxt("wxOAuth_wxLogin————新增的认证信息:" + Newtonsoft.Json.JsonConvert.SerializeObject(model1)); } #endregion Response.Redirect(decodeurl); return; } else { Utils.WriteCookie("wxOAuth_WeChatGrant", "True"); string url = WeChatContext.GetRedirectCode("/html/wxOAuth.aspx", state, true); Response.Redirect(url); return; } #endregion } else { Utils.WriteCookie("wxOAuth_WeChatGrant", "True"); string url = WeChatContext.GetRedirectCode("/html/wxOAuth.aspx", state, true); Response.Redirect(url); return; } } } else { Response.Write("微信认证失败,请重试"); return; } } else { Response.Write("token获取失败"); return; } } }
private void saveWordVoice() { int id = RequestHelper.GetFormInt("id"); int group = RequestHelper.GetFormInt("group"); int school = RequestHelper.GetFormInt("school"); string school_name = RequestHelper.GetFormString("school_name"); int chapter = RequestHelper.GetFormInt("chapter"); string title = RequestHelper.GetFormString("title"); string userids = RequestHelper.GetFormString("userids"); string words = RequestHelper.GetFormString("words"); Appoa.Web.UI.ManagePage mngPage = new Web.UI.ManagePage(); BLL.common_resource bll = new BLL.common_resource(); Model.common_resource model = bll.GetModel(id); if (model != null) { model.group_id = group; if (model.group_id == (int)EnumCollection.resource_group.公共资源) { model.school_id = 0; model.school_name = ""; } else { model.school_id = school; model.school_name = school_name; } model.data_id = chapter; model.user_id = mngPage.GetAdminInfo().id; model.title = title; model.path = words; model.share_user = userids; if (bll.Update(model)) { mngPage.AddAdminLog(EnumCollection.ActionEnum.Modify.ToString(), "修改英文发音资源信息,主键:" + id); //记录日志 writeMsgSuccess("保存成功"); } else { writeMsgError("保存失败"); } } else { model = new Model.common_resource(); model.from_id = (int)EnumCollection.resource_from.精品微课; model.group_id = group; model.type = (int)EnumCollection.resource_type.英文发音; if (model.group_id == (int)EnumCollection.resource_group.公共资源) { model.school_id = 0; model.school_name = ""; } else { model.school_id = school; model.school_name = school_name; } model.data_id = chapter; model.user_id = mngPage.GetAdminInfo().id; model.title = title; model.cover = ""; model.path = words; model.qrcode = ""; model.file_name = ""; model.extend = ""; model.likn_url = ""; model.add_time = System.DateTime.Now; model.share_user = userids; int row = bll.Add(model); if (row > 0) { model.id = row; model.qrcode = "/QrCode.aspx?type=re&id=" + row; bll.Update(model); mngPage.AddAdminLog(EnumCollection.ActionEnum.Add.ToString(), "添加英文发音资源信息,主键:" + row); //记录日志 writeMsgSuccess("保存成功"); } else { writeMsgError("保存失败"); } } }
//保存 protected void btnSubmit_Click(object sender, EventArgs e) { BLL.common_resource bll = new BLL.common_resource(); Model.common_resource model = null; if (action == EnumCollection.ActionEnum.Add.ToString()) //添加 { ChkAdminLevel("_classroom_video_materials", EnumCollection.ActionEnum.Add.ToString()); //检查权限 #region 添加操作 string[] files = this.hdfVal.Value.Split(new char[] { '|' }, StringSplitOptions.RemoveEmptyEntries); string[] thumbs = this.hdfThumb.Value.Split(new char[] { '|' }, StringSplitOptions.RemoveEmptyEntries); string[] paths = this.txtpath.Text.Split(new char[] { '|' }, StringSplitOptions.RemoveEmptyEntries); int count = 0; Model.common_resource maxModel = null; for (int i = 0; i < files.Length; i++) { model = new Model.common_resource(); model.from_id = (int)EnumCollection.resource_from.课堂; model.group_id = (int)EnumCollection.resource_group.公共资源; model.type = (int)EnumCollection.resource_type.视频资源; model.school_id = 0; model.school_name = ""; model.data_id = class_id; model.user_id = admin_info.id; string file = files[i]; model.title = getStr(file, 1); model.cover = thumbs[i]; model.path = paths[i]; model.qrcode = ""; model.file_name = file; model.extend = getStr(file, 2); model.likn_url = ""; model.share_user = ""; model.add_time = System.DateTime.Now; maxModel = bll.GetModel(" from_id = " + model.from_id + " and group_id = " + model.group_id + " and type = " + model.type + " and data_id = " + class_id + " order by sort desc "); if (maxModel != null) { model.sort = maxModel.sort + 1; } else { model.sort = 1; } int id = bll.Add(model); if (id > 0) { model.id = id; model.qrcode = "/QrCode.aspx?type=re&id=" + id; bll.Update(model); AddAdminLog(EnumCollection.ActionEnum.Add.ToString(), "添加" + Enum.GetName(typeof(EnumCollection.resource_type), model.type) + "资源信息,主键:" + id); //记录日志 count++; } JscriptMsg("添加" + Enum.GetName(typeof(EnumCollection.resource_type), model.type) + "资源成功!总文件" + files.Length + "个,成功" + count + "个", "video_list.aspx?class_id=" + this.class_id); } #endregion } }