Example #1
0
        /// <summary>
        /// 检查上下班状态是否迟到早退
        /// </summary>
        /// <param name="action">动作DutyAction</param>
        /// <param name="staffid">人员id</param>
        /// <returns>返回值</returns>
        public bool CheckStatus(DutyAction action, int staffid)
        {
            this.staffid = staffid;
            WA_Setting was      = new WA_Setting();
            DutyTime   dutytime = was.GetDutyTime(staffid);

            //如果是上班
            if (action == DutyAction.OnDuty)
            {
                if ((DateTime.Now.TimeOfDay - ondutyflexibilitytime) > dutytime.OnDutyTime.TimeOfDay)
                {
                    return(false);
                }
                else
                {
                    return(true);
                }
            }
            //如果下班
            else
            {
                if ((DateTime.Now.TimeOfDay + offdutyflexibilitytime) < dutytime.OffDutyTime.TimeOfDay)
                {
                    return(false);
                }
                else
                {
                    return(true);
                }
            }
        }
Example #2
0
        /// <summary>
        /// 检查上下班状态是否迟到早退
        /// </summary>
        /// <param name="action">动作DutyAction</param>
        /// <returns>返回值</returns>
        public bool CheckStatus(DutyAction action)
        {
            WA_Setting was      = new WA_Setting();
            DutyTime   dutytime = was.GetDutyTime(staffid);

            //如果是上班
            if (action == DutyAction.OnDuty)
            {
                if ((DateTime.Now - ondutyflexibilitytime) > (DateTime.Today + dutytime.OnDutyTime.TimeOfDay))
                {
                    return(false);
                }
                else
                {
                    return(true);
                }
            }
            //如果下班
            else
            {
                if ((DateTime.Now + offdutyflexibilitytime) < (DateTime.Today + dutytime.OffDutyTime.TimeOfDay))
                {
                    return(false);
                }
                else
                {
                    return(true);
                }
            }
        }
Example #3
0
        /// <summary>
        /// 得到员工上下班时间
        /// </summary>
        public DutyTime GetDutyTime()
        {
            UDS.Components.Database db = new UDS.Components.Database();
            DutyTime dt = new DutyTime();

            System.Data.SqlClient.SqlParameter[] prams =
            {
                db.MakeInParam("@staffid",      System.Data.SqlDbType.Int,            4, staffid),
                db.MakeOutParam("@ondutytime",  System.Data.SqlDbType.SmallDateTime, 8),
                db.MakeOutParam("@offdutytime", System.Data.SqlDbType.SmallDateTime, 8)
            };
            if (db.RunProc("sp_WA_GetDutyTime", prams) != 0)
            {
                throw(new Exception("读取人员上下班时间出错"));
            }
            else
            {
                dt.OnDutyTime  = (System.DateTime)prams[1].Value;
                dt.OffDutyTime = (System.DateTime)prams[2].Value;
                return(dt);
            }
        }
Example #4
0
File: WA.cs Project: blfsir/benzoa
 /// <summary>
 /// �õ�Ա�����°�ʱ��
 /// </summary>
 /// <param name="Staffid">Ա��id</param>
 public DutyTime GetDutyTime(int Staffid)
 {
     staffid = Staffid;
     UDS.Components.Database db = new UDS.Components.Database();
     DutyTime dt = new DutyTime();
     System.Data.SqlClient.SqlParameter[] prams = {
                                                    db.MakeInParam("@staffid",System.Data.SqlDbType.Int,4,staffid),
                                                    db.MakeOutParam("@ondutytime",System.Data.SqlDbType.DateTime,8),
                                                    db.MakeOutParam("@offdutytime",System.Data.SqlDbType.DateTime,8)
                                                };
     if(db.RunProc("sp_WA_GetDutyTime",prams)!=0)
     {
         throw(new Exception("��ȡ��Ա���°�ʱ�����"));
     }
     else
     {
         dt.OnDutyTime = (System.DateTime)prams[1].Value;
         dt.OffDutyTime = (System.DateTime)prams[2].Value;
         return dt;
     }
 }