TXLSMS.aspx.cs
上传用户:simon2hong
上传日期:2021-11-18
资源大小:16746k
文件大小:6k
- using System;
- using System.Data;
- using System.Configuration;
- using System.Collections.Generic;
- using System.Web;
- using System.Web.Security;
- using System.Web.UI;
- using System.Web.UI.WebControls;
- using System.Web.UI.WebControls.WebParts;
- using System.Web.UI.HtmlControls;
- public partial class TXLSMS : System.Web.UI.Page
- {
- /// <summary>
- /// 模板
- /// </summary>
- public Model.Users MU = new Model.Users();
- /// <summary>
- /// 业务
- /// </summary>
- public BLL.Users BU = new BLL.Users();
- /// <summary>
- /// 模板
- /// </summary>
- Model.Department MD = new Model.Department();
- /// <summary>
- /// 业务
- /// </summary>
- BLL.Department BD = new BLL.Department();
- /// <summary>
- /// 查询条件
- /// </summary>
- public string TiaoJian = "";
- protected void Page_Load(object sender, EventArgs e)
- {
- LoginLogic.MatchLoad("../", "TXLSMS");
- if (!IsPostBack)
- {
- TreeLoadSet();
- TiaoJian = "";
- MyDataBind(1);
- }
- }
- /// <summary>
- /// 获取信息
- /// </summary>
- /// <param name="pidx">页号</param>
- public void MyDataBind(int pidx)
- {
- AspNetPager1.RecordCount = BU.GetCount(TiaoJian);
- GridView1.DataSource = BU.GetPageList(20, pidx, "ID", false, TiaoJian);
- GridView1.DataBind();
- }
- protected void AspNetPager1_PageChanging(object src, Wuqi.Webdiyer.PageChangingEventArgs e)
- {
- MyDataBind(e.NewPageIndex);
- }
- protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e)
- {
- for (int i = 0; i < GridView1.Rows.Count; i++)
- {
- //首先判断是否是数据行
- if (e.Row.RowType == DataControlRowType.DataRow)
- {
- //当鼠标停留时更改背景色
- e.Row.Attributes.Add("onmouseover", "c=this.style.backgroundColor;this.style.backgroundColor='#F0F0F0'");
- //当鼠标移开时还原背景色
- e.Row.Attributes.Add("onmouseout", "this.style.backgroundColor=c");
- }
- }
- }
- /// <summary>
- /// 角色
- /// </summary>
- /// <returns></returns>
- public string JueSe()
- {
- int Id = int.Parse(Eval("PrivId").ToString());
- return OACommon.GetRole(Id);
-
- }
- /// <summary>
- /// 操作
- /// </summary>
- /// <returns></returns>
- public string CaoZuo()
- {
- string Id = Eval("Id").ToString();
- //编辑 清空密码 删除
- string Rtstr = "<a href='UserInfo.aspx?id=" + Id + "'>编辑</a> ";
- Rtstr += "<a href='UserInfo.aspx?id=" + Id + "'>清空密码</a> ";
- Rtstr += "<a href='UserInfo.aspx?id=" + Id + "'>删除</a> ";
- return Rtstr;
- }
-
- protected void TreeLoadSet()
- {
- TreeView1.Nodes.Clear();
- object objcount = OACommon.HLP.ExecuteScalar(CommandType.Text, "select max(parentdept) from department", null);
- if (objcount != null)
- {
- int AllCount = int.Parse(objcount.ToString());//最深的ID
- List<Model.Department> DPMT = BD.GetList();
- foreach (Model.Department MD in DPMT)
- {
- if (MD.ParentDept == 0)
- {
- TreeNode tn = new TreeNode();
- tn.Text = MD.DeptName;
- tn.Value = MD.ID.ToString();
- tn.ImageUrl = "~/images/node_dept.gif";
- TreeView1.Nodes.Add(tn);
- }
- }
- foreach (TreeNode tn in TreeView1.Nodes)
- {
- CallMeTree(tn);
- }
- }
- }
- /// <summary>
- /// 递归调用
- /// </summary>
- /// <param name="MaxDep"></param>
- /// <param name="DepId"></param>
- public void CallMeTree(TreeNode TNId)
- {
- List<Model.Department> DPMT = BD.GetList();
- foreach (Model.Department MD in DPMT)
- {
- if (MD.ParentDept.ToString() == TNId.Value)
- {
- TreeNode tn = new TreeNode();
- tn.Text = MD.DeptName;
- tn.Value = MD.ID.ToString();
- tn.ImageUrl = "~/images/node_dept.gif";
- // Console.WriteLine(TreeView1.ExpandDepth.ToString());
- TNId.ChildNodes.Add(tn);
- int Count = BD.GetCount("ParentDept=" + tn.Value);
- if (Count > 0)
- {
- CallMeTree(tn);
- }
- }
- }
- }
- protected void TreeView1_SelectedNodeChanged(object sender, EventArgs e)
- {
- TiaoJian = "DeptId="+TreeView1.SelectedValue;
- MyDataBind(1);
- }
- protected void CheckBox1_CheckedChanged(object sender, EventArgs e)
- {
- for (int i = 0; i <= GridView1.Rows.Count - 1; i++)
- {
- CheckBox cbox = (CheckBox)GridView1.Rows[i].FindControl("CheckBoxItem");
- if (CheckBox1.Checked)
- {
- cbox.Checked = true;
- }
- else
- {
- cbox.Checked = false;
- }
- }
- }
- protected void DelButton1_Click(object sender, EventArgs e)
- {
- try
- {
- for (int i = 0; i <= GridView1.Rows.Count - 1; i++)
- {
- CheckBox cbox = (CheckBox)GridView1.Rows[i].FindControl("CheckBoxItem");
- if (cbox.Checked)
- {
- SMSSend.Send(SessionInclude.SessionId, GridView1.Rows[i].Cells[2].Text.ToString(), Info_TextBox.Text, "SMS/SMSManager.aspx", SMSType.普通发送);
- if (CheckBox2.Checked)
- {
- SMSSend.Send(SessionInclude.SessionId, GridView1.Rows[i].Cells[2].Text.ToString(), Info_TextBox.Text, "SMS/SMSManager.aspx", SMSType.短信发送);
- }
-
- }
-
- }
- MessageBox.Show("发送完成!");
- }
- catch (Exception exp)
- { MessageBox.Show(exp.Message); }
- MyDataBind(AspNetPager1.CurrentPageIndex);
- }
- }