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

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. public partial class SMS_SMSServer : System.Web.UI.Page
  12. {
  13.     /// <summary>
  14.     /// 模板 
  15.     /// </summary>
  16.     Model.SMSServer MR = new Model.SMSServer();
  17.     /// <summary>
  18.     /// 业务
  19.     /// </summary>
  20.     BLL.SMSServer BR = new BLL.SMSServer();
  21.     /// <summary>
  22.     /// 查询条件
  23.     /// </summary>
  24.     public string TiaoJian
  25.     {
  26.         get
  27.         {
  28.             if (ViewState["SMSServerTiaoJian"] == null)
  29.             {
  30.                 return "";
  31.             }
  32.             else
  33.             {
  34.                 return ViewState["SMSServerTiaoJian"].ToString();
  35.             }
  36.         }
  37.         set { ViewState["SMSServerTiaoJian"] = value; }
  38.     }
  39.     protected void Page_Load(object sender, EventArgs e)
  40.     {
  41.         if (!IsPostBack)
  42.         {
  43.             MyDataBind(1);
  44.         }
  45.     }
  46.     /// <summary>
  47.     /// 获取信息
  48.     /// </summary>
  49.     /// <param name="pidx">页号</param>
  50.     public void MyDataBind(int pidx)
  51.     {
  52.         AspNetPager1.RecordCount = BR.GetCount("FSDX='" + SessionInclude.SessionId + "'");
  53.         List<Model.SMSServer> LRData = BR.GetPageList(20, pidx, "ID", false, "FSDX='" + SessionInclude.SessionId + "'");
  54.         if (LRData.Count == 0)
  55.         {
  56.             Model.SMSServer MR = new Model.SMSServer();
  57.             LRData.Add(MR);
  58.         }
  59.         GridView1.DataSource = LRData;
  60.         GridView1.DataBind();
  61.     }
  62.     /// <summary>
  63.     /// 状态
  64.     /// </summary>
  65.     /// <returns></returns>
  66.     public string zhuangtai()
  67.     {
  68.         try
  69.         {
  70.             string Id = Eval("TSLX").ToString();
  71.             if (Id == "1")
  72.             {
  73.                 return "一次";
  74.             }
  75.             else
  76.             {
  77.                 return "无限";
  78.             }
  79.         }
  80.         catch { return ""; }
  81.     }
  82.     public string duanxin()
  83.     {
  84.         try
  85.         {
  86.             string Id = Eval("SFFSDX").ToString();
  87.             if (Id == "1")
  88.             {
  89.                 return "发送";
  90.             }
  91.             else
  92.             {
  93.                 return "不发送";
  94.             }
  95.         }
  96.         catch { return ""; }
  97.     }
  98.     /// <summary>
  99.     /// 操作
  100.     /// </summary>
  101.     /// <returns></returns>
  102.     public string CaoZuo()
  103.     {
  104.         string Id = Eval("Id").ToString();
  105.         //编辑 清空密码 删除
  106.         string Rtstr = "<a href='MySMSServerSendTo.aspx>新建提示</a>";
  107.         return Rtstr;
  108.     }
  109.     protected void AspNetPager1_PageChanging(object src, Wuqi.Webdiyer.PageChangingEventArgs e)
  110.     {
  111.         MyDataBind(e.NewPageIndex);
  112.     }
  113.     protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e)
  114.     {
  115.         for (int i = 0; i < GridView1.Rows.Count; i++)
  116.         {
  117.             //首先判断是否是数据行
  118.             if (e.Row.RowType == DataControlRowType.DataRow)
  119.             {
  120.                 //当鼠标停留时更改背景色
  121.                 e.Row.Attributes.Add("onmouseover", "c=this.style.backgroundColor;this.style.backgroundColor='#F0F0F0'");
  122.                 //当鼠标移开时还原背景色
  123.                 e.Row.Attributes.Add("onmouseout", "this.style.backgroundColor=c");
  124.             }
  125.         }
  126.     }
  127.     protected void CheckBox1_CheckedChanged(object sender, EventArgs e)
  128.     {
  129.         for (int i = 0; i <= GridView1.Rows.Count - 1; i++)
  130.         {
  131.             CheckBox cbox = (CheckBox)GridView1.Rows[i].FindControl("CheckBoxItem");
  132.             if (CheckBox1.Checked)
  133.             {
  134.                 cbox.Checked = true;
  135.             }
  136.             else
  137.             {
  138.                 cbox.Checked = false;
  139.             }
  140.         }
  141.     }
  142.     protected void DelButton1_Click(object sender, EventArgs e)
  143.     {
  144.         try
  145.         {
  146.             for (int i = 0; i <= GridView1.Rows.Count - 1; i++)
  147.             {
  148.                 CheckBox cbox = (CheckBox)GridView1.Rows[i].FindControl("CheckBoxItem");
  149.                 if (cbox.Checked)
  150.                 {
  151.                     int Id = int.Parse(GridView1.Rows[i].Cells[1].Text.ToString());
  152.                     BR.Delete(Id);
  153.                 }
  154.                 else
  155.                 {
  156.                 }
  157.             }
  158.             MessageBox.Show("删除完成!");
  159.         }
  160.         catch (Exception exp)
  161.         { MessageBox.Show(exp.Message); }
  162.         MyDataBind(AspNetPager1.CurrentPageIndex);
  163.     }
  164. }