//删除修改信息 protected void Repeater1_ItemCommand(object source, RepeaterCommandEventArgs e) { string id = e.CommandArgument.ToString(); if (e.CommandName == "Edit") { Response.Redirect("UpdateNotice.aspx?noticeid=" + id); } //现在方法 if (e.CommandName == "File") { EtNet_Models.NoticeInfo notice = NoticeInfoManager.getNoticeInfoById(Convert.ToInt32(id)); string filename = notice.Accressory.ToString(); EtNet_Models.FileInfo file = new EtNet_Models.FileInfo(); ////清空输出流 Response.Clear(); Response.Charset = "utf-8"; Response.Buffer = true; this.EnableViewState = false; ////定义输出文件编码及类型和文件名 Response.ContentEncoding = System.Text.Encoding.UTF8; Response.AppendHeader("Content-Disposition", "attachment;filename=" + filename.Substring(25)); ////因为保存的文件类型不限,此处类型选择“unknown”。 Response.ContentType = "application/unknown";; Response.WriteFile(filename); ////清空并关闭输出流 Response.Flush(); Response.Close(); Response.End(); } if (e.CommandName == "Delete") { try { int delCount = NoticeInfoManager.deleteNoticeInfo(Convert.ToInt32(id)); if (delCount > 0) { Page.ClientScript.RegisterStartupScript(this.GetType(), "", "<script>alert('删除成功!')</script>"); bindData(); } else { Page.ClientScript.RegisterStartupScript(this.GetType(), "", "<script>alert('删除失败发生异常!')</script>"); } } catch (Exception) { throw; } } }
private void LoadData(string ID) { NoticeInfo nt = new NoticeInfoManager().GetItemById(new Guid(ID)); txtID.Value = nt.ID.ToString(); txtCODE.Value = nt.CODE; txtCONTENT.Value = nt.CONTENT.ToString(); txtISTOP.Checked = nt.ISTOP.Value; txtISUSED.Checked = nt.ISTOP.Value; hidPUBDATE.Value = nt.PUBDATE; txtPUBUSER.Value = nt.PUBUSER; txtSOURCE.Value = nt.SOURCE; txtTITLE.Value = nt.TITLE; }
public void ProcessRequest(HttpContext context) { context.Response.ContentType = "text/plain"; NoticeInfoManager manager = new NoticeInfoManager(); int pageNum = int.Parse(context.Request.QueryString.Get("pagenum")); int pagesize = int.Parse(context.Request.QueryString.Get("pagesize")); int recordCount = 0; WhereClip where = null; DataTable dt = manager.GetDataTable(pageNum + 1, pagesize, where, " CODE ", ref pagesize, ref recordCount); //manager.GetDataTable(); string result = JsonConvert.Convert2Json(dt); context.Response.Write("{\"total\":\"" + recordCount.ToString() + "\",\"rows\":" + result + "}"); context.Response.End(); }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { //主要是先进了这里 然后就没有userId了 if (Request.QueryString["NoticeId"] != null)//判断是否是第一次加载 { int id = int.Parse(Request.QueryString["NoticeId"]); NoticeInfo notice = NoticeInfoManager.getNoticeInfoById(id); this.lblTitle.Text = notice.Title.ToString(); this.lblCreateMan.Text = notice.Fromuser.ToString(); this.lblBegin.Text = notice.Begintime.ToString(); this.lblEnd.Text = notice.Endtime.ToString(); this.lblContent.Text = notice.Context.ToString(); } } }
protected void Page_Load(object sender, EventArgs e) { string desc_tmpl = "信息来源:{0} 发稿作者:{1} 发布时间:{2} "; if (!IsPostBack) { NoticeInfo nr = new NoticeInfo(); NoticeInfoManager nrMgr = new NoticeInfoManager(); string id = Request.QueryString.Get("id"); if (!string.IsNullOrEmpty(id)) { nr = nrMgr.GetItemById(new Guid(id)); if (nr != null) { news_title.InnerHtml = nr.TITLE; news_desc.InnerHtml = string.Format(desc_tmpl, nr.SOURCE, nr.PUBUSER, nr.PUBDATE); news_content.InnerHtml = nr.CONTENT; } } } }
public void ProcessRequest(HttpContext context) { context.Response.ContentType = "text/plain"; HttpRequest rp = context.Request; string msg = string.Empty; try { if (string.IsNullOrEmpty(rp["ID"])) { msg = "请选择要删除的数据!"; } else { int i = new NoticeInfoManager().DelateById(new Guid(rp["ID"])); if (i > 0) { context.Response.Write("{\"success\":\"true\"}"); } else { context.Response.Write("{\"success\":\"true\"}"); msg = "删除失败!"; } } } catch (Exception ex) { msg = ex.Message; } if (!string.IsNullOrEmpty(msg)) { byte[] bytes = Encoding.UTF8.GetBytes(msg.Replace("\r\n", "<br/>")); string encode = Convert.ToBase64String(bytes); context.Response.Write("{\"success\":\"false\",\"msg\":\"" + encode + "\"}"); } context.Response.End(); }
protected void Page_Load(object sender, EventArgs e) { if (Session["UserName"] != null) { hid.Value = Session["UserName"].ToString(); } if (!IsPostBack) { NoticeInfoManager ntMgr = new NoticeInfoManager(); down.InnerText = "主办单位:长清公安分局"; string titlepix = "首页"; switch (Request.FilePath.ToLower()) { case "/indexxjsb.aspx": titlepix = "巡检设备"; break; case "/indexkaoqin.aspx": titlepix = "考勤统计"; break; case "/indexpaigong.aspx": titlepix = "派工统计"; break; case "/indexXjsb.aspx": titlepix = "巡检设备"; break; } ttt.Text = titlepix + "-长清公安分局运维综合管理系统"; //NoticeInfo notice = ntMgr.GetTopText(true); //string s = "<a style='color:#FFFFFF; ' href='newsinfo.aspx?id={0}'>{1}</a>"; //if (notice != null) //{ // hidZuiTopTongZhi.Value = string.Format(s, notice.ID, notice.TITLE); //} //NoticeInfo notice = ntMgr.GetTopText(false); //string s = "<a style='font-family:Microsoft YaHei;color:#FFFF00;font-size:24px;' href='newsinfo.aspx?id={0}'>{1}</a>"; //if (notice != null) //{ // hidTopTongZhid.Value = string.Format(s, notice.ID, notice.TITLE); //} WorkInfoManager wkMgr = new WorkInfoManager(); WhereClip where = WorkInfo._.Status == "制单"; OrderByClip order = WorkInfo._.CreateDate.Desc; int count = 0; if (Session["AllDepart"] != null) { List <AdministrativeRegions> list = Session["AllDepart"] as List <AdministrativeRegions>; if (list != null && list.Count > 0) { string[] dparr = new string[list.Count]; for (int i = 0; i < list.Count; i++) { dparr[i] = list[i].ID.ToString(); } if (WhereClip.IsNullOrEmpty(where)) { where = ShebeiInfo._.SocrceDepart.In(dparr); } else { where = where && ShebeiInfo._.SocrceDepart.In(dparr); } } } DataTable dtwk = wkMgr.GetGzDataTable(1, 4, where, order, ref count, ref count); string s = "<a style='font-family:Microsoft YaHei;color:#FFFF00;font-size:24px;' >{0}</a>"; string msg = string.Empty; if (dtwk == null || dtwk.Rows.Count == 0) { msg = "没有最新设备报修信息,所有报修设备信息都已派工"; } else { foreach (DataRow item in dtwk.Rows) { msg += item["Name"] + "(" + item["Code"] + "):" + item["Guzhang"]; msg += " | "; } } hidTopTongZhid.Value = string.Format(s, msg);; } }
public void ProcessRequest(HttpContext context) { context.Response.ContentType = "text/plain"; HttpRequest rp = context.Request; string msg = string.Empty; try { if (string.IsNullOrEmpty(rp["txtID"])) { entity.ID = Guid.NewGuid(); } else { entity.ID = new Guid(rp["txtID"]); entity.RecordStatus = StatusType.update; } entity.CODE = rp["txtCODE"]; entity.TITLE = rp["txtTITLE"]; entity.SOURCE = rp["txtSOURCE"]; entity.PUBDATE = rp["txtPUBDATE"]; entity.CONTENT = rp["txtCONTENT"]; entity.PUBUSER = rp["txtPUBUSER"]; entity.NOTE = rp["txtNOTE"]; entity.ISTOP = rp["txtISTOP"] == "on"; entity.ISUSED = rp["txtISUSED"] == "on"; //if (!string.IsNullOrEmpty(rp["txtParentId"]))//父ID传值参考 //{ // entity.ParentId = new Guid(rp["txtParentId"]); // } // entity.IsEnable = rp["txtIsEnable"] == "on";//checkbox传值参考 NoticeInfoManager manager = new NoticeInfoManager(); // bool IsExit = manager.ExitCodeAndName(entity);//重复校验参考 // if (IsExit) // { // msg = "已存在相同编号或名称!"; // } // else // { manager.Save(entity); context.Response.Write("{\"success\":\"true\",\"ID\":\"" + entity.ID + "\"}"); // } } catch (Exception ex) { msg = ex.Message; } if (!string.IsNullOrEmpty(msg)) { byte[] bytes = Encoding.UTF8.GetBytes(msg.Replace("\r\n", "<br/>")); string encode = Convert.ToBase64String(bytes); context.Response.Write("{\"success\":\"false\",\"msg\":\"" + encode + "\"}"); } context.Response.End(); }
/// <summary> /// 添加 /// </summary> private void AddMNew() { LoginInfo login = (LoginInfo)Session["login"]; NoticeInfo notice = new NoticeInfo(); notice.Title = this.txtTitle.Text.ToString(); notice.Begintime = DateTime.Parse(this.txtBegin.Text.ToString()); notice.Endtime = DateTime.Parse(this.txtEnd.Text.ToString()); notice.Context = Request.Form["content"].ToString(); notice.Fromuser = login.Cname.ToString(); notice.Accressory = null; notice.Sortid = new SortInfo() { Sortid = int.Parse(this.ddlSor.SelectedValue) }; notice.Accressory = this.FileUrl.ToString(); if (this.rbtn1.Checked) { notice.Attribute = 0; } else { notice.Attribute = 1; } if (rbAll.Checked) { notice.Ifpublic = 0; } else { notice.Ifpublic = 1; } int conut = NoticeInfoManager.addNoticeInfo(notice); string strSql = "select top 1 * from NoticeInfo order by noticeid desc"; int maxid = 0; EtNet_Models.NoticeInfo model = EtNet_BLL.NoticeInfoManager.getNoticeInfoBySql(strSql); if (model != null) { maxid = model.Noticeid; EtNet_Models.NoticeShare modelshare = null; for (int i = 0; i < this.lbToUser.Items.Count; i++) { modelshare = new NoticeShare(); modelshare.acceptid = int.Parse(this.lbToUser.Items[i].Value); modelshare.noticeid = maxid; EtNet_BLL.NoticeShareManager.Add(modelshare); } } if (conut > 0) { this.Page.ClientScript.RegisterStartupScript(this.GetType(), "", "alert('添加成功!');location.href='../Message/Notice.aspx'", true); } else { ScriptManager.RegisterStartupScript(this, GetType(), "key", "alert('添加失败!')", true); } }
protected void Page_Load(object sender, EventArgs e) { string tmpl = @" <tr> <td height='25' align='left' valign='middle' > <img src='css/images/biao.gif' /> <a href='{0}' target='_blank' title='标题:中央下达的重要文件请各小组查看'>{1}</a> <font class='red'>★</font> </td> </tr>"; string wrtmpl = @" <tr> <td width='65' height='28' align='center' valign='middle' > <div class='book_kk' style='width:55px;'>√{0}</div> </td> <td align='left' valign='middle' > {1}: <a href='indexworkinfo.aspx?id={6}' target='_blank'> {2} </a> </td> <td width='100' align='center' valign='middle' >{3}</td> <td width='140' align='center' valign='middle' >{4}</td> <td width='120' align='left' valign='middle' >{5}</td> </tr>"; string sbtmpl = @" <tr> <td height='30' align='center' bgcolor='#FFFFFF' class='zx'>{0}</td> <td align='center' bgcolor='#FFFFFF' class='zx'> <font class='book_kk'>{1}</font><!--故障设备置顶--></td> <td align='center' bgcolor='#FFFFFF' class='zx'>{2}</td> <td align='center' bgcolor='#FFFFFF' class='zx'>{3}</td> <td align='center' bgcolor='#FFFFFF' class='zx'>共<span class='title12b'>{4}</span>次故障</td> <td align='center' bgcolor='#FFFFFF' class='zx'>共<span class='title12b'>{5}</span>次更换</td> </tr>"; if (!IsPostBack) { #region 格式化新闻 NoticeInfoManager ntMgr = new NoticeInfoManager(); string result = "<table width='100%' border='0' align='center' cellpadding='0' cellspacing='0'>"; int count = 0; DataTable dt = ntMgr.GetDataTable(1, 5, "ISTOP", ref count, ref count); foreach (DataRow row in dt.Rows) { result += string.Format(tmpl, "newsinfo.aspx?id=" + row["ID"].ToString(), row["TITLE"]); } result += "</table>"; news_wrap.InnerHtml = result; #endregion // #region 格式化派工http://www.ycfarm.com/sbbx/images/top_b.gif // string worinfohtml = "<table width='100%' border='0' align='center' cellpadding='0' cellspacing='0'> "; // WorkInfoManager wkMgr = new WorkInfoManager(); // WhereClip where = null;// WorkInfo._.Status != "完成"; // if ( Session["AllDepart"] != null) // { // List<AdministrativeRegions> list = Session["AllDepart"] as List<AdministrativeRegions>; // if (list != null && list.Count > 0) // { // string[] dparr = new string[list.Count]; // for (int j = 0; j < list.Count; j++) // { // dparr[j] = list[j].ID.ToString(); // } // if (WhereClip.IsNullOrEmpty(where)) // { // where = ShebeiInfo._.SocrceDepart.In(dparr); // } // else // { // where = where && ShebeiInfo._.SocrceDepart.In(dparr); // } // } // } // OrderByClip order = WorkInfo._.CreateDate.Desc; // DataTable dtwk = wkMgr.GetDataTable(1, 4, where, order, ref count, ref count); // // DataTable dtwk = wkMgr.GetDataTable(); //int i = 0; // foreach (DataRow row in dtwk.Rows) // { // i++; // if (i > 4) break; // string gzxx = row["GuZhangXx"].ToString(); // if (gzxx.Length > 10) // { // gzxx = gzxx.Substring(0, 10); // } // string clyj = row["ChuLiYijian"].ToString(); // if (clyj.Length > 10) // { // clyj = clyj.Substring(0, 10); // } // worinfohtml += string.Format(wrtmpl, row["Status"].ToString(), row["CreaterName"].ToString(), gzxx, row["CurrentUser"].ToString(), clyj, ((DateTime)row["CreateDate"]).ToString("yyyy-MM-dd"), row["ID"]); // } // worinfohtml += "</table>"; // workinfo.InnerHtml = worinfohtml; // #endregion // string sresult = // @"<table width='100%' border='0' cellpadding='0' cellspacing='0' class='dx'> // <tbody><tr> // <td width='12%' height='25' align='center' bgcolor='#F8F8F8' class='zx'>编号</td> // <td width='14%' align='center' bgcolor='#F8F8F8' class='zx'>设备状态</td> // <td width='22%' align='center' bgcolor='#F8F8F8' class='zx'>设备名称</td> // <td width='16%' align='center' bgcolor='#F8F8F8' class='zx'>缩略图</td> // <td width='18%' align='center' bgcolor='#F8F8F8' class='zx'>故障统计</td> // <td width='18%' align='center' bgcolor='#F8F8F8' class='zx'>更换统计</td> // </tr>"; // ShebeiInfoManager sbMgr = new ShebeiInfoManager(); // DataTable dt_sb = sbMgr.GetWaiBuDataTable(); // int scount = 0; // foreach (DataRow row in dt_sb.Rows) // { // scount++; // if (scount > 10) break; // string img_html = string.Empty; // //OAManager.FileInfoManager flMgr = new FileInfoManager(); // //DataTable dtimg = flMgr.GetDataTable(row["ID"].ToString()); // //string img_html = string.Empty; // //if (dtimg.Rows.Count > 0) // //{ // // string src = dtimg.Rows[0]["FILEPATH"].ToString(); // // img_html = "<a href='" + src + "'><img src='" + src + "' width='50' height='40' alt='图标'></a>"; // //} // //else // //{ // // img_html = "无缩略图"; // //} // sresult += string.Format(sbtmpl, row["Code"].ToString(), row["State"].ToString(), "<a href='" + row["PATH"].ToString() + "' target='sbiframe'>" + row["Name"].ToString() + "</a>", img_html, row["GZTJ"].ToString(), row["GHTJ"].ToString()); // } // sresult += "</tbody></table>"; // //sbinfo.InnerHtml = sresult; // dt_sb = sbMgr.GetNeiBuDataTable(); // sresult = // @"<table width='100%' border='0' cellpadding='0' cellspacing='0' class='dx'> // <tbody><tr> // <td width='12%' height='25' align='center' bgcolor='#F8F8F8' class='zx'>编号</td> // <td width='14%' align='center' bgcolor='#F8F8F8' class='zx'>设备状态</td> // <td width='22%' align='center' bgcolor='#F8F8F8' class='zx'>设备名称</td> // <td width='16%' align='center' bgcolor='#F8F8F8' class='zx'>缩略图</td> // <td width='18%' align='center' bgcolor='#F8F8F8' class='zx'>故障统计</td> // <td width='18%' align='center' bgcolor='#F8F8F8' class='zx'>更换统计</td> // </tr>"; // scount = 0; // foreach (DataRow row in dt_sb.Rows) // { // scount++; // if (scount > 10) break; // string img_html = string.Empty; // //OAManager.FileInfoManager flMgr = new FileInfoManager(); // //DataTable dtimg = flMgr.GetDataTable(row["ID"].ToString()); // //string img_html = string.Empty; // //if (dtimg.Rows.Count > 0) // //{ // // string src = dtimg.Rows[0]["FILEPATH"].ToString(); // // img_html = "<a href='" + src + "'><img src='" + src + "' width='50' height='40' alt='图标'></a>"; // //} // //else // //{ // // img_html = "无缩略图"; // //} // sresult += string.Format(sbtmpl, row["Code"].ToString(), row["State"].ToString(), "<a href='" + row["PATH"].ToString() + "' target='sbiframe'>" + row["Name"].ToString() + "</a>", img_html, row["GZTJ"].ToString(), row["GHTJ"].ToString()); // } // sresult += "</tbody></table>"; // //sbnbinfo.InnerHtml = sresult; } }