MyAttenDance.aspx.cs
上传用户:simon2hong
上传日期:2021-11-18
资源大小:16746k
文件大小:6k
- 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 MyAttenDance : 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["MyAttenDanceTiaoJian"] == null)
- {
- return "";
- }
- else
- {
- return ViewState["MyAttenDanceTiaoJian"].ToString();
- }
- }
- set { ViewState["MyAttenDanceTiaoJian"] = value; }
- }
- protected void Page_Load(object sender, EventArgs e)
- {
- LoginLogic.MatchLoad("../", "MyAttenDance");
- if (!IsPostBack)
- {
- LoginLogic.MatchLoad("../", "MyAttenDance");
- 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)
- {
- TiaoJian = "DJR='"+SessionInclude.SessionId+"'";
- 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:00: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)
- {
- int logincount = BR.GetCount("convert(varchar(10),DJSJ,120)='" + DateTime.Now.ToString("yyyy-MM-dd") + "' and KQLX='上班' and DJR='" + SessionInclude.SessionId+"'");
- if (logincount > 0)
- {
- MessageBox.Show("您今天已经进行过一次上班登记!");
- return;
- }
- MR = new Model.AttenDance();
- MR.DJR = SessionInclude.SessionId;
- MR.DJSJ = DateTime.Now;
- MR.KQLX = "上班";
- BR.Add(MR);
- MyDataBind(AspNetPager1.CurrentPageIndex);
- MessageBox.Show("上班登记成功!");
- }
- //下班登记
- protected void Button2_Click(object sender, EventArgs e)
- {
- int logincount = BR.GetCount("convert(varchar(10),DJSJ,120)='" + DateTime.Now.ToString("yyyy-MM-dd") + "' and KQLX='下班' and DJR='" + SessionInclude.SessionId + "'");
- if (logincount > 0)
- {
- MessageBox.Show("您今天已经进行过一次下班登记!");
- return;
- }
- MR = new Model.AttenDance();
- MR.DJR = SessionInclude.SessionId;
- MR.DJSJ = DateTime.Now;
- MR.KQLX = "下班";
- BR.Add(MR);
- MyDataBind(AspNetPager1.CurrentPageIndex);
- MessageBox.Show("下班登记成功!");
- }
- //外出登记
- protected void Button3_Click(object sender, EventArgs e)
- {
- MR = new Model.AttenDance();
- MR.DJR = SessionInclude.SessionId;
- MR.DJSJ = DateTime.Now;
- MR.KQLX = "外出";
- BR.Add(MR);
- MyDataBind(AspNetPager1.CurrentPageIndex);
- MessageBox.Show("外出登记成功!");
- }
- //请假登记
- protected void Button4_Click(object sender, EventArgs e)
- {
- MR = new Model.AttenDance();
- MR.DJR = SessionInclude.SessionId;
- MR.DJSJ = DateTime.Now;
- MR.KQLX = "请假";
- BR.Add(MR);
- MyDataBind(AspNetPager1.CurrentPageIndex);
- MessageBox.Show("请假登记成功!");
- }
- //出差登记
- protected void Button5_Click(object sender, EventArgs e)
- {
- MR = new Model.AttenDance();
- MR.DJR = SessionInclude.SessionId;
- MR.DJSJ = DateTime.Now;
- MR.KQLX = "出差";
- BR.Add(MR);
- MyDataBind(AspNetPager1.CurrentPageIndex);
- MessageBox.Show("出差登记成功!");
- }
- }