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 MySMS_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.         Response.Redirect("../SMSManager.aspx");
  43.         //if (!IsPostBack)
  44.         //{
  45.         //    MyDataBind(1);
  46.         //}
  47.       
  48.     }
  49.     /// <summary>
  50.     /// 获取信息
  51.     /// </summary>
  52.     /// <param name="pidx">页号</param>
  53.     public void MyDataBind(int pidx)
  54.     {
  55.         AspNetPager1.RecordCount = BR.GetCount(TiaoJian);
  56.         List<Model.Sms> LRData = BR.GetPageList(20, pidx, "ID", false, "ToId='"+SessionInclude.SessionId+"'");
  57.         if (LRData.Count == 0)
  58.         {
  59.             Model.Sms MR = new Model.Sms();
  60.             LRData.Add(MR);
  61.         }
  62.         GridView1.DataSource = LRData;
  63.         GridView1.DataBind();
  64.     }
  65.     /// <summary>
  66.     /// 状态
  67.     /// </summary>
  68.     /// <returns></returns>
  69.     public string zhuangtai()
  70.     {
  71.        
  72.             string Id = Eval("RemindFlag").ToString();
  73.         if(Id=="True")
  74.         {
  75.             return "未读";
  76.         }
  77.         else
  78.         {
  79.             return "已读";
  80.         }
  81.     }
  82.     /// <summary>
  83.     /// 操作
  84.     /// </summary>
  85.     /// <returns></returns>
  86.     public string CaoZuo()
  87.     {
  88.         string Id = Eval("Id").ToString();
  89.         //编辑 清空密码 删除
  90.         string Rtstr = "<a href='IKnow.aspx?id=" + Id + "'>我知道了</a>&nbsp;&nbsp;<a href='../SMSToUrl.aspx?id=" + Id + "'>前去办理</a>";
  91.         return Rtstr;
  92.     }
  93.     protected void AspNetPager1_PageChanging(object src, Wuqi.Webdiyer.PageChangingEventArgs e)
  94.     {
  95.         MyDataBind(e.NewPageIndex);
  96.     }
  97.     protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e)
  98.     {
  99.         for (int i = 0; i < GridView1.Rows.Count; i++)
  100.         {
  101.             //首先判断是否是数据行
  102.             if (e.Row.RowType == DataControlRowType.DataRow)
  103.             {
  104.                 //当鼠标停留时更改背景色
  105.                 e.Row.Attributes.Add("onmouseover", "c=this.style.backgroundColor;this.style.backgroundColor='#F0F0F0'");
  106.                 //当鼠标移开时还原背景色
  107.                 e.Row.Attributes.Add("onmouseout", "this.style.backgroundColor=c");
  108.             }
  109.         }
  110.     }
  111.     protected void CheckBox1_CheckedChanged(object sender, EventArgs e)
  112.     {
  113.         for (int i = 0; i <= GridView1.Rows.Count - 1; i++)
  114.         {
  115.             CheckBox cbox = (CheckBox)GridView1.Rows[i].FindControl("CheckBoxItem");
  116.             if (CheckBox1.Checked)
  117.             {
  118.                 cbox.Checked = true;
  119.             }
  120.             else
  121.             {
  122.                 cbox.Checked = false;
  123.             }
  124.         }
  125.     }
  126.     protected void DelButton1_Click(object sender, EventArgs e)
  127.     {
  128.         try
  129.         {
  130.             for (int i = 0; i <= GridView1.Rows.Count - 1; i++)
  131.             {
  132.                 CheckBox cbox = (CheckBox)GridView1.Rows[i].FindControl("CheckBoxItem");
  133.                 if (cbox.Checked)
  134.                 {
  135.                     int Id = int.Parse(GridView1.Rows[i].Cells[1].Text.ToString());
  136.                     BR.Delete(Id);
  137.                 }
  138.                 else
  139.                 {
  140.                 }
  141.             }
  142.             MessageBox.Show("删除完成!");
  143.         }
  144.         catch (Exception exp)
  145.         { MessageBox.Show(exp.Message); }
  146.         MyDataBind(AspNetPager1.CurrentPageIndex);
  147.     }
  148. }