Exemplo n.º 1
0
        void ShiftDetail2PanelData(MyShiftDetailRow detail, tempHR hr)
        {
            Panel  pan       = hr.Pan;
            string panName   = pan.Name;
            string shiftData = detail.ShiftData;
            string realData  = detail.RealData;

            for (int d = 1; d <= m_DayCount; d++)
            {
                string    labelName = panName + "TBU" + d.ToString();
                Control[] controls  = pan.Controls.Find(labelName, true);
                TextBox   tb;
                char      c;
                if (controls.Count() > 0 && shiftData.Length >= d)
                {
                    tb = (TextBox)controls[0];
                    c  = shiftData[d - 1];
                    if (c == ' ')
                    {
                        tb.Text = "";
                    }
                    else
                    {
                        tb.Text = c.ToString();
                    }
                }
                labelName = panName + "TBD" + d.ToString();
                controls  = pan.Controls.Find(labelName, true);
                if (controls.Count() > 0 && realData.Length >= d)
                {
                    tb = (TextBox)controls[0];
                    c  = realData[d - 1];
                    if (c == ' ')
                    {
                        tb.Text = "";
                    }
                    else
                    {
                        tb.Text = c.ToString();
                    }
                }
            }
            hr.iUpTotal       = detail.ShiftHours;
            hr.iDownTotal     = detail.RealHours;
            hr.UpTotal.Text   = "排定 " + hr.iUpTotal.ToString() + "時";
            hr.DownTotal.Text = "出勤 " + hr.iDownTotal.ToString() + "時";
        }
Exemplo n.º 2
0
        void PanelData2ShiftDetail(tempHR hr, MyShiftDetailRow detail)
        {
            detail.EmpolyeeID = hr.ID;
            Panel  pan       = hr.Pan;
            string panName   = pan.Name;
            string shiftData = "";
            string realData  = "";

            for (int d = 1; d <= m_DayCount; d++)
            {
                string    labelName = panName + "TBU" + d.ToString();
                Control[] controls  = pan.Controls.Find(labelName, true);
                TextBox   tb;
                if (controls.Count() > 0)
                {
                    tb = (TextBox)controls[0];
                    if (tb.Text.Length > 0)
                    {
                        shiftData += tb.Text[0];
                    }
                    else
                    {
                        shiftData += " ";
                    }
                }
                labelName = panName + "TBD" + d.ToString();
                controls  = pan.Controls.Find(labelName, true);
                if (controls.Count() > 0)
                {
                    tb = (TextBox)controls[0];
                    if (tb.Text.Length > 0)
                    {
                        realData += tb.Text[0];
                    }
                    else
                    {
                        realData += " ";
                    }
                }
            }
            detail.ShiftData  = shiftData;
            detail.RealData   = realData;
            detail.ShiftHours = hr.iUpTotal;
            detail.RealHours  = hr.iDownTotal;
        }