RollFilesManager.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 FileBooks_RollFilesManager : System.Web.UI.Page
  12. {
  13. /// <summary>
  14.     /// 模板 
  15.     /// </summary>
  16.     Model.Rolls MR = new Model.Rolls();
  17.     /// <summary>
  18.     /// 业务
  19.     /// </summary>
  20.     BLL.Rolls BR = new BLL.Rolls();
  21.     /// <summary>
  22.     /// 查询条件
  23.     /// </summary>
  24.     public string TiaoJian
  25.     {
  26.         get
  27.         {
  28.             if (ViewState["RollsTiaoJian"] == null)
  29.             {
  30.                 return "";
  31.             }
  32.             else
  33.             {
  34.                 return ViewState["RollsTiaoJian"].ToString();
  35.             }
  36.         }
  37.         set { ViewState["RollsTiaoJian"] = value; }
  38.     }
  39.     protected void Page_Load(object sender, EventArgs e)
  40.     {
  41.         LoginLogic.MatchLoad("../", "FileBooks_RollFilesManager");
  42.         if (!IsPostBack)
  43.         {
  44.             TiaoJian = "";
  45.             if (Request.QueryString["TiaoJian"] != null)
  46.             {
  47.                 TiaoJian = Server.UrlDecode(Request.QueryString["TiaoJian"].ToString());
  48.             }
  49.             MyDataBind(1);
  50.         }
  51.       
  52.     }
  53.     /// <summary>
  54.     /// 获取信息
  55.     /// </summary>
  56.     /// <param name="pidx">页号</param>
  57.     public void MyDataBind(int pidx)
  58.     {
  59.         AspNetPager1.RecordCount = BR.GetCount(TiaoJian);
  60.         List<Model.Rolls> LRData = BR.GetPageList(20, pidx, "ID", false, TiaoJian);
  61.         if (LRData.Count == 0)
  62.         {
  63.             Model.Rolls MR = new Model.Rolls();
  64.    
  65.             LRData.Add(MR);
  66.         }
  67.         GridView1.DataSource = LRData;
  68.         GridView1.DataBind();
  69.     }
  70.         /// <summary>
  71.     /// 密级类别
  72.     /// </summary>
  73.     /// <returns></returns>
  74.     public string JuanAnMiJi()
  75.     {  if (Eval("JAMJ") != null)
  76.         {
  77.          return EnumGet.GetMiJiName(Eval("JAMJ").ToString());
  78.                      }
  79.         else
  80.         {
  81.             return "";
  82.         }
  83.     }
  84.     
  85.     /// <summary>
  86.     /// 凭证类别
  87.     /// </summary>
  88.     /// <returns></returns>
  89.     public string PingZhengLeiBie()
  90.     {
  91.          if (Eval("PZLB") != null)
  92.         {
  93.          return EnumGet.GetPingZhengName(Eval("PZLB").ToString());
  94.              }
  95.         else
  96.         {
  97.             return "";
  98.         }
  99.     }
  100.  
  101.     /// <summary>
  102.     /// 卷库
  103.     /// </summary>
  104.     /// <returns></returns>
  105.     public string SuoShuJuanKu()
  106.     {
  107.         if (Eval("SSJK") != null)
  108.         {
  109.             return EnumGet.GetRollRoomsName(int.Parse(Eval("SSJK").ToString()));
  110.         }
  111.         else
  112.         {
  113.             return "";
  114.         }
  115.     }
  116.     
  117.     /// <summary>
  118.     /// 操作
  119.     /// </summary>
  120.     /// <returns></returns>
  121.     public string CaoZuo()
  122.     {
  123.         string Id = Eval("Id").ToString();
  124.         //编辑 清空密码 删除
  125.         string Rtstr = "<a href='RollFilesAdd.aspx'>添加案卷</a>&nbsp;&nbsp;";
  126.         Rtstr += "<a href='RollFilesEdit.aspx?id=" + Id + "'>修改案卷信息</a>&nbsp;&nbsp;";
  127.         
  128.         return Rtstr;
  129.     }
  130.     protected void AspNetPager1_PageChanging(object src, Wuqi.Webdiyer.PageChangingEventArgs e)
  131.     {
  132.         MyDataBind(e.NewPageIndex);
  133.     }
  134.     protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e)
  135.     {
  136.         for (int i = 0; i < GridView1.Rows.Count; i++)
  137.         {
  138.             //首先判断是否是数据行
  139.             if (e.Row.RowType == DataControlRowType.DataRow)
  140.             {
  141.                 //当鼠标停留时更改背景色
  142.                 e.Row.Attributes.Add("onmouseover", "c=this.style.backgroundColor;this.style.backgroundColor='#F0F0F0'");
  143.                 //当鼠标移开时还原背景色
  144.                 e.Row.Attributes.Add("onmouseout", "this.style.backgroundColor=c");
  145.             }
  146.         }
  147.     }
  148.     protected void CheckBox1_CheckedChanged(object sender, EventArgs e)
  149.     {
  150.         for (int i = 0; i <= GridView1.Rows.Count - 1; i++)
  151.         {
  152.             CheckBox cbox = (CheckBox)GridView1.Rows[i].FindControl("CheckBoxItem");
  153.             if (CheckBox1.Checked)
  154.             {
  155.                 cbox.Checked = true;
  156.             }
  157.             else
  158.             {
  159.                 cbox.Checked = false;
  160.             }
  161.         }
  162.     }
  163.     protected void DelButton1_Click(object sender, EventArgs e)
  164.     {
  165.         try
  166.         {
  167.             for (int i = 0; i <= GridView1.Rows.Count - 1; i++)
  168.             {
  169.                 CheckBox cbox = (CheckBox)GridView1.Rows[i].FindControl("CheckBoxItem");
  170.                 if (cbox.Checked)
  171.                 {
  172.                     // Response.Write(GridView1.Rows[i].Cells[1].Text.ToString() + ":True");
  173.                     int Id = int.Parse(GridView1.Rows[i].Cells[1].Text.ToString());
  174.          
  175.                     BR.Delete(Id);
  176.                 }
  177.                 else
  178.                 {
  179.                     //  Response.Write((GridView1.Rows[i].Cells[1]).Text.ToString() + ":False");
  180.                 }
  181.             }
  182.             MessageBox.Show("删除完成!");
  183.         }
  184.         catch (Exception exp)
  185.         { MessageBox.Show(exp.Message); }
  186.         MyDataBind(AspNetPager1.CurrentPageIndex);
  187.     }
  188. }