AttenDanceManager.aspx.cs
上传用户:simon2hong
上传日期:2021-11-18
资源大小:16746k
文件大小:4k
- using System;
- using System.Data;
- using System.Configuration;
- using System.Collections;
- 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;
- using System.Collections.Generic;
- public partial class AttenDanceManager : System.Web.UI.Page
- {
- /// <summary>
- /// 模板
- /// </summary>
- Model.AttenDance MR = new Model.AttenDance();
- /// <summary>
- /// 业务
- /// </summary>
- BLL.AttenDance BR = new BLL.AttenDance();
- /// <summary>
- /// 查询条件
- /// </summary>
- public string TiaoJian
- {
- get
- {
- if (ViewState["UseThingsTiaoJian"] == null)
- {
- return "";
- }
- else
- {
- return ViewState["UseThingsTiaoJian"].ToString();
- }
- }
- set { ViewState["UseThingsTiaoJian"] = value; }
- }
- protected void Page_Load(object sender, EventArgs e)
- {
- LoginLogic.MatchLoad("../", "AttenDanceManager");
- if (!IsPostBack)
- {
- TiaoJian = "";
- if (Request.QueryString["TiaoJian"] != null)
- {
- TiaoJian = Server.UrlDecode(Request.QueryString["TiaoJian"].ToString());
- }
- MyDataBind(1);
- }
- }
- /// <summary>
- /// 获取信息
- /// </summary>
- /// <param name="pidx">页号</param>
- public void MyDataBind(int pidx)
- {
- AspNetPager1.RecordCount = BR.GetCount(TiaoJian);
- List<Model.AttenDance> LRData = BR.GetPageList(20, pidx, "ID", false, TiaoJian);
- if (LRData.Count == 0)
- {
- Model.AttenDance MR = new Model.AttenDance();
- LRData.Add(MR);
- }
- GridView1.DataSource = LRData;
- GridView1.DataBind();
- }
- /// <summary>
- /// 部门
- /// </summary>
- /// <returns></returns>
- public string YPLB()
- {
- int Id = int.Parse(Eval("YPLB").ToString());
- return EnumGet.GetUseThingsTypeName(Id);
- }
- /// <summary>
- /// 操作
- /// </summary>
- /// <returns></returns>
- public string GuiDingShiJian()
- {
- string Rtstr = "08:30:00";
- try
- {
- string KQLX = Eval("KQLX").ToString();
- Model.AttenDanceRole MADR = new BLL.AttenDanceRole().GetPageList(1, 1, "ID", false, " KQLX='" + KQLX + "'")[0];
- Rtstr = MADR.GDSJ.ToString("HH:mm:ss");
- }
- catch { }
- return Rtstr;
- }
- 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");
- }
- }
- }
- protected void Button1_Click(object sender, EventArgs e)
- {
- string SqlStr = "";
- SqlStr += " DJR like '" + RP.SDot(KeyValue_UserName.Text) + "%' and";
- SqlStr += " KQLX like '" + RP.SDot(DropDownList1.Text) + "%' ";
- if ((DateTimeTextBox1.Text != "") && (DateTimeTextBox2.Text != ""))
- {
- SqlStr += " and DJSJ >='" + DateTimeTextBox1.Text + "' and DJSJ<='" + DateTimeTextBox2.Text + "'";
- }
- TiaoJian = SqlStr;
- MyDataBind(1);
- }
- }