Exemplo n.º 1
0
    private void BindWorkShift()
    {
        CompanyCD  = ((UserInfoUtil)SessionUtil.Session["UserInfo"]).CompanyCD;
        Employeeid = ((UserInfoUtil)SessionUtil.Session["UserInfo"]).EmployeeID;
        date       = System.DateTime.Now.ToShortDateString();
        string    xh        = GetWorkShiftIndex();
        DataTable DtHoliday = HolidayDBHelper.GetHolidayInfo(CompanyCD);//是否节假日

        if (DtHoliday != null)
        {
            if (DtHoliday.Rows.Count != 0)
            {
                for (int j = 0; j < DtHoliday.Rows.Count; j++)
                {
                    if (Convert.ToDateTime(date) >= Convert.ToDateTime(DtHoliday.Rows[j]["StartDate"].ToString()) && Convert.ToDateTime(date) <= Convert.ToDateTime(DtHoliday.Rows[j]["EndDate"].ToString()))
                    {
                        HiddenEmployeeAttendanceSetID.Value = "节假日";
                        return;
                    }
                }
            }
        }
        if (xh.Trim() != "" && xh.Trim() != "-1")
        {
            DataTable workshifttable = new DataTable();
            if (!xh.EndsWith(","))
            {
                DataTable IsRestDT = DailyAttendanceDBHelper.IsRestDay(CompanyCD, Employeeid, date, xh);//是否休息日
                if (IsRestDT != null)
                {
                    if (IsRestDT.Rows.Count > 0)
                    {
                        if (IsRestDT.Rows[0]["WorkShiftNo"].ToString() == "休息")
                        {
                            HiddenEmployeeAttendanceSetID.Value = "休息";
                            return;
                        }
                    }
                }
                workshifttable = DailyAttendanceDBHelper.GetWorkShiftInfo(CompanyCD, Employeeid, date, Convert.ToInt32(xh));//获取人员当前日期下的考勤班次下拉列表
            }
            else
            {
                workshifttable = DailyAttendanceDBHelper.GetWorkShiftInfo(CompanyCD, xh.TrimEnd(','));                               //获取人员当前日期下的考勤班次下拉列表
            }
            DataTable EmployeeAttendanceSetInfo = DailyAttendanceDBHelper.GetEmployeeAttendanceSetInfo(CompanyCD, Employeeid, date); //获取人员当前日期下的考勤设置信息
            if (workshifttable.Rows.Count > 0)
            {
                ddlworkshift.DataTextField  = "ShiftTimeName";
                ddlworkshift.DataValueField = "ID";
                ddlworkshift.DataSource     = workshifttable;
                ddlworkshift.DataBind();
            }
            if (EmployeeAttendanceSetInfo.Rows.Count > 0)
            {
                HiddenEmployeeAttendanceSetID.Value = EmployeeAttendanceSetInfo.Rows[0]["ID"].ToString() + "," + EmployeeAttendanceSetInfo.Rows[0]["AttendanceType"].ToString();
            }
        }
    }
Exemplo n.º 2
0
 /// <summary>
 /// 获取考勤信息列表
 /// </summary>
 /// <returns>DataTable</returns>
 public static DataTable GetDailyAttendanceInfo(string EmployeeNo, string EmployeeName, string Quarter, string AttendanceStartDate, string AttendanceEndDate, string CompanyID, int pageIndex, int pageCount, string ord, ref int TotalCount)
 {
     try
     {
         return(DailyAttendanceDBHelper.GetDailyAttendanceInfo(EmployeeNo, EmployeeName, Quarter, AttendanceStartDate, AttendanceEndDate, CompanyID, pageIndex, pageCount, ord, ref TotalCount));
     }
     catch (System.Exception ex)
     {
         throw ex;
     }
 }
Exemplo n.º 3
0
    private string GetWorkShiftIndex()
    {
        //获取班组类型(正常班还是排班)
        DataTable WorkGroupTypeDT = DailyAttendanceDBHelper.GetWorkGroupType(CompanyCD, Employeeid, date);

        if (WorkGroupTypeDT != null)
        {
            if (WorkGroupTypeDT.Rows.Count > 0)
            {
                if (WorkGroupTypeDT.Rows[0]["WorkGroupType"].ToString().Trim() != "1")
                {
                    DataTable dt  = DailyAttendanceDBHelper.GetStartDate(CompanyCD, Employeeid, date);
                    int       day = 0;
                    if (dt.Rows.Count > 0)
                    {
                        string   startdate = dt.Rows[0]["WorkPlanStartDate"].ToString();
                        TimeSpan span      = DateTime.Parse(date) - DateTime.Parse(startdate);
                        day = span.Days;                    //相差天数
                        int xh = (day % dt.Rows.Count) + 1; //获取序号
                        return(xh.ToString());
                    }
                    else
                    {
                        return("-1");
                    }
                }
                else
                {
                    return(WorkGroupTypeDT.Rows[0]["WorkGroupNo"].ToString().Trim() + ",");
                }
            }
            else
            {
                return("");
            }
        }
        else
        {
            return("");
        }
    }
Exemplo n.º 4
0
 /// <summary>
 /// 更新用户签退信息
 /// </summary>
 /// <param name="DailyAttendanceM">签退信息</param>
 /// <returns>更新是否成功 false:失败,true:成功</returns>
 public static bool UpdateailyAttendanceSignOut(DailyAttendanceModel DailyAttendanceM)
 {
     return(DailyAttendanceDBHelper.UpdateailyAttendanceSignOut(DailyAttendanceM));
 }
Exemplo n.º 5
0
 /// <summary>
 /// 判断签到还是签退
 /// </summary>
 /// <param name="EmployeeID">员工ID</param>
 /// <param name="CompanyID">公司代码0</param>
 /// <returns></returns>
 public static int SignInOrOut(int EmployeeID, string CompanyID)
 {
     return(DailyAttendanceDBHelper.SignInOrOut(EmployeeID, CompanyID));
 }
Exemplo n.º 6
0
 /// <summary>
 /// 插入员工日常考勤签到信息
 /// </summary>
 /// <param name="DailyAttendanceM">签到信息</param>
 /// <returns>添加是否成功 false:失败,true:成功</returns>
 public static bool AddDailyAttendanceSignIn(DailyAttendanceModel DailyAttendanceM)
 {
     return(DailyAttendanceDBHelper.AddDailyAttendanceSignIn(DailyAttendanceM));
 }