Пример #1
0
        private void SetGrids(string strHour)
        {
            lblFocus.Focus();
            gvWholeTimeline.Columns.Clear();
            gvHours.Columns.Clear();
            gvTimeLine.Columns.Clear();
            gvWorkOrder.Columns.Clear();
            gvTrueCycle.Columns.Clear();



            int intHourSP = Convert.ToInt32(strHour);



            //string strSQL = "p_tblLeakTestFPYThreeHour " + intHourSP.ToString();
            string  strSQL    = strLineSpecificStoredProc; // + intHourSP.ToString() + ", " + TSID.ToString();
            DataSet ds        = clsDAL.ProcessSQL(strSQL, "Visual");
            var     leakTests = new TupleList4 <int, int, int, int, string, int, int>();

            colorGrid.Clear();
            breakTimes.Clear();
            trueCycleTimes.Clear();

            returnData newList = new returnData();

            if (clsDAL.dsHasData(ds))
            {
                foreach (DataTable table in ds.Tables)
                {
                    foreach (DataRow dr in table.Rows)
                    {
                        int    intHour     = Convert.ToInt32(dr["hour"].ToString());
                        int    intMinute   = Convert.ToInt32(dr["minit"].ToString());
                        int    intPassFail = Convert.ToInt32(dr["cntPass"].ToString());
                        int    intGridCol  = Convert.ToInt32(dr["GridCol"].ToString());
                        string strWO       = dr["WorkOrder"].ToString();
                        int    intColSpan  = Convert.ToInt32(dr["WOGridSpan"].ToString());
                        int    intBegWOCol = Convert.ToInt32(dr["WOGridStart"].ToString());
                        string strBegin    = dr["Break1"].ToString();
                        leakTests.Add(intHour, intMinute, intPassFail, intGridCol, strWO, intColSpan, intBegWOCol);
                        colorGrid.Add(new Tuple <int, int, int, int, string, int, int, Tuple <string> >(intHour, intMinute, intPassFail, intGridCol, strWO, intColSpan, intBegWOCol, new Tuple <string>(strBegin)));

                        int intBreak1    = Convert.ToInt32(dr["Break1"].ToString());
                        int intLunch     = Convert.ToInt32(dr["Lunch"].ToString());
                        int intBreak2    = Convert.ToInt32(dr["Break2"].ToString());
                        int intCycleTime = Convert.ToInt32(dr["TCycle"].ToString());

                        breakTimes.Add(new Tuple <int, int, int, int, int>(intHour, intMinute, intBreak1, intLunch, intBreak2));
                        trueCycleTimes.Add(new Tuple <int, int, int>(intHour, intMinute, intCycleTime));
                    }
                }

                //lstMaster.Add(newList);
            }

            DataGridViewTextBoxColumnEx col3 = new DataGridViewTextBoxColumnEx();

            for (int z = 0; z < 180; z++)
            {
                DataGridViewTextBoxColumnEx col  = new DataGridViewTextBoxColumnEx();
                DataGridViewTextBoxColumnEx col5 = new DataGridViewTextBoxColumnEx();
                DataGridViewTextBoxColumnEx col6 = new DataGridViewTextBoxColumnEx();
                DataGridViewTextBoxColumnEx col7 = new DataGridViewTextBoxColumnEx();

                gvWholeTimeline.RowHeadersVisible          = false;
                gvWholeTimeline.ColumnHeadersVisible       = false;
                gvWholeTimeline.ScrollBars                 = ScrollBars.None;
                gvWholeTimeline.CellBorderStyle            = DataGridViewCellBorderStyle.None;
                gvWholeTimeline.BorderStyle                = BorderStyle.None;
                gvWholeTimeline.DefaultCellStyle.BackColor = Color.White;


                gvWorkOrder.RowHeadersVisible    = false;
                gvWorkOrder.ColumnHeadersVisible = false;
                gvWorkOrder.ScrollBars           = ScrollBars.None;
                gvWorkOrder.CellBorderStyle      = DataGridViewCellBorderStyle.None;
                gvWorkOrder.BorderStyle          = BorderStyle.None;

                gvTimeLine.RowHeadersVisible    = false;
                gvTimeLine.ColumnHeadersVisible = false;
                gvTimeLine.ScrollBars           = ScrollBars.None;
                gvTimeLine.CellBorderStyle      = DataGridViewCellBorderStyle.None;
                gvTimeLine.BorderStyle          = BorderStyle.None;

                gvTrueCycle.RowHeadersVisible    = false;
                gvTrueCycle.ColumnHeadersVisible = false;
                gvTrueCycle.ScrollBars           = ScrollBars.None;
                gvTrueCycle.CellBorderStyle      = DataGridViewCellBorderStyle.None;
                gvTrueCycle.BorderStyle          = BorderStyle.None;


                col.FillWeight = 10;
                col.Width      = 10;
                col.Name       = z.ToString();

                col5.FillWeight = 10;
                col5.Width      = 10;
                col5.Name       = z.ToString();

                col6.FillWeight = 10;
                col6.Width      = 10;
                col6.Name       = z.ToString();

                col7.FillWeight = 10;
                col7.Width      = 10;
                col7.Name       = z.ToString();

                gvWholeTimeline.Columns.Add(col);
                gvWorkOrder.Columns.Add(col5);
                gvTimeLine.Columns.Add(col6);
                gvTrueCycle.Columns.Add(col7);

                //gvWholeTimeline.Rows[0].Cells[z].Value = z.ToString();
                gvWholeTimeline.Height = gvWholeTimeline.Rows[0].Height;
                gvWorkOrder.Height     = gvWorkOrder.Rows[0].Height;
                gvTimeLine.Height      = gvTimeLine.Rows[0].Height;
                gvTrueCycle.Height     = gvTimeLine.Rows[0].Height;

                lblFocus.Focus();


                if (z % 15 == 0)
                {
                    gvWholeTimeline.Rows[0].Cells[z].Value      = '\u25CF';
                    gvWholeTimeline.Rows[0].Cells[z].Style.Font = new Font("Arial", 12F, FontStyle.Bold, GraphicsUnit.Pixel);

                    int[] hours = { 0, 60, 120, 180 };
                    if (hours.Contains(z))
                    {
                        gvWholeTimeline.Rows[0].Cells[z].Value = null;
                    }
                }
            }


            int setHour = 0;

            strHour = (Convert.ToInt32(strHour) - 2).ToString();

            for (int z = 0; z <= 2; z++)
            {
                DataGridViewTextBoxColumnEx col2 = new DataGridViewTextBoxColumnEx();
                //col2.FillWeight = 10;
                col2.Width = 600;
                col2.Name  = z.ToString();

                gvHours.RowHeadersVisible    = false;
                gvHours.ColumnHeadersVisible = false;
                gvHours.ScrollBars           = ScrollBars.None;
                gvHours.CellBorderStyle      = DataGridViewCellBorderStyle.None;
                gvHours.BorderStyle          = BorderStyle.None;
                gvHours.Columns.Add(col2);
                gvHours.Height = gvHours.Rows[0].Height;



                gvHours.Rows[0].Cells[z].Style.Font = new Font("Arial", 24F, FontStyle.Bold, GraphicsUnit.Pixel);

                SetBreaksFromTable(Convert.ToInt32(strHour));

                if (z == 0)
                {
                    //gvHours.Rows[0].Cells[z].Value = strHour;
                    gvHours.Rows[0].Cells[z].Value = TwelveHour(Convert.ToInt32(strHour));
                    setHour = Convert.ToInt32(strHour);

                    if (setHour == lu)
                    {
                        SetSpan(gvTimeLine, z, 0, intluTotalMins, 0, "Middle");
                        gvTimeLine.Rows[0].Cells[z].Value           = "Lunch";
                        gvTimeLine.Rows[0].Cells[z].Style.Font      = new Font("Arial", 16F, FontStyle.Bold, GraphicsUnit.Pixel);
                        gvTimeLine.Rows[0].Cells[z].Style.BackColor = Color.LightSteelBlue;
                        gvTimeLine.Rows[0].Cells[z].Style.ForeColor = Color.Black;
                    }

                    if (setHour == intB1)
                    {
                        SetSpan(gvTimeLine, z, intB1TotalMins, 10, 0, "Middle");
                        gvTimeLine.Rows[0].Cells[z].Value           = "Break";
                        gvTimeLine.Rows[0].Cells[z].Style.Font      = new Font("Arial", 16F, FontStyle.Bold, GraphicsUnit.Pixel);
                        gvTimeLine.Rows[0].Cells[z].Style.BackColor = Color.LightSteelBlue;
                        gvTimeLine.Rows[0].Cells[z].Style.ForeColor = Color.Black;
                    }

                    if (setHour == intB2)
                    {
                        SetSpan(gvTimeLine, z, 0, intB2TotalMins, 0, "Middle");
                        gvTimeLine.Rows[0].Cells[z].Value           = "Break";
                        gvTimeLine.Rows[0].Cells[z].Style.Font      = new Font("Arial", 16F, FontStyle.Bold, GraphicsUnit.Pixel);
                        gvTimeLine.Rows[0].Cells[z].Style.BackColor = Color.LightSteelBlue;
                        gvTimeLine.Rows[0].Cells[z].Style.ForeColor = Color.Black;
                    }
                }

                if (z == 1)
                {
                    setHour = setHour + 1;
                    //gvHours.Rows[0].Cells[z].Value = setHour.ToString();
                    gvHours.Rows[0].Cells[z].Value = TwelveHour(Convert.ToInt32(setHour));

                    if (setHour == 11)
                    {
                        SetSpan(gvTimeLine, 60, 0, intluTotalMins, 0, "Middle");
                        gvTimeLine.Rows[0].Cells[60].Value           = "Lunch";
                        gvTimeLine.Rows[0].Cells[60].Style.Font      = new Font("Arial", 16F, FontStyle.Bold, GraphicsUnit.Pixel);
                        gvTimeLine.Rows[0].Cells[60].Style.BackColor = Color.LightSteelBlue;
                        gvTimeLine.Rows[0].Cells[60].Style.ForeColor = Color.Black;
                    }

                    if (setHour == 9)
                    {
                        SetSpan(gvTimeLine, 60, 0, intB1TotalMins, 0, "Middle");
                        gvTimeLine.Rows[0].Cells[60].Value           = "Break";
                        gvTimeLine.Rows[0].Cells[60].Style.Font      = new Font("Arial", 16F, FontStyle.Bold, GraphicsUnit.Pixel);
                        gvTimeLine.Rows[0].Cells[60].Style.BackColor = Color.LightSteelBlue;
                        gvTimeLine.Rows[0].Cells[60].Style.ForeColor = Color.Black;
                    }

                    if (setHour == 13)
                    {
                        SetSpan(gvTimeLine, 60, 0, intB2TotalMins, 0, "Middle");
                        gvTimeLine.Rows[0].Cells[60].Value           = "Break";
                        gvTimeLine.Rows[0].Cells[60].Style.Font      = new Font("Arial", 16F, FontStyle.Bold, GraphicsUnit.Pixel);
                        gvTimeLine.Rows[0].Cells[60].Style.BackColor = Color.LightSteelBlue;
                        gvTimeLine.Rows[0].Cells[60].Style.ForeColor = Color.Black;
                    }
                }

                if (z == 2)
                {
                    setHour = setHour + 1;
                    //gvHours.Rows[0].Cells[z].Value = setHour.ToString();
                    gvHours.Rows[0].Cells[z].Value = TwelveHour(Convert.ToInt32(setHour));

                    if (setHour == 11)
                    {
                        SetSpan(gvTimeLine, 120, 0, intluTotalMins, 0, "Middle");
                        gvTimeLine.Rows[0].Cells[120].Value           = "Lunch";
                        gvTimeLine.Rows[0].Cells[120].Style.Font      = new Font("Arial", 16F, FontStyle.Bold, GraphicsUnit.Pixel);
                        gvTimeLine.Rows[0].Cells[120].Style.BackColor = Color.LightSteelBlue;
                        gvTimeLine.Rows[0].Cells[120].Style.ForeColor = Color.Black;
                    }

                    if (setHour == 9)
                    {
                        SetSpan(gvTimeLine, 120, 0, intB1TotalMins, 0, "Middle");
                        gvTimeLine.Rows[0].Cells[120].Value           = "Break";
                        gvTimeLine.Rows[0].Cells[120].Style.Font      = new Font("Arial", 16F, FontStyle.Bold, GraphicsUnit.Pixel);
                        gvTimeLine.Rows[0].Cells[120].Style.BackColor = Color.LightSteelBlue;
                        gvTimeLine.Rows[0].Cells[120].Style.ForeColor = Color.Black;
                    }

                    if (setHour == 13)
                    {
                        SetSpan(gvTimeLine, 120, 0, intB2TotalMins, 0, "Middle");
                        gvTimeLine.Rows[0].Cells[120].Value           = "Break";
                        gvTimeLine.Rows[0].Cells[120].Style.Font      = new Font("Arial", 16F, FontStyle.Bold, GraphicsUnit.Pixel);
                        gvTimeLine.Rows[0].Cells[120].Style.BackColor = Color.LightSteelBlue;
                        gvTimeLine.Rows[0].Cells[120].Style.ForeColor = Color.Black;
                    }
                }


                if (z == 3)
                {
                    if (setHour == 11)
                    {
                        SetSpan(gvTimeLine, z, 0, intluTotalMins, 0, "Middle");
                        gvTimeLine.Rows[0].Cells[z].Value           = "Lunch";
                        gvTimeLine.Rows[0].Cells[z].Style.Font      = new Font("Arial", 16F, FontStyle.Bold, GraphicsUnit.Pixel);
                        gvTimeLine.Rows[0].Cells[z].Style.BackColor = Color.LightSteelBlue;
                        gvTimeLine.Rows[0].Cells[z].Style.ForeColor = Color.Black;
                    }

                    setHour = setHour + 1;
                    gvHours.Rows[0].Cells[z].Value = setHour.ToString();
                }

                SetSpan(gvHours, z, 0, 60, 0, "Middle");
            }


            SetThreeHour(Convert.ToInt32(strHour));

            //int intShiftGrid = ((Convert.ToInt32(strHour) * 60) + 60) / 180;
            //gvWholeTimeline.FirstDisplayedScrollingColumnIndex = intShiftGrid;
            //gvWorkOrder.FirstDisplayedScrollingColumnIndex = intShiftGrid;
            //gvTimeLine.FirstDisplayedScrollingColumnIndex = intShiftGrid;
        }
Пример #2
0
        private void SetGrids(string strHour)
        {
            lblFocus.Focus();
            gvWholeTimeline.Columns.Clear();
            gvHours.Columns.Clear();
            gvTimeLine.Columns.Clear();
            gvWorkOrder.Columns.Clear();
            gvTrueCycle.Columns.Clear();


            //string strSQL = "p_tblLeakTestFPY";
            string  strSQL    = strLineSpecificStoredProc;
            DataSet ds        = clsDAL.ProcessSQL(strSQL, "Visual");
            var     leakTests = new TupleList4 <int, int, int, int, string, int, int>();
            var     breakList = new TupleListBreaks <int, int, int, string, int>();
            var     spanWO    = new TupleWO <int, int, string>();

            if (clsDAL.dsHasData(ds))
            {
                DataTable dt1 = ds.Tables[0];
                DataTable dt2 = ds.Tables[1];

                foreach (DataRow dr in dt1.Rows)
                {
                    int    intHour      = Convert.ToInt32(dr["hour"].ToString());
                    int    intMinute    = Convert.ToInt32(dr["minit"].ToString());
                    int    intPassFail  = Convert.ToInt32(dr["cntPass"].ToString());
                    int    intGridCol   = Convert.ToInt32(dr["GridCol"].ToString());
                    string strWO        = dr["WorkOrder"].ToString();
                    int    intColSpan   = Convert.ToInt32(dr["WOGridSpan"].ToString());
                    int    intBegWOCol  = Convert.ToInt32(dr["WOGridStart"].ToString());
                    int    intCycleTime = Convert.ToInt32(dr["TCycle"].ToString());
                    leakTests.Add(intHour, intMinute, intPassFail, intGridCol, strWO, intColSpan, intBegWOCol);

                    if (intPassFail == 1)
                    {
                        trueCycleTimes.Add(new Tuple <int, int, int, int>(intHour, intMinute, intCycleTime, intGridCol));
                    }
                }

                foreach (DataRow dr in dt2.Rows)
                {
                    int    intHour      = Convert.ToInt32(dr["hour"].ToString());
                    int    intMinute    = Convert.ToInt32(dr["minit"].ToString());
                    int    intDuration  = Convert.ToInt32(dr["Duration"].ToString());
                    string strBreakType = dr["BreakType"].ToString();
                    int    intBreakCol  = Convert.ToInt32(dr["BreakCol"].ToString());
                    breakList.Add(intHour, intMinute, intDuration, strBreakType, intBreakCol);
                }

                //foreach (DataTable table in ds.Tables)
                //{
                //    foreach (DataRow dr in table.Rows)
                //    {
                //        int intHour = Convert.ToInt32(dr["hour"].ToString());
                //        int intMinute = Convert.ToInt32(dr["minit"].ToString());
                //        int intPassFail = Convert.ToInt32(dr["cntPass"].ToString());
                //        int intGridCol = Convert.ToInt32(dr["GridCol"].ToString());
                //        string strWO = dr["WorkOrder"].ToString();
                //        int intColSpan = Convert.ToInt32(dr["WOGridSpan"].ToString());
                //        int intBegWOCol = Convert.ToInt32(dr["WOGridStart"].ToString());
                //        leakTests.Add(intHour, intMinute, intPassFail, intGridCol, strWO, intColSpan, intBegWOCol);
                //    }
                //}
            }

            DataGridViewTextBoxColumnEx col3 = new DataGridViewTextBoxColumnEx();

            for (int z = 0; z < 1440; z++)
            {
                DataGridViewTextBoxColumnEx col  = new DataGridViewTextBoxColumnEx();
                DataGridViewTextBoxColumnEx col5 = new DataGridViewTextBoxColumnEx();
                DataGridViewTextBoxColumnEx col6 = new DataGridViewTextBoxColumnEx();
                DataGridViewTextBoxColumnEx col7 = new DataGridViewTextBoxColumnEx();


                gvWholeTimeline.RowHeadersVisible    = false;
                gvWholeTimeline.ColumnHeadersVisible = false;
                //gvWholeTimeline.ScrollBars = ScrollBars.None;
                gvWholeTimeline.CellBorderStyle = DataGridViewCellBorderStyle.None;
                gvWholeTimeline.BorderStyle     = BorderStyle.None;

                gvWorkOrder.RowHeadersVisible    = false;
                gvWorkOrder.ColumnHeadersVisible = false;
                gvWorkOrder.ScrollBars           = ScrollBars.None;
                gvWorkOrder.CellBorderStyle      = DataGridViewCellBorderStyle.None;
                gvWorkOrder.BorderStyle          = BorderStyle.None;

                gvTimeLine.RowHeadersVisible    = false;
                gvTimeLine.ColumnHeadersVisible = false;
                gvTimeLine.ScrollBars           = ScrollBars.None;
                gvTimeLine.CellBorderStyle      = DataGridViewCellBorderStyle.None;
                gvTimeLine.BorderStyle          = BorderStyle.None;

                gvTrueCycle.RowHeadersVisible    = false;
                gvTrueCycle.ColumnHeadersVisible = false;
                gvTrueCycle.ScrollBars           = ScrollBars.None;
                gvTrueCycle.CellBorderStyle      = DataGridViewCellBorderStyle.None;
                gvTrueCycle.BorderStyle          = BorderStyle.None;

                col.FillWeight = 10;
                col.Width      = 4;
                col.Name       = z.ToString();

                col5.FillWeight = 10;
                col5.Width      = 4;
                col5.Name       = z.ToString();

                col6.FillWeight = 10;
                col6.Width      = 4;
                col6.Name       = z.ToString();

                col7.FillWeight = 10;
                col7.Width      = 10;
                col7.Name       = z.ToString();

                gvWholeTimeline.Columns.Add(col);
                gvWorkOrder.Columns.Add(col5);
                gvTimeLine.Columns.Add(col6);
                gvTrueCycle.Columns.Add(col7);


                gvWholeTimeline.Height = gvWholeTimeline.Rows[0].Height + 20;
                gvWorkOrder.Height     = gvWorkOrder.Rows[0].Height;
                gvTimeLine.Height      = gvTimeLine.Rows[0].Height;
                gvTrueCycle.Height     = gvTimeLine.Rows[0].Height + 10;

                lblFocus.Focus();
            }


            int setHour = 0;

            for (int z = 0; z <= 60; z++)
            {
                DataGridViewTextBoxColumnEx col2 = new DataGridViewTextBoxColumnEx();
                //col2.FillWeight = 10;
                col2.Width = 300;
                col2.Name  = z.ToString();

                gvHours.RowHeadersVisible    = false;
                gvHours.ColumnHeadersVisible = false;
                gvHours.ScrollBars           = ScrollBars.None;
                gvHours.CellBorderStyle      = DataGridViewCellBorderStyle.None;
                gvHours.BorderStyle          = BorderStyle.None;
                gvHours.Columns.Add(col2);
                gvHours.Height = gvHours.Rows[0].Height;



                //strHour = dtNow.ToString("%h");

                gvHours.Rows[0].Cells[z].Style.Font = new Font("Arial", 24F, FontStyle.Bold, GraphicsUnit.Pixel);


                if (z == 0)
                {
                    //gvHours.Rows[0].Cells[z].Value = strHour;
                    gvHours.Rows[0].Cells[z].Value = TwelveHour(Convert.ToInt32(strHour));
                    setHour = Convert.ToInt32(strHour);
                }
                else
                {
                    setHour = setHour + 1;
                    //gvHours.Rows[0].Cells[z].Value = setHour.ToString();
                    gvHours.Rows[0].Cells[z].Value = TwelveHour(setHour);
                }
            }


            for (int z = 0; z < 1440; z++)
            {
                foreach (var x in leakTests)
                {
                    int [] ticks = { 720, 735, 750, 765, 780, 795, 810, 825, 840, 855, 870, 885 };

                    foreach (var ct in trueCycleTimes)
                    {
                        if (ct.Item4 == z)
                        {
                            SetSpan(gvTrueCycle, ct.Item4, 0, ct.Item3, 0, "Middle");
                            gvTrueCycle.Rows[0].Cells[ct.Item4].Value      = ct.Item3.ToString() + " min";
                            gvTrueCycle.Rows[0].Cells[ct.Item4].Style.Font = new Font("Arial", 10F, FontStyle.Bold, GraphicsUnit.Pixel);
                        }
                    }


                    if (z % 15 == 0)
                    {
                        gvWholeTimeline.Rows[0].Cells[z].Value      = "*";
                        gvWholeTimeline.Rows[0].Cells[z].Style.Font = new Font("Arial", 8F, FontStyle.Bold, GraphicsUnit.Pixel);

                        int[] hours = { 0, 60, 120, 180, 240, 300, 360, 420, 480, 540, 600, 660, 720, 780, 840, 900, 960, 1020, 1080, 1140, 1200, 1260, 1320, 1380, 1440 };

                        if (hours.Contains(z))
                        {
                            gvWholeTimeline.Rows[0].Cells[z].Value = null;
                        }
                    }


                    if (x.Item4 == z)
                    {
                        if (x.Item3 == 0)
                        {
                            gvWholeTimeline.Rows[0].Cells[x.Item4].Style.BackColor = Color.Firebrick;
                        }
                        if (x.Item3 == 1)
                        {
                            gvWholeTimeline.Rows[0].Cells[x.Item4].Style.BackColor = Color.MediumSeaGreen;
                        }
                    }


                    if (x.Item7 == z)
                    {
                        gvWorkOrder.Rows[0].Cells[x.Item7].Style.BackColor = Color.WhiteSmoke;

                        if (x.Item6 == 0)
                        {
                            gvWorkOrder.Rows[0].Cells[20].Style.BackColor = Color.WhiteSmoke;
                            SetSpan(gvWorkOrder, x.Item7, 0, 20, 0, "Middle");
                            gvWorkOrder.Rows[0].Cells[x.Item7].Value = x.Item5.ToString();
                            gvWorkOrder.Rows[0].Cells[z].Style.Font  = new Font("Arial", 12F, FontStyle.Bold, GraphicsUnit.Pixel);
                        }
                        else
                        {
                            for (int colSpan = 1; colSpan <= x.Item6; colSpan++)
                            {
                                gvWorkOrder.Rows[0].Cells[x.Item7 + colSpan].Style.BackColor = Color.WhiteSmoke;
                            }

                            SetSpan(gvWorkOrder, x.Item7, 0, x.Item6, 0, "Middle");
                            gvWorkOrder.Rows[0].Cells[x.Item7].Value = x.Item5.ToString();
                            gvWorkOrder.Rows[0].Cells[z].Style.Font  = new Font("Arial", 12F, FontStyle.Bold, GraphicsUnit.Pixel);
                        }
                    }
                }


                var date             = DateTime.Now;
                var colorCurrentTime = ((date.Hour * 60)) + date.Minute;
                if (z == colorCurrentTime)
                {
                    gvWholeTimeline.Rows[0].Cells[z].Style.BackColor     = Color.Khaki;
                    gvWholeTimeline.Rows[0].Cells[z + 1].Style.BackColor = Color.Khaki;
                    gvWholeTimeline.Rows[0].Cells[z - 1].Style.BackColor = Color.FromKnownColor(KnownColor.Window);

                    gvWorkOrder.Rows[0].Cells[z].Style.BackColor     = Color.Khaki;
                    gvWorkOrder.Rows[0].Cells[z + 1].Style.BackColor = Color.Khaki;
                    gvWorkOrder.Rows[0].Cells[z - 1].Style.BackColor = Color.FromKnownColor(KnownColor.Window);

                    gvTimeLine.Rows[0].Cells[z].Style.BackColor     = Color.Khaki;
                    gvTimeLine.Rows[0].Cells[z + 1].Style.BackColor = Color.Khaki;
                    gvTimeLine.Rows[0].Cells[z - 1].Style.BackColor = Color.FromKnownColor(KnownColor.Window);
                }
                ////test color 60 minutes
                //if (z >= 900 && z <= 959)
                //{
                //    gvWholeTimeline.Rows[0].Cells[z].Style.BackColor = Color.Khaki;
                //    gvWholeTimeline.Rows[0].Cells[z].Value = "$";
                //}
                //if (z >= 960 && z <= 1019)
                //{
                //    gvWholeTimeline.Rows[0].Cells[z].Style.BackColor = Color.LightCoral;
                //    gvWholeTimeline.Rows[0].Cells[z].Value = "$";
                //}


                foreach (var col in breakList)
                {
                    if (col.Item5 == z && col.Item4.Contains("Break"))
                    {
                        SetSpan(gvTimeLine, z, 0, col.Item3, 0, "Middle");
                        gvTimeLine.Rows[0].Cells[z].Value           = "Break";
                        gvTimeLine.Rows[0].Cells[z].Style.Font      = new Font("Arial", 12F, FontStyle.Bold, GraphicsUnit.Pixel);
                        gvTimeLine.Rows[0].Cells[z].Style.BackColor = Color.LightSteelBlue;
                        gvTimeLine.Rows[0].Cells[z].Style.ForeColor = Color.Black;
                    }

                    if (col.Item5 == z && col.Item4.Contains("Lunch"))
                    {
                        SetSpan(gvTimeLine, z, 0, col.Item3, 0, "Middle");
                        gvTimeLine.Rows[0].Cells[z].Value           = "Lunch";
                        gvTimeLine.Rows[0].Cells[z].Style.Font      = new Font("Arial", 12F, FontStyle.Bold, GraphicsUnit.Pixel);
                        gvTimeLine.Rows[0].Cells[z].Style.BackColor = Color.LightSteelBlue;
                        gvTimeLine.Rows[0].Cells[z].Style.ForeColor = Color.Black;
                    }
                }

                //if (z == 600 || z ==840)
                //{
                //    SetSpan(gvTimeLine, z, 0, 10, 0, "Middle");
                //    gvTimeLine.Rows[0].Cells[z].Value = "Break";
                //    gvTimeLine.Rows[0].Cells[z].Style.Font = new Font("Arial", 12F, FontStyle.Bold, GraphicsUnit.Pixel);
                //    gvTimeLine.Rows[0].Cells[z].Style.BackColor = Color.LightSteelBlue;
                //    gvTimeLine.Rows[0].Cells[z].Style.ForeColor = Color.Black;

                //}

                //if (z == 720)
                //{
                //    SetSpan(gvTimeLine, z, 0, 20, 0, "Middle");
                //    gvTimeLine.Rows[0].Cells[z].Value = "Lunch";
                //    gvTimeLine.Rows[0].Cells[z].Style.Font = new Font("Arial", 12F, FontStyle.Bold, GraphicsUnit.Pixel);
                //    gvTimeLine.Rows[0].Cells[z].Style.BackColor = Color.LightSteelBlue;
                //    gvTimeLine.Rows[0].Cells[z].Style.ForeColor = Color.Black;
                //}
            }

            //int intShiftGrid = (Convert.ToInt32(strHour) * 60) + 60;
            //gvWholeTimeline.FirstDisplayedScrollingColumnIndex = intShiftGrid;
            //gvWorkOrder.FirstDisplayedScrollingColumnIndex = intShiftGrid;
            //gvTimeLine.FirstDisplayedScrollingColumnIndex = intShiftGrid;
        }