protected void Page_Load(object sender, EventArgs e) { if (IsPostBack) { if (Request.Form["m_title"] == "" || Request.Form["m_date"] == "") { runClientScript("addOk", "parent.layer.msg('会议信息填写不完整!', { time: 3000 });"); return; } T_meeting a_meeting = new T_meeting() { m_title = Request.Form["m_title"].ToString().Trim(), m_theme = Request.Form["m_theme"].ToString().Trim(), m_abstract = Request.Form["m_abstruct"].ToString().Trim(), m_place = Request.Form["m_place"].ToString().Trim(), m_date = DateTime.Parse(Request.Form["m_date"].ToString().Trim()), m_compere = Request.Form["m_compere"].ToString().Trim(), m_code = Request.Form["m_code"].ToString().Trim(), m_state = "未开始", m_current_item = 0, m_pass = false }; dataContext.T_meetings.InsertOnSubmit(a_meeting); try { dataContext.SubmitChanges(); runClientScript("addOk", "parent.layer.msg('添加成功!', { time: 2500 });closeLayer();"); } catch (Exception catchMessage) { runClientScript("catchMessage", "parent.layer.msg('后台服务器错误:" + catchMessage.Message + "', { time: 2500 });"); } } }
//修改 protected void btnSubmit_Click(object sender, EventArgs e) { if (Request.Form["m_title"] == "" || Request.Form["m_date"] == "") { App_RegisterClientScriptBlock("infoMessage", "提示", "信息填写不完整!"); return; } T_meeting meeting = dataContext.T_meetings.SingleOrDefault(m => m.m_id == Int32.Parse(Request["m_id"])); meeting.m_title = Request.Form["m_title"].ToString().Trim(); meeting.m_theme = Request.Form["m_theme"].ToString().Trim(); meeting.m_abstract = Request.Form["m_abstruct"].ToString().Trim(); meeting.m_place = Request.Form["m_place"].ToString().Trim(); meeting.m_date = DateTime.Parse(Request.Form["m_date"].ToString().Trim()); meeting.m_compere = Request.Form["m_compere"].ToString().Trim(); meeting.m_code = Request.Form["m_code"].ToString().Trim(); try { dataContext.SubmitChanges(); Page.ClientScript.RegisterClientScriptBlock(typeof(string), "confirm", "confirm_addItems('MeetingList.aspx','修改成功,是否返回列表?');", true); } catch (Exception catchMessage) { App_RegisterClientScriptBlock("infoMessage", "错误", "更新失败,请重试!错误代码:" + catchMessage.Message); } }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { //初始化 if (Request["m_id"] == null || Request["m_id"] == "") { //App_RegisterClientScriptBlock("infoMessage", "提示", "未找到要修改的会议!"); //btnSubmit.Enabled = false; return; } txt_m_id.Value = Request["m_id"]; var a_meeting_get = dataContext.T_meetings.Where(m => m.m_id == Int32.Parse(Request["m_id"])).Single(); m_title.Value = a_meeting_get.m_title; m_theme.Value = a_meeting_get.m_theme; m_abstruct.Value = a_meeting_get.m_abstract; m_place.Value = a_meeting_get.m_place; m_date.Value = a_meeting_get.m_date.ToString(); m_compere.Value = a_meeting_get.m_compere; m_code.Value = a_meeting_get.m_code; if (a_meeting_get.m_state != "未开始") { runClientScript("editError", "parent.layer.msg('会议" + a_meeting_get.m_state + ",不允许修改!', { time: 3000 });"); return; } runClientScript("btnOK", "$('button[type=submit]').removeClass('disabled');"); } else { //postback if (Request.Form["m_title"] == "" || Request.Form["m_date"] == "") { runClientScript("addOk", "parent.layer.msg('会议信息填写不完整!', { time: 3000 });"); return; } T_meeting meeting = dataContext.T_meetings.SingleOrDefault(m => m.m_id == Int32.Parse(txt_m_id.Value)); meeting.m_title = Request.Form["m_title"].ToString().Trim(); meeting.m_theme = Request.Form["m_theme"].ToString().Trim(); meeting.m_abstract = Request.Form["m_abstruct"].ToString().Trim(); meeting.m_place = Request.Form["m_place"].ToString().Trim(); meeting.m_date = DateTime.Parse(Request.Form["m_date"].ToString().Trim()); meeting.m_compere = Request.Form["m_compere"].ToString().Trim(); meeting.m_code = Request.Form["m_code"].ToString().Trim(); meeting.m_pass = false; try { dataContext.SubmitChanges(); runClientScript("addOk", "parent.layer.msg('修改成功!', { time: 2000 });closeLayer();"); } catch (Exception catchMessage) { runClientScript("catchMessage", "parent.layer.msg('后台服务器错误:" + catchMessage.Message + "', { time: 2500 });"); } } }
protected void Page_Load(object sender, EventArgs e) { if (Request["m_id"] == null || Request["m_id"] == "") { return; } T_meeting a_meeting = meetingContext.T_meetings.Where(m => m.m_id == Int32.Parse(Request["m_id"])).Single(); m_title_label.Text = a_meeting.m_title; }
protected void Page_Load(object sender, EventArgs e) { if (IsPostBack) { return; } //初始化 if (Request["m_id"] == null || Request["m_id"] == "" || Request["item_id"] == null || Request["item_id"] == "") { App_RegisterClientScriptBlock("infoMessage", "提示", "未找到要修改的会议!"); btnSubmit.Enabled = false; return; } //判断是否可以修改 T_meeting a_meeting = mDb.T_meetings.SingleOrDefault(m => m.m_id == Int32.Parse(Request["m_id"])); T_meeting_item i_meeting = iDb.T_meeting_items.SingleOrDefault(i => i.item_id == Int32.Parse(Request["item_id"])); if (a_meeting != null) { m_title_label.Text = a_meeting.m_title; } if (i_meeting == null) { return; } if (a_meeting.m_state != "未开始" || i_meeting.item_state != "未开始") { App_RegisterClientScriptBlock("infoMessage", "提示", "会议已结束或正在进行中,不允许修改!"); btnSubmit.Enabled = false; return; } item_number.Value = i_meeting.item_number.ToString(); item_title.Value = i_meeting.item_title; item_content.Value = HttpUtility.HtmlDecode(i_meeting.item_content); item_time.Value = i_meeting.item_time.ToString(); string[] item_files = new string[] { }; string temp = ""; if (i_meeting.item_files_url != null && i_meeting.item_files_url != "") { item_files = i_meeting.item_files_url.Split(','); foreach (var item in item_files) { if (item == "") { continue; } hideFiles.Value += item + ','; var tempItem = item.Length > 35 ? item.Substring(0, 35) + "..." : item; temp += "<li item_value ='" + item + "'>" + tempItem + "<a class='easyui-linkbutton' href=\"javascript:void(0);\">移除</a></li>"; } uploadFiles.InnerHtml = temp; } }
protected void Page_Load(object sender, EventArgs e) { //m_title.Text ="ss"; string m_id = Request.QueryString["m_id"] != null ?Request.QueryString["m_id"]:""; if (m_id == null || m_id == "") { return; } string m_title = Request.QueryString["m_title"] != null ? Request.QueryString["m_title"] : ""; if (m_title == null || m_title == "") { T_meeting a_meeting = meetingContext.T_meetings.Where(m => m.m_id == Int32.Parse(m_id)).Single(); m_title = a_meeting.m_title; } m_title_label.Text = m_title; }
//添加会议 protected void btnSubmit_Click(object sender, EventArgs e) { if (Request.Form["m_title"] == "" || Request.Form["m_date"] == "") { App_RegisterClientScriptBlock("infoMessage", "提示", "信息填写不完整!"); return; } T_meeting a_meeting = new T_meeting() { m_title = Request.Form["m_title"].ToString().Trim(), m_theme = Request.Form["m_theme"].ToString().Trim(), m_abstract = Request.Form["m_abstruct"].ToString().Trim(), m_place = Request.Form["m_place"].ToString().Trim(), m_date = DateTime.Parse(Request.Form["m_date"].ToString().Trim()), m_compere = Request.Form["m_compere"].ToString().Trim(), m_code = Request.Form["m_code"].ToString().Trim(), m_state = "未开始", m_current_item = 0 }; dataContext.T_meetings.InsertOnSubmit(a_meeting); try { dataContext.SubmitChanges(); //App_RegisterClientScriptBlock("infoMessage", "提示", "会议添加成功,请设置会议议程!"); string meetingAddItemUrl = "MeetingAddItems.aspx?m_title=" + a_meeting.m_title + "&m_id=" + a_meeting.m_id; if (!Page.ClientScript.IsClientScriptBlockRegistered("confirm")) { //跳转选择,客户端页面跳转 Page.ClientScript.RegisterClientScriptBlock(typeof(string), "confirm", "confirm_addItems('" + meetingAddItemUrl + "','创建成功,是否继续设置会议议程?');", true); } } catch (Exception catchMessage) { App_RegisterClientScriptBlock("infoMessage", "错误", "会议添加失败,请重试!错误代码:" + catchMessage.Message); } }
protected void Page_Load(object sender, EventArgs e) { if (IsPostBack) { string m_id = hfM_id.Value != null ? hfM_id.Value : ""; if (m_id == null || m_id == "") { runClientScript("addOk", "parent.layer.msg('未发现会议!', { time: 3000 });"); return; } if (Request.Form["item_title"] == "" || Request.Form["item_time"] == "") { runClientScript("addNoInfo", "parent.layer.msg('议程信息填写不完整!', { time: 3000 });"); return; } //生成当前添加议程item_number int var_item_number = 0; try { T_meeting_item item = meeting_itemsContext.T_meeting_items.Where(m => m.m_id == Int32.Parse(m_id)).OrderByDescending(o => o.item_number).First(); var_item_number = item.item_number + 1; } catch (Exception) { var_item_number = 1; } //处理上传文件 //string files = "" ; //if (hfFilePath.Value != "") //{ // DataTable dt = JsonConvert.DeserializeObject<DataTable>(hfFilePath.Value); // for (int i = 0; i < dt.Rows.Count; i++) // { // files = files + dt.Rows[i]["name"].ToString() + ","; // } // files.TrimEnd(','); //} T_meeting_item a_meeting_item = new T_meeting_item() { m_id = Int32.Parse(m_id), item_title = Request.Form["item_title"].ToString().Trim(), item_content = HttpUtility.HtmlEncode(Request.Form["item_content"].ToString().Trim()), item_number = var_item_number, item_time = Int32.Parse(Request.Form["item_time"]), item_files_url = hfFilePath.Value, item_state = "未开始" }; meeting_itemsContext.T_meeting_items.InsertOnSubmit(a_meeting_item); try { meeting_itemsContext.SubmitChanges(); runClientScript("addOk", "parent.layer.msg('添加成功!', { time: 3000 });"); runClientScript("closeLayer", "closeLayer();"); } catch (Exception exc) { runClientScript("addError", "parent.layer.msg('添加失败!'" + exc.Message + ", { time: 3000 });"); } } else {//!ispostback string m_id = Request.QueryString["m_id"] != null ? Request.QueryString["m_id"] : ""; if (m_id == null || m_id == "") { runClientScript("addOk", "parent.layer.msg('未发现会议!', { time: 3000 });"); return; } hfM_id.Value = m_id; string m_title = Request.QueryString["m_title"] != null ? Request.QueryString["m_title"] : ""; if (m_title == null || m_title == "") { T_meeting a_meeting = meetingContext.T_meetings.Where(m => m.m_id == Int32.Parse(m_id)).Single(); m_title = a_meeting.m_title; } h5.InnerText = m_title; runClientScript("btnOk", "$('button[type=submit]').removeClass('disabled');"); } }
protected void Page_Load(object sender, EventArgs e) { if (IsPostBack) { string m_id = hfM_id.Value.ToString(); string item_id = hfItem_id.Value.ToString(); string item_number = hfItem_num.Value.ToString(); string oldFilesStr = hfOldFile.Value.ToString(); string fileStr = hfFilePath.Value.ToString(); if (m_id == "" || item_id == "" || item_number == "") { runClientScript("addOk", "parent.layer.msg('未发现相关会议及议程!', { time: 3000 });"); return; } var i_meeting_get = meeting_itemsContext.T_meeting_items.SingleOrDefault(i => i.item_id == Int32.Parse(item_id)); if (i_meeting_get != null) { i_meeting_get.item_title = Request.Form["item_title"].ToString().Trim(); //HTML转码 i_meeting_get.item_content = HttpUtility.HtmlEncode(Request.Form["item_content"].ToString().Trim()); i_meeting_get.item_number = Int32.Parse(item_number); i_meeting_get.item_time = Int32.Parse(Request.Form["item_time"]); i_meeting_get.item_files_url = fileStr; } try { meeting_itemsContext.SubmitChanges(); runClientScript("addOk", "parent.layer.msg('修改成功!', { time: 3000 });closeLayer();"); } catch (Exception catchMsg) { meeting_itemsContext.SubmitChanges(); runClientScript("addOk", "parent.layer.msg('修改失败!'" + catchMsg.Message + ", { time: 3000 });"); } } else { string m_id = Request.QueryString["m_id"] != null ? Request.QueryString["m_id"] : ""; string item_id = Request.QueryString["item_id"] != null ? Request.QueryString["item_id"] : ""; hfM_id.Value = m_id; hfItem_id.Value = item_id; if (m_id == "" || item_id == "") { runClientScript("error", "parent.layer.msg('未发现相关会议及议程!', { time: 3000 });"); return; } //判断是否可以修改 T_meeting a_meeting = meetingContext.T_meetings.SingleOrDefault(m => m.m_id == Int32.Parse(m_id)); T_meeting_item i_meeting = meeting_itemsContext.T_meeting_items.SingleOrDefault(i => i.item_id == Int32.Parse(item_id)); h5.InnerText = a_meeting.m_title; if (a_meeting.m_state != "未开始" || i_meeting.item_state != "未开始") { runClientScript("error", "parent.layer.msg('当前会议正在进行中或已结束,不允许修改!', { time: 3000 });"); return; } hfItem_num.Value = i_meeting.item_number.ToString(); item_title.Value = i_meeting.item_title; item_content.Value = HttpUtility.HtmlDecode(i_meeting.item_content); item_time.Value = i_meeting.item_time.ToString(); //处理附件 if (i_meeting.item_files_url != null && i_meeting.item_files_url != "") { hfOldFile.Value = i_meeting.item_files_url; DataTable dt = JsonConvert.DeserializeObject <DataTable>(i_meeting.item_files_url); for (int i = 0; i < dt.Rows.Count; i++) { runClientScript("filesOk" + i, "var $list = $('#thelist');$list.append('<div id=\"" + dt.Rows[i]["queueId"].ToString() + "\" class=\"item\"><div class=\"info\">" + dt.Rows[i]["name"].ToString() + "</div><p class=\"state\"><span class=\"text-danger\">已上传</span> <a href=\"javascript:void(0);\" class=\"btn btn-link deleteOldLink\">删除</a></p><hr/></div>');"); } } runClientScript("btnOk", "$('button[type=submit]').removeClass('disabled')"); } }