SMSManager.aspx.cs
上传用户:simon2hong
上传日期:2021-11-18
资源大小:16746k
文件大小:4k
源码类别:

OA系统

开发平台:

C#

  1. using System;
  2. using System.Data;
  3. using System.Configuration;
  4. using System.Collections.Generic;
  5. using System.Web;
  6. using System.Web.Security;
  7. using System.Web.UI;
  8. using System.Web.UI.WebControls;
  9. using System.Web.UI.WebControls.WebParts;
  10. using System.Web.UI.HtmlControls;
  11. using System.IO;
  12. public partial class SMS_SMSManager : System.Web.UI.Page
  13. {
  14.     /// <summary>
  15.     /// 模板 
  16.     /// </summary>
  17.     Model.Sms MR = new Model.Sms();
  18.     /// <summary>
  19.     /// 业务
  20.     /// </summary>
  21.     BLL.Sms BR = new BLL.Sms();
  22.     /// <summary>
  23.     /// 查询条件
  24.     /// </summary>
  25.     public string TiaoJian
  26.     {
  27.         get
  28.         {
  29.             if (ViewState["FilesTiaoJian"] == null)
  30.             {
  31.                 return "";
  32.             }
  33.             else
  34.             {
  35.                 return ViewState["FilesTiaoJian"].ToString();
  36.             }
  37.         }
  38.         set { ViewState["FilesTiaoJian"] = value; }
  39.     }
  40.     protected void Page_Load(object sender, EventArgs e)
  41.     {
  42.         if (!IsPostBack)
  43.         {
  44.             MyDataBind(1);
  45.         }
  46.       
  47.     }
  48.     /// <summary>
  49.     /// 获取信息
  50.     /// </summary>
  51.     /// <param name="pidx">页号</param>
  52.     public void MyDataBind(int pidx)
  53.     {
  54.         AspNetPager1.RecordCount = BR.GetCount(TiaoJian);
  55.         List<Model.Sms> LRData = BR.GetPageList(20, pidx, "ID", false, "ToId='"+SessionInclude.SessionId+"' and type=0");
  56.         if (LRData.Count == 0)
  57.         {
  58.             Model.Sms MR = new Model.Sms();
  59.             LRData.Add(MR);
  60.         }
  61.         GridView1.DataSource = LRData;
  62.         GridView1.DataBind();
  63.     }
  64.     /// <summary>
  65.     /// 状态
  66.     /// </summary>
  67.     /// <returns></returns>
  68.     public string zhuangtai()
  69.     {
  70.        
  71.             string Id = Eval("RemindFlag").ToString();
  72.         if(Id=="True")
  73.         {
  74.             return "未读";
  75.         }
  76.         else
  77.         {
  78.             return "已读";
  79.         }
  80.     }
  81.     /// <summary>
  82.     /// 操作
  83.     /// </summary>
  84.     /// <returns></returns>
  85.     public string CaoZuo()
  86.     {
  87.         string Id = Eval("Id").ToString();
  88.         //编辑 清空密码 删除
  89.         string Rtstr = "<a href='IKnow.aspx?id=" + Id + "'>我知道了</a>&nbsp;&nbsp;<a href='../SMSToUrl.aspx?id=" + Id + "'>前去办理</a>";
  90.         return Rtstr;
  91.     }
  92.     protected void AspNetPager1_PageChanging(object src, Wuqi.Webdiyer.PageChangingEventArgs e)
  93.     {
  94.         MyDataBind(e.NewPageIndex);
  95.     }
  96.     protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e)
  97.     {
  98.         for (int i = 0; i < GridView1.Rows.Count; i++)
  99.         {
  100.             //首先判断是否是数据行
  101.             if (e.Row.RowType == DataControlRowType.DataRow)
  102.             {
  103.                 //当鼠标停留时更改背景色
  104.                 e.Row.Attributes.Add("onmouseover", "c=this.style.backgroundColor;this.style.backgroundColor='#F0F0F0'");
  105.                 //当鼠标移开时还原背景色
  106.                 e.Row.Attributes.Add("onmouseout", "this.style.backgroundColor=c");
  107.             }
  108.         }
  109.     }
  110.     protected void CheckBox1_CheckedChanged(object sender, EventArgs e)
  111.     {
  112.         for (int i = 0; i <= GridView1.Rows.Count - 1; i++)
  113.         {
  114.             CheckBox cbox = (CheckBox)GridView1.Rows[i].FindControl("CheckBoxItem");
  115.             if (CheckBox1.Checked)
  116.             {
  117.                 cbox.Checked = true;
  118.             }
  119.             else
  120.             {
  121.                 cbox.Checked = false;
  122.             }
  123.         }
  124.     }
  125.     protected void DelButton1_Click(object sender, EventArgs e)
  126.     {
  127.         try
  128.         {
  129.             for (int i = 0; i <= GridView1.Rows.Count - 1; i++)
  130.             {
  131.                 CheckBox cbox = (CheckBox)GridView1.Rows[i].FindControl("CheckBoxItem");
  132.                 if (cbox.Checked)
  133.                 {
  134.                     int Id = int.Parse(GridView1.Rows[i].Cells[1].Text.ToString());
  135.                     BR.Delete(Id);
  136.                 }
  137.                 else
  138.                 {
  139.                 }
  140.             }
  141.             MessageBox.Show("删除完成!");
  142.         }
  143.         catch (Exception exp)
  144.         { MessageBox.Show(exp.Message); }
  145.         MyDataBind(AspNetPager1.CurrentPageIndex);
  146.     }
  147. }