示例#1
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("");
        }
    }