예제 #1
0
파일: Desktop.aspx.cs 프로젝트: youye00/UDS
        private void DutyOperation()
        {
            //try
            //{
            WA_Duty wd   = new WA_Duty(Int32.Parse(Request.Cookies["UserID"].Value.Trim()));
            int     Duty = wd.HaveCompletedDuty(DateTime.Now);

            //检查当天是否已经完成上班考勤
            if (Duty == -1)
            {
                if (wd.CheckStatus(DutyAction.OnDuty))                        //没有迟到
                {
                    wd.RecordOnDutyData(DateTime.Now, true, "").ToString();
                    //弹出新页面表示成功
                    Response.Write("<script language=javascript>window.open('../WorkAttendance/checksucessful.aspx?login=in','_blank','height=200,width=400,status=no,toolbar=no,menubar=no,location=no')</script>");
                }
                else                        //迟到
                {
                    //跳转到填写理由页面
                    Response.Redirect("../WorkAttendance/Default.aspx?notnormal=1&login=in");
                }
            }
            //}
            //catch(Exception ex)
            //{
            //    //UDS.Components.Error.Log(ex.Message);
            //    //Server.Transfer("../Error.aspx");
            //}
        }
예제 #2
0
        private void Page_Load(object sender, System.EventArgs e)
        {
            //考勤操作
            try
            {
                WA_Duty wd       = new WA_Duty(Int32.Parse(Request.Cookies["UserID"].Value.Trim()));
                int     DutyStat = 0;
                DutyStat = wd.HaveCompletedDuty(DateTime.Now);
                //检查当天是否已经完成上班考勤
                if ((DutyStat != -1) && (DutyStat != 0))
                {
                    if (wd.CheckStatus(DutyAction.OffDuty))                            //没有早退
                    {
                        wd.RecordOffDutyData(DutyStat, DateTime.Now, true, "");
                        //弹出新页面表示成功
                        Response.Write("<script language=javascript>window.open('../WorkAttendance/checksucessful.aspx?login=out','_blank','height=200,width=400,status=no,toolbar=no,menubar=no,location=no')</script>");
                    }
                    else                            //早退
                    {
                        //跳转到填写理由页面
                        Response.Write("<script language=javascript>location.href='../WorkAttendance/Default.aspx?notnormal=1&login=out';</script>");
                    }
                }
                Response.Write("<script>window.parent.parent.location.href='logout.aspx';</script>");
            }

            catch (Exception ex)
            {
                UDS.Components.Error.Log(ex.Message);
                Server.Transfer("../Error.aspx");
            }
        }
예제 #3
0
파일: Default.aspx.cs 프로젝트: youye00/UDS
 private void Page_Load(object sender, System.EventArgs e)
 {
     if (!Page.IsPostBack)
     {
         staffid = Int32.Parse(Request.Cookies["UserID"].Value.Trim());
         //如果用户登陆并迟到
         if (Request.QueryString["notnormal"] != null)
         {
             if ((Request.QueryString["login"] != null) && (Request.QueryString["login"].ToString() == "in"))
             {
                 btnCheckAttendance.Text = "上班";
                 DutyStatus = true;
                 btnCheckAttendance.CommandArgument = "notnormal";
                 lblDutyMessage.Text       = "上班迟到,请填写理由!";
                 txtAttendanceMemo.Visible = true;
             }
             else if ((Request.QueryString["login"] != null) && (Request.QueryString["login"].ToString() == "out"))
             {
                 btnCheckAttendance.Text = "下班";
                 DutyStatus = false;
                 btnCheckAttendance.CommandArgument = "notnormal";
                 lblDutyMessage.Text       = "下班早退,请填写理由!";
                 txtAttendanceMemo.Visible = true;
             }
         }
         else                  //检查用户是否已经考勤
         {
             WA_Duty wd = new WA_Duty(Int32.Parse(Request.Cookies["UserID"].Value.Trim()));
             if (wd.HaveCompletedDuty(DateTime.Now) == 0)
             {
                 lblDutyMessage.Text        = "你已经完成了今天的考勤!";
                 btnCheckAttendance.Visible = false;
             }
             else
             {
                 if (!wd.HaveCheckedDuty(DateTime.Now))
                 {
                     btnCheckAttendance.Text = "上班";
                     DutyStatus = true;
                 }
                 else
                 {
                     btnCheckAttendance.Text = "下班";
                     DutyStatus = false;
                 }
             }
         }
         //显示时间
         lbl_Hour.Text   = DateTime.Now.Hour.ToString();
         lbl_Minute.Text = DateTime.Now.Minute.ToString();
         lbl_Second.Text = DateTime.Now.Second.ToString();
         //显示本星期的考勤数据
         GridBind();
     }
     else
     {
         btnCheckAttendance.Text = "正在处理。。。。";
     }
 }
예제 #4
0
파일: Default.aspx.cs 프로젝트: youye00/UDS
 protected void btnCheckAttendance_Click(object sender, System.EventArgs e)
 {
     try
     {
         WA_Duty wd = new WA_Duty(Int32.Parse(Request.Cookies["UserID"].Value.Trim()));
         //检查当天是否已经完成考勤
         int Duty = wd.HaveCompletedDuty(DateTime.Now);
         if (Duty == 0)
         {
             lblDutyMessage.Text        = "你已经完成了今天的考勤!";
             btnCheckAttendance.Visible = false;
         }
         else
         {
             //检查是否迟到早退
             if (DutyStatus == true)                  //上班考勤
             {
                 if (((Button)(sender)).CommandArgument.ToString() != "notnormal")
                 {
                     if (wd.CheckStatus(DutyAction.OnDuty))
                     {
                         wd.RecordOnDutyData(DateTime.Now, true, "").ToString();
                         lblDutyMessage.Text        = "正常上班没有迟到。考勤成功!";
                         btnCheckAttendance.Visible = false;
                         DutyStatus = false;
                     }
                     else
                     {
                         lblDutyMessage.Text                = "上班迟到,请填写理由!";
                         txtAttendanceMemo.Visible          = true;
                         btnCheckAttendance.Text            = "上班";
                         btnCheckAttendance.CommandArgument = "notnormal";
                     }
                 }
                 else
                 {
                     wd.RecordOnDutyData(DateTime.Now, false, txtAttendanceMemo.Text).ToString();
                     lblDutyMessage.Text        = "上班迟到。考勤成功!";
                     txtAttendanceMemo.Visible  = false;
                     btnCheckAttendance.Visible = false;
                     DutyStatus = false;
                     btnCheckAttendance.CommandArgument = "";
                 }
             }
             else                      //下班考勤
             {
                 if (((Button)(sender)).CommandArgument.ToString() != "notnormal")
                 {
                     if (wd.CheckStatus(DutyAction.OffDuty))
                     {
                         wd.RecordOffDutyData(Duty, DateTime.Now, true, "");
                         lblDutyMessage.Text        = "正常下班没有早退。考勤成功!";
                         btnCheckAttendance.Visible = false;
                         DutyStatus = true;
                     }
                     else
                     {
                         lblDutyMessage.Text                = "下班早退,请填写理由!";
                         txtAttendanceMemo.Visible          = true;
                         btnCheckAttendance.Text            = "下班";
                         btnCheckAttendance.CommandArgument = "notnormal";
                     }
                 }
                 else
                 {
                     wd.RecordOffDutyData(Duty, DateTime.Now, false, txtAttendanceMemo.Text);
                     lblDutyMessage.Text        = "下班早退。考勤成功!";
                     txtAttendanceMemo.Visible  = false;
                     btnCheckAttendance.Visible = false;
                     DutyStatus = true;
                     btnCheckAttendance.CommandArgument = "";
                 }
             }
         }
         GridBind();
     }
     catch (Exception ex)
     {
         UDS.Components.Error.Log(ex.Message);
         Server.Transfer("../Error.aspx");
     }
 }