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;
            }
        }
Example #2
0
        protected void btnSubmit_Click(object sender, EventArgs e)
        {
            //string[] sss = Session["files"]!=null ? Session["files"].ToString().Split(',') : new string[]{};
            //foreach (var item in sss)
            //{
            //    Response.Write(item+"<br>");
            //}
            string m_id = Request.QueryString["m_id"] != null ? Request.QueryString["m_id"] : "";

            if (m_id == null || m_id == "")
            {
                App_RegisterClientScriptBlock("infoMessage", "错误!", "未创建会议,不能添加议程!");
                btnSubmit.Enabled = false;
                return;
            }
            if (Request.Form["item_number"] == "" || Request.Form["item_title"] == "" || Request.Form["item_time"] == "")
            {
                App_RegisterClientScriptBlock("infoMessage", "错误!", "填写内容不完整!");
                btnSubmit.Enabled = false;
                return;
            }

            T_meeting_item a_meeting_item = new T_meeting_item()
            {
                m_id           = Int32.Parse(Request.QueryString["m_id"].ToString()),
                item_title     = Request.Form["item_title"].ToString().Trim(),
                item_content   = HttpUtility.HtmlEncode(Request.Form["item_content"].ToString().Trim()),
                item_number    = Int32.Parse(Request.Form["item_number"]),
                item_time      = Int32.Parse(Request.Form["item_time"]),
                item_files_url = Session["files"] != null ? Session["files"].ToString() : null,
                item_state     = "未开始"
            };

            meeting_itemsContext.T_meeting_items.InsertOnSubmit(a_meeting_item);
            try
            {
                meeting_itemsContext.SubmitChanges();
                App_RegisterClientScriptBlock("infoMessage", "提示", "添加成功!");
                Response.Redirect("MeetingItems?m_id=" + m_id);
            }
            catch (Exception message)
            {
                App_RegisterClientScriptBlock("infoMessage", "错误", "添加失败!错误代码:" + message.Message);
            }
            //清空上传的文件名
            Session["files"] = null;
        }
        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');");
            }
        }
Example #4
0
        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>&nbsp;&nbsp;<a href=\"javascript:void(0);\" class=\"btn btn-link deleteOldLink\">删除</a></p><hr/></div>');");
                    }
                }
                runClientScript("btnOk", "$('button[type=submit]').removeClass('disabled')");
            }
        }
Example #5
0
        public void ProcessRequest(HttpContext context)
        {
            context.Response.ContentType = "text/plain";
            string m_id  = context.Request["m_id"] == null || context.Request["m_id"] == "" ? "-1" : context.Request["m_id"].ToString();
            string i_id  = context.Request["i_id"] == null || context.Request["i_id"] == "" ? "-1" : context.Request["i_id"].ToString();
            string i_num = context.Request["i_num"] == null || context.Request["i_num"] == "" ? "-1" :
                           context.Request["i_num"].ToString();
            string i_state = context.Request["i_state"] == null ? "" : context.Request["i_state"].ToString();
            string oper    = context.Request["operation"] == null ? "" : context.Request["operation"].ToString();
            string result  = "error";

            //1 已是第一个 2 已是最后一个 3 成功 other 失败
            if (i_state == "进行中")
            {
                result = "进行中,不允许操作!";
            }
            else
            {
                //查询最大序号值
                T_meeting_item item_max    = iDb.T_meeting_items.Where(m => m.m_id == Int32.Parse(m_id)).OrderByDescending(o => o.item_number).First();
                T_meeting_item item_select = iDb.T_meeting_items.Where(i => i.item_id == Int32.Parse(i_id)).SingleOrDefault();
                string         tempNum     = "-1";
                if (oper == "up" && Int32.Parse(i_num) > 1)
                {
                    T_meeting_item item_up = iDb.T_meeting_items.Where(m => m.m_id == Int32.Parse(m_id)).OrderByDescending(i => i.item_number).Where(i => i.item_number < Int32.Parse(i_num)).First();
                    //交换序号值
                    tempNum                 = item_up.item_number.ToString();
                    item_up.item_number     = item_select.item_number;
                    item_select.item_number = Int32.Parse(tempNum);
                    try
                    {
                        iDb.SubmitChanges();
                    }
                    catch (Exception)
                    {
                        result = "修改序号失败!";
                    }

                    result = "3";
                }
                else if (oper == "down" && Int32.Parse(i_num) < item_max.item_number)
                {
                    T_meeting_item item_down = iDb.T_meeting_items.Where(m => m.m_id == Int32.Parse(m_id)).OrderBy(i => i.item_number).Where(i => i.item_number > Int32.Parse(i_num)).First();
                    //交换序号值
                    tempNum = item_down.item_number.ToString();
                    item_down.item_number   = item_select.item_number;
                    item_select.item_number = Int32.Parse(tempNum);
                    try
                    {
                        iDb.SubmitChanges();
                    }
                    catch (Exception)
                    {
                        result = "修改序号失败!";
                    }
                    result = "3";
                }
                else if (oper == "up" && Int32.Parse(i_num) <= 1)
                {
                    result = "1";
                }
                else if (oper == "down" && Int32.Parse(i_num) >= item_max.item_number)
                {
                    result = "2";
                }
            }
            context.Response.Write(result);
        }