Exemplo n.º 1
0
    private void BindList(V_SchedulingSchClass condObj)
    {
        List <V_SchedulingSchClass> vssList = BLLTable <V_SchedulingSchClass> .Factory(conn).Select(new V_SchedulingSchClass(), condObj);

        DataTable data = GetWorkViewHeadTable();

        repHead.DataSource = data.Columns;
        repHead.DataBind();
        Dictionary <string, DataRow> dic    = new Dictionary <string, DataRow>();
        Dictionary <string, int>     rigDic = new Dictionary <string, int>();

        data = GetWorkViewBodyTable();
        DateTime nowDt = DateTime.Now;

        foreach (V_SchedulingSchClass vs in vssList)
        {
            string date = vs._SchYear + "-" + vs._SchMonth.ToString().PadLeft(2, '0') + "-" + vs._SchDay.ToString().PadLeft(2, '0');
            if (!dic.ContainsKey(date))
            {
                dic.Add(date, data.NewRow());
            }
            if (!rigDic.ContainsKey(date))
            {
                rigDic.Add(date, 0);
            }

            DateTime curDate = new DateTime(vs._SchYear, vs._SchMonth, vs._SchDay);
            dic[date][0] = vs.STAFF_ID + spl;
            dic[date][1] = vs.STAFF_NAME + spl;
            dic[date][2] = date + spl + (curDate == new DateTime(nowDt.Year, nowDt.Month, nowDt.Day) ? "style='background-color:#eeeeaa;'" : "");
            dic[date][3] = CheckInOutHelper.ChineseByEnWeek(curDate) + spl + " style='text-align:center;text-indent:0px;'";
            dic[date][4] = dll_Type.Items[vs._SchType].Text + spl;
            DateTime otime = new DateTime(nowDt.Year, nowDt.Month, nowDt.Day, 0, 0, 0);
            DateTime stime = new DateTime(nowDt.Year, nowDt.Month, nowDt.Day, vs.StartHour, vs.StartMin, 0);
            DateTime etime = new DateTime(nowDt.Year, nowDt.Month, nowDt.Day, vs.EndHour, vs.EndMin, 0);
            int      left  = ((int)((stime - otime).TotalMinutes / 2.00 + 0.5));
            int      wid   = ((int)((etime - stime).TotalMinutes / 2.00 + 0.5)) - 1;
            left         = left - rigDic[date];
            rigDic[date] = ((int)((stime - otime).TotalMinutes / 2 + 0.5)) + wid + 3;
            string sty = "style='float:left;clear:right;display:inline-block;margin-left:" + left + "px; width:" + wid + "px;height:20px; background-color:" + vs.Color + "'";
            string tit = "tag='";
            tit += "班次名称:" + vs.SchName + "<br />";
            tit += "时段:" + vs.StartHour + ":" + vs.StartMin + "-" + vs.EndHour + ":" + vs.EndMin + "<br />";
            tit += "计算量值:" + vs.SchNumber + "<br />";
            tit += "量值单位:" + formhelper.GetOptionText(HR_SchClass.Attribute.SchUnit, vs.SchUnit) + "<br />";
            tit += "是否计算为加班:" + (vs.IsOverTime ? "是" : "否") + "<br />";
            tit += "签到时间:" + (!vs.CheckIn?"不签到":(vs.CheckInHour1 + ":" + vs.CheckInMin1 + "-" + vs.CheckInHour2 + ":" + vs.CheckInMin2)) + "<br />";
            tit += "签退时间:" + (!vs.CheckOut ? "不签退" : (vs.CheckOutHour1 + ":" + vs.CheckOutMin1 + "-" + vs.CheckOutHour2 + ":" + vs.CheckOutMin2)) + "<br />";
            tit += "计迟到/早退分钟数:" + vs.LateMinutes + "/" + vs.EarlyMinutes + "<br />";
            tit += "'";
            string a = "<a " + tit + " " + sty + " onmousemove='showatooltip(\"tableatooltip\",this)' onmouseout='hideatooltip(\"tableatooltip\")'></a>";
            dic[date][5] += a;
        }

        foreach (string vs in dic.Keys)
        {
            dic[vs][5] += spl + " colspan='24' style='text-indent:0px;' ";
            data.Rows.Add(dic[vs]);
        }

        repList.DataSource = data.Rows;
        repList.DataBind();
    }
Exemplo n.º 2
0
    public void BindHerd(DataColumnCollection dcc)
    {
        if (dcc == null || dcc.Count < 1)
        {
            return;
        }
        int    index      = 0;
        string header1    = "";
        string header2    = "";
        string width      = "";
        string resizelist = "";
        string align      = "";

        foreach (DataColumn dc in dcc)
        {
            if (index < 7)
            {
                switch (index)
                {
                case 0:
                    header1 += ",";
                    width   += "40,";
                    break;

                case 1:
                    header1 += "#cspan,";
                    width   += "60,";
                    break;

                case 2:
                    header1 += "#cspan,";
                    width   += "80,";
                    break;

                case 3:
                    header1 += "#cspan,";
                    width   += "80,";
                    break;

                case 4:
                    header1 += "#cspan,";
                    width   += "120,";
                    break;

                case 5:
                    header1 += "#cspan,";
                    width   += "65,";
                    break;

                case 6:
                    header1 += "<div style='float:right; padding-right:5px;'>日期</div>,";
                    width   += "65,";
                    break;

                default: break;
                }

                resizelist += "true,";
                header2    += "<div class='hdrcell' style='padding-left:5px;'>" + (string.IsNullOrEmpty(dc.ColumnName.TrimEnd(' ')) ? "-" : dc.ColumnName) + "</div>,";
                align      += "left,";
                index++;
                continue;
            }
            DateTime dt = DateTime.MinValue;
            if (DateTime.TryParse(dc.ColumnName, out dt) && dt != DateTime.MinValue)
            {
                header1    += "<div style='margin-left:-7px;'>" + dt.Day.ToString().PadLeft(2, '0') + "</div>,";
                header2    += "<div class='hdrcell' style='padding-left:5px;'>" + CheckInOutHelper.ChineseByEnWeek(dt) + "</div>,";
                width      += "27,";
                resizelist += "false,";
                align      += "left,";
            }
            else
            {
                if (!m_startAddKqqk)
                {
                    header1       += "<div style='margin-left:-7px;'>出勤情况</div>,";
                    header2       += "<div class='hdrcell' style='padding-left:5px;'>" + (string.IsNullOrEmpty(dc.ColumnName.TrimEnd(' ')) ? "-" : dc.ColumnName) + "</div>,";
                    width         += (dc.ColumnName.Length * 12 + 15) + ",";
                    m_startAddKqqk = true;
                    resizelist    += "true,";
                    align         += "left,";
                }
                else
                {
                    header1    += "#cspan,";
                    header2    += "<div class='hdrcell' style='padding-left:5px;'>" + (string.IsNullOrEmpty(dc.ColumnName.TrimEnd(' ')) ? "-" : dc.ColumnName) + "</div>,";
                    width      += (dc.ColumnName.Length * 12 + 15) + ",";
                    resizelist += "true,";
                    align      += "left,";
                }
            }
            index++;
        }

        m_header1    = "\"" + header1.TrimEnd(',') + "\"";
        m_header2    = "\"" + header2.TrimEnd(',') + "\"";
        m_width      = "\"" + width.TrimEnd(',') + "\"";
        m_resizelist = "\"" + resizelist.TrimEnd(',') + "\"";
        m_align      = "\"" + align.TrimEnd(',') + "\"";
    }
Exemplo n.º 3
0
    public string BindHerd(RepeaterItem Container)
    {
        string td = "";

        if (Container == null)
        {
            return(td);
        }
        DataColumn dc = Container.DataItem as DataColumn;

        if (dc == null)
        {
            return(td);
        }
        string   sty = "";
        string   tit = dc.ColumnName;
        DateTime dt  = DateTime.MinValue;

        m_HeadTdIndex++;
        if (tit == "序号")
        {
            m_HeadTdLeft  = 5;
            sty           = "style='width:40px;height:45px;position:relative;'";
            td           += "<td id='xuhao' class='headtit' " + sty + ">" + "\n";
            td           += "    序号" + "\n";
            td           += "</td>" + "\n";
            m_HeadTdLeft += 40;
        }
        else if (tit == "姓名")
        {
            sty           = "style='width:80px;height:45px;position:relative;'";
            td           += "<td id='drawXiexian' class='headtit' " + sty + ">" + "\n";
            td           += "    <table>" + "\n";//style='background-image:url(Uploadify/xiexian.gif)'
            td           += "        <tr>" + "\n";
            td           += "            <td style='text-align:right;border: 0px none #000;'>日期</td>" + "\n";
            td           += "        </tr>" + "\n";
            td           += "        <tr>" + "\n";
            td           += "            <td style='text-align:left;border: 0px none #000;'>姓名</td>" + "\n";
            td           += "        </tr>" + "\n";
            td           += "    </table>" + "\n";
            td           += "</td>" + "\n";
            m_HeadTdLeft += 80;
        }
        else if (tit == "全勤")
        {
            sty           = "style='width:40px;height:45px;position:relative;'";
            td           += "<td class='headtit' " + sty + ">" + "\n";
            td           += "    " + tit + "\n";
            td           += "</td>" + "\n";
            m_HeadTdLeft += 40;
        }
        else if (tit == "实际出勤")
        {
            sty           = "style='width:40px;height:45px;position:relative;'";
            td           += "<td class='headtit' " + sty + ">" + "\n";
            td           += "    <table>" + "\n";
            td           += "        <tr>" + "\n";
            td           += "            <td style='border: 0px none #000;'>实际</td>" + "\n";
            td           += "        </tr>" + "\n";
            td           += "        <tr>" + "\n";
            td           += "            <td style='border: 0px none #000;'>出勤</td>" + "\n";
            td           += "        </tr>" + "\n";
            td           += "    </table>" + "\n";
            td           += "</td>" + "\n";
            m_HeadTdLeft += 40;
        }
        else if (DateTime.TryParse(tit, out dt))
        {
            sty           = "style='text-align:left;width:25px; min-width:25px;max-width:25px;position:relative;'";
            td           += "<td class='headtit' " + sty + ">" + "\n";
            td           += "    <table>" + "\n";
            td           += "        <tr>" + "\n";
            td           += "            <td style='border: 0px none #000;border-bottom:1px solid #aad;'>" + dt.Day.ToString().PadLeft(2, '0') + "</td>" + "\n";
            td           += "        </tr>" + "\n";
            td           += "        <tr>" + "\n";
            td           += "            <td style='border: 0px none #000;'>" + CheckInOutHelper.ChineseByEnWeek(dt) + "</td>" + "\n";
            td           += "        </tr>" + "\n";
            td           += "    </table>" + "\n";
            td           += "</td>" + "\n";
            m_HeadTdLeft += 25;
        }
        else if (!m_HeadTdDayShowOver)
        {
            m_HeadTdColspan = m_HeadTdCount - m_HeadTdIndex + 1;
            sty             = "style='width:" + (38 * 15 + 14) + "px;position:relative;'";
            td                 += "<td class='headtit' " + sty + ">" + "\n";
            td                 += "<table>" + "\n";
            td                 += "<tr>" + "\n";
            td                 += "    <td colspan=\"" + m_HeadTdColspan + "\" style='border: 0px none #000;border-bottom:1px solid #aad; text-align:left;'>出勤情况<td>" + "\n";
            td                 += "</tr>" + "\n";
            td                 += "<tr>";
            sty                 = "style='width:" + (tit.Length * 15 + 5) + "px; border: 0px none #000;border-right: 1px solid #aad;'";
            td                 += "<td " + sty + ">" + "\n";
            td                 += "    " + tit + "\n";
            td                 += "</td>" + "\n";
            m_HeadTdLeft       += 38 * 15 + 14;
            m_HeadTdDayShowOver = true;
        }
        else if (m_HeadTdIndex == m_HeadTdCount)
        {
            sty = "style='width:" + (tit.Length * 15 + 5) + "px;border: 0px none #000;border-right: 1px solid #aad;'";
            td += "<td  " + sty + ">" + "\n";
            td += "    " + tit + "\n";
            td += "</td>" + "\n";
            td += "</tr>" + "\n";
            td += "</table>" + "\n";
            td += "</td>" + "\n";
        }
        else
        {
            sty = "style='width:" + (tit.Length * 15 + 5) + "px;border: 0px none #000;border-right: 1px solid #aad;'";
            td += "<td  " + sty + ">" + "\n";
            td += "    " + tit + "\n";
            td += "</td>" + "\n";
        }
        return(td);
    }