Beispiel #1
0
        protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e)
        {
            if (e.Row.RowType == DataControlRowType.DataRow)
            {
                e.Row.ToolTip = "Click to select this row.";
                e.Row.Attributes["onclick"] = Page.ClientScript.GetPostBackClientHyperlink(GridView1, "Select$" + e.Row.RowIndex);

                int line    = int.Parse(e.Row.Cells[0].Text);
                int lineNew = line + 7;
                if (line >= 44)
                {
                    e.Row.Cells[0].Text = lineNew.ToString();
                }

                if (!input_BLL.InputDay_CheckRSbyLine(line, planid))
                {
                    for (int i = 1; i < 21; i++)
                    {
                        e.Row.Cells[i].Text = "";
                    }
                    e.Row.Cells[21].Text = "-";
                }
            }
        }
        protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e)
        {
            string color;

            if (ddlShift.SelectedValue.Equals("Day"))
            //DAY
            #region Day
            {
                LineColorDay_BLL colorLine    = new LineColorDay_BLL();
                LineInputDay     lineStocking = new LineInputDay();
                lineStocking     = inputDay_BLL.InputDay_GetStocking(planid);
                stockingPosition = lineStocking.line;

                if (e.Row.RowType == DataControlRowType.Footer)
                {
                    int         index = GridView1.Rows.Count;
                    GridViewRow row   = new GridViewRow(0, 0, DataControlRowType.Footer, DataControlRowState.Normal);
                    TableCell   cell  = new TableCell();
                    cell.Text       = "Stocking:";
                    cell.ColumnSpan = 4;
                    row.Cells.Add(cell);
                    cell      = new TableCell();
                    cell.Text = "-";
                    row.Cells.Add(cell);
                    cell      = new TableCell();
                    cell.Text = "-";
                    row.Cells.Add(cell);
                    cell      = new TableCell();
                    cell.Text = lineStocking.plan.ToString();
                    row.Cells.Add(cell);
                    cell      = new TableCell();
                    cell.Text = lineStocking.actual.ToString();
                    row.Cells.Add(cell);
                    cell      = new TableCell();
                    cell.Text = lineStocking.diff.ToString();
                    row.Cells.Add(cell);
                    cell      = new TableCell();
                    cell.Text = lineStocking.target.ToString();
                    row.Cells.Add(cell);
                    cell = new TableCell();
                    float actualrateStocking = 0;
                    if (lineStocking.target != 0)
                    {
                        actualrateStocking = (float)lineStocking.actual / lineStocking.target * 100;
                    }
                    cell.Text = actualrateStocking.ToString("F1") + "%";
                    row.Cells.Add(cell);
                    cell           = new TableCell();
                    cell.Text      = lineStocking.h07.ToString();
                    cell.BackColor = setColor(colorLine.getColorDayByColum("Color07H", stockingPosition, planid));
                    row.Cells.Add(cell);
                    cell           = new TableCell();
                    cell.Text      = lineStocking.h08.ToString();
                    cell.BackColor = setColor(colorLine.getColorDayByColum("Color08H", stockingPosition, planid));
                    row.Cells.Add(cell);
                    cell           = new TableCell();
                    cell.Text      = lineStocking.h09.ToString();
                    cell.BackColor = setColor(colorLine.getColorDayByColum("Color09H", stockingPosition, planid));
                    row.Cells.Add(cell);
                    cell           = new TableCell();
                    cell.Text      = lineStocking.h10.ToString();
                    cell.BackColor = setColor(colorLine.getColorDayByColum("Color10H", stockingPosition, planid));
                    row.Cells.Add(cell);
                    cell           = new TableCell();
                    cell.Text      = lineStocking.h11.ToString();
                    cell.BackColor = setColor(colorLine.getColorDayByColum("Color11H", stockingPosition, planid));
                    row.Cells.Add(cell);
                    cell           = new TableCell();
                    cell.Text      = lineStocking.h12.ToString();
                    cell.BackColor = setColor(colorLine.getColorDayByColum("Color12H", stockingPosition, planid));
                    row.Cells.Add(cell);
                    cell           = new TableCell();
                    cell.Text      = lineStocking.h13.ToString();
                    cell.BackColor = setColor(colorLine.getColorDayByColum("Color13H", stockingPosition, planid));
                    row.Cells.Add(cell);
                    cell           = new TableCell();
                    cell.Text      = lineStocking.h14.ToString();
                    cell.BackColor = setColor(colorLine.getColorDayByColum("Color14H", stockingPosition, planid));
                    row.Cells.Add(cell);
                    cell           = new TableCell();
                    cell.Text      = lineStocking.h15.ToString();
                    cell.BackColor = setColor(colorLine.getColorDayByColum("Color15H", stockingPosition, planid));
                    row.Cells.Add(cell);
                    cell           = new TableCell();
                    cell.Text      = lineStocking.h16.ToString();
                    cell.BackColor = setColor(colorLine.getColorDayByColum("Color16H", stockingPosition, planid));
                    row.Cells.Add(cell);
                    cell           = new TableCell();
                    cell.Text      = lineStocking.h17.ToString();
                    cell.BackColor = setColor(colorLine.getColorDayByColum("Color17H", stockingPosition, planid));
                    row.Cells.Add(cell);
                    cell           = new TableCell();
                    cell.Text      = lineStocking.h18.ToString();
                    cell.BackColor = setColor(colorLine.getColorDayByColum("Color18H", stockingPosition, planid));
                    row.Cells.Add(cell);
                    cell      = new TableCell();
                    cell.Text = lineStocking.comment.ToString();
                    row.Cells.Add(cell);
                    GridView1.Controls[0].Controls.Add(row);
                }
                if (e.Row.RowType == DataControlRowType.DataRow)
                {
                    int line    = int.Parse(e.Row.Cells[0].Text);
                    int lineNew = line + 7;
                    if (line >= 44)
                    {
                        e.Row.Cells[0].Text = lineNew.ToString();
                    }
                    if (inputDay_BLL.InputDay_CheckRSbyLine(line, planid))
                    {
                        if (!e.Row.Cells[4].Text.Equals(""))
                        {
                            totalPW += common.ConvertInt(e.Row.Cells[4].Text);
                        }
                        if (!e.Row.Cells[5].Text.Equals(""))
                        {
                            totalAW += common.ConvertInt(e.Row.Cells[5].Text);
                        }
                        if (!e.Row.Cells[6].Text.Equals(""))
                        {
                            totalPl += common.ConvertInt(e.Row.Cells[6].Text);
                        }
                        if (!e.Row.Cells[7].Text.Equals(""))
                        {
                            totalAC += common.ConvertInt(e.Row.Cells[7].Text);
                        }
                        if (!e.Row.Cells[8].Text.Equals(""))
                        {
                            totalDiff += common.ConvertInt(e.Row.Cells[8].Text);
                        }
                        if (!e.Row.Cells[9].Text.Equals(""))
                        {
                            totalTarget += common.ConvertInt(e.Row.Cells[9].Text);
                        }
                        if (!e.Row.Cells[11].Text.Equals(""))
                        {
                            color = colorLine.getColorDayByColum("Color07H", line, planid);
                            e.Row.Cells[11].BackColor = setColor(color);
                            total7 += common.ConvertInt(e.Row.Cells[11].Text);
                        }
                        if (!e.Row.Cells[12].Text.Equals(""))
                        {
                            color = colorLine.getColorDayByColum("Color08H", line, planid);
                            e.Row.Cells[12].BackColor = setColor(color);
                            total8 += common.ConvertInt(e.Row.Cells[12].Text);
                        }
                        if (!e.Row.Cells[13].Text.Equals(""))
                        {
                            color = colorLine.getColorDayByColum("Color09H", line, planid);
                            e.Row.Cells[13].BackColor = setColor(color);
                            total9 += common.ConvertInt(e.Row.Cells[13].Text);
                        }
                        if (!e.Row.Cells[14].Text.Equals(""))
                        {
                            color = colorLine.getColorDayByColum("Color10H", line, planid);
                            e.Row.Cells[14].BackColor = setColor(color);
                            total10 += common.ConvertInt(e.Row.Cells[14].Text);
                        }
                        if (!e.Row.Cells[15].Text.Equals(""))
                        {
                            color = colorLine.getColorDayByColum("Color11H", line, planid);
                            e.Row.Cells[15].BackColor = setColor(color);
                            total11 += common.ConvertInt(e.Row.Cells[15].Text);
                        }
                        if (!e.Row.Cells[16].Text.Equals(""))
                        {
                            color = colorLine.getColorDayByColum("Color12H", line, planid);
                            e.Row.Cells[16].BackColor = setColor(color);
                            total12 += common.ConvertInt(e.Row.Cells[16].Text);
                        }
                        if (!e.Row.Cells[17].Text.Equals(""))
                        {
                            color = colorLine.getColorDayByColum("Color13H", line, planid);
                            e.Row.Cells[17].BackColor = setColor(color);
                            total13 += common.ConvertInt(e.Row.Cells[17].Text);
                        }
                        if (!e.Row.Cells[18].Text.Equals(""))
                        {
                            color = colorLine.getColorDayByColum("Color14H", line, planid);
                            e.Row.Cells[18].BackColor = setColor(color);
                            total14 += common.ConvertInt(e.Row.Cells[18].Text);
                        }
                        if (!e.Row.Cells[19].Text.Equals(""))
                        {
                            color = colorLine.getColorDayByColum("Color15H", line, planid);
                            e.Row.Cells[19].BackColor = setColor(color);
                            total15 += common.ConvertInt(e.Row.Cells[19].Text);
                        }
                        if (!e.Row.Cells[20].Text.Equals(""))
                        {
                            color = colorLine.getColorDayByColum("Color16H", line, planid);
                            e.Row.Cells[20].BackColor = setColor(color);
                            total16 += common.ConvertInt(e.Row.Cells[20].Text);
                        }
                        if (!e.Row.Cells[21].Text.Equals(""))
                        {
                            color = colorLine.getColorDayByColum("Color17H", line, planid);
                            e.Row.Cells[21].BackColor = setColor(color);
                            total17 += common.ConvertInt(e.Row.Cells[21].Text);
                        }
                        if (!e.Row.Cells[22].Text.Equals(""))
                        {
                            color = colorLine.getColorDayByColum("Color18H", line, planid);
                            e.Row.Cells[22].BackColor = setColor(color);
                            total18 += common.ConvertInt(e.Row.Cells[22].Text);
                        }

                        if (e.Row.Cells[23].Text.Trim().Equals("Run"))
                        {
                            e.Row.Cells[23].Text      = "R";
                            e.Row.Cells[23].BackColor = Color.FromArgb(0, 204, 0);
                        }
                        else if (e.Row.Cells[23].Text.Trim().Equals("Stop"))
                        {
                            e.Row.Cells[23].Text      = "S";
                            e.Row.Cells[23].BackColor = Color.Red;
                        }
                    }
                    else
                    {
                        for (int i = 1; i < 23; i++)
                        {
                            e.Row.Cells[i].Text = "";
                        }
                        e.Row.Cells[23].Text = "-";
                    }
                }
            }
            #endregion
            else
            //Night
            #region Night
            {
                LineColorNight_BLL colorLine    = new LineColorNight_BLL();
                LineInputNight     lineStocking = new LineInputNight();
                lineStocking = inputNight_BLL.InputNight_GetStocking(planid);
                if (e.Row.RowType == DataControlRowType.Footer)
                {
                    int         index = GridView1.Rows.Count;
                    GridViewRow row   = new GridViewRow(0, 0, DataControlRowType.Footer, DataControlRowState.Normal);
                    TableCell   cell  = new TableCell();
                    cell.Text       = "Stocking:";
                    cell.ColumnSpan = 4;
                    row.Cells.Add(cell);
                    cell      = new TableCell();
                    cell.Text = "-";
                    row.Cells.Add(cell);
                    cell      = new TableCell();
                    cell.Text = "-";
                    row.Cells.Add(cell);
                    cell      = new TableCell();
                    cell.Text = lineStocking.plan.ToString();
                    row.Cells.Add(cell);
                    cell      = new TableCell();
                    cell.Text = lineStocking.actual.ToString();
                    row.Cells.Add(cell);
                    cell      = new TableCell();
                    cell.Text = lineStocking.diff.ToString();
                    row.Cells.Add(cell);
                    cell      = new TableCell();
                    cell.Text = lineStocking.target.ToString();
                    row.Cells.Add(cell);
                    cell = new TableCell();
                    float actualrateStocking = 0;
                    if (lineStocking.target != 0)
                    {
                        actualrateStocking = (float)lineStocking.actual / lineStocking.target * 100;
                    }
                    cell.Text = actualrateStocking.ToString("F1") + "%";
                    row.Cells.Add(cell);
                    cell           = new TableCell();
                    cell.Text      = lineStocking.h19.ToString();
                    cell.BackColor = setColor(colorLine.getColorNightByColum("Color19H", 39, planid));
                    row.Cells.Add(cell);
                    cell           = new TableCell();
                    cell.Text      = lineStocking.h20.ToString();
                    cell.BackColor = setColor(colorLine.getColorNightByColum("Color20H", 39, planid));
                    row.Cells.Add(cell);
                    cell           = new TableCell();
                    cell.Text      = lineStocking.h21.ToString();
                    cell.BackColor = setColor(colorLine.getColorNightByColum("Color21H", 39, planid));
                    row.Cells.Add(cell);
                    cell           = new TableCell();
                    cell.Text      = lineStocking.h22.ToString();
                    cell.BackColor = setColor(colorLine.getColorNightByColum("Color22H", 39, planid));
                    row.Cells.Add(cell);
                    cell           = new TableCell();
                    cell.Text      = lineStocking.h23.ToString();
                    cell.BackColor = setColor(colorLine.getColorNightByColum("Color23H", 39, planid));
                    row.Cells.Add(cell);
                    cell           = new TableCell();
                    cell.Text      = lineStocking.h00.ToString();
                    cell.BackColor = setColor(colorLine.getColorNightByColum("Color00H", 39, planid));
                    row.Cells.Add(cell);
                    cell           = new TableCell();
                    cell.Text      = lineStocking.h01.ToString();
                    cell.BackColor = setColor(colorLine.getColorNightByColum("Color01H", 39, planid));
                    row.Cells.Add(cell);
                    cell           = new TableCell();
                    cell.Text      = lineStocking.h02.ToString();
                    cell.BackColor = setColor(colorLine.getColorNightByColum("Color02H", 39, planid));
                    row.Cells.Add(cell);
                    cell           = new TableCell();
                    cell.Text      = lineStocking.h03.ToString();
                    cell.BackColor = setColor(colorLine.getColorNightByColum("Color03H", 39, planid));
                    row.Cells.Add(cell);
                    cell           = new TableCell();
                    cell.Text      = lineStocking.h04.ToString();
                    cell.BackColor = setColor(colorLine.getColorNightByColum("Color04H", 39, planid));
                    row.Cells.Add(cell);
                    cell           = new TableCell();
                    cell.Text      = lineStocking.h05.ToString();
                    cell.BackColor = setColor(colorLine.getColorNightByColum("Color05H", 39, planid));
                    row.Cells.Add(cell);
                    cell           = new TableCell();
                    cell.Text      = lineStocking.h06.ToString();
                    cell.BackColor = setColor(colorLine.getColorNightByColum("Color06H", 39, planid));
                    row.Cells.Add(cell);
                    cell      = new TableCell();
                    cell.Text = lineStocking.comment.ToString();
                    row.Cells.Add(cell);
                    GridView1.Controls[0].Controls.Add(row);
                }
                if (e.Row.RowType == DataControlRowType.DataRow)
                {
                    int line    = int.Parse(e.Row.Cells[0].Text);
                    int lineNew = line + 7;
                    if (line >= 44)
                    {
                        e.Row.Cells[0].Text = lineNew.ToString();
                    }
                    if (inputNight_BLL.InputNight_CheckRSbyLine(line, planid))
                    {
                        if (!e.Row.Cells[4].Text.Equals(""))
                        {
                            totalPW += common.ConvertInt(e.Row.Cells[4].Text);
                        }
                        if (!e.Row.Cells[5].Text.Equals(""))
                        {
                            totalAW += common.ConvertInt(e.Row.Cells[5].Text);
                        }
                        if (!e.Row.Cells[6].Text.Equals(""))
                        {
                            totalPl += common.ConvertInt(e.Row.Cells[6].Text);
                        }
                        if (!e.Row.Cells[7].Text.Equals(""))
                        {
                            totalAC += common.ConvertInt(e.Row.Cells[7].Text);
                        }
                        if (!e.Row.Cells[8].Text.Equals(""))
                        {
                            totalDiff += common.ConvertInt(e.Row.Cells[8].Text);
                        }
                        if (!e.Row.Cells[9].Text.Equals(""))
                        {
                            totalTarget += common.ConvertInt(e.Row.Cells[9].Text);
                        }
                        if (!e.Row.Cells[11].Text.Equals(""))
                        {
                            color = colorLine.getColorNightByColum("Color19H", line, planid);
                            e.Row.Cells[11].BackColor = setColor(color);
                            total19 += common.ConvertInt(e.Row.Cells[11].Text);
                        }
                        if (!e.Row.Cells[12].Text.Equals(""))
                        {
                            color = colorLine.getColorNightByColum("Color20H", line, planid);
                            e.Row.Cells[12].BackColor = setColor(color);
                            total20 += common.ConvertInt(e.Row.Cells[12].Text);
                        }
                        if (!e.Row.Cells[13].Text.Equals(""))
                        {
                            color = colorLine.getColorNightByColum("Color21H", line, planid);
                            e.Row.Cells[13].BackColor = setColor(color);
                            total21 += common.ConvertInt(e.Row.Cells[13].Text);
                        }
                        if (!e.Row.Cells[14].Text.Equals(""))
                        {
                            color = colorLine.getColorNightByColum("Color22H", line, planid);
                            e.Row.Cells[14].BackColor = setColor(color);
                            total22 += common.ConvertInt(e.Row.Cells[14].Text);
                        }
                        if (!e.Row.Cells[15].Text.Equals(""))
                        {
                            color = colorLine.getColorNightByColum("Color23H", line, planid);
                            e.Row.Cells[15].BackColor = setColor(color);
                            total23 += common.ConvertInt(e.Row.Cells[15].Text);
                        }
                        if (!e.Row.Cells[16].Text.Equals(""))
                        {
                            color = colorLine.getColorNightByColum("Color00H", line, planid);
                            e.Row.Cells[16].BackColor = setColor(color);
                            total0 += common.ConvertInt(e.Row.Cells[16].Text);
                        }
                        if (!e.Row.Cells[17].Text.Equals(""))
                        {
                            color = colorLine.getColorNightByColum("Color01H", line, planid);
                            e.Row.Cells[17].BackColor = setColor(color);
                            total1 += common.ConvertInt(e.Row.Cells[17].Text);
                        }
                        if (!e.Row.Cells[18].Text.Equals(""))
                        {
                            color = colorLine.getColorNightByColum("Color02H", line, planid);
                            e.Row.Cells[18].BackColor = setColor(color);
                            total2 += common.ConvertInt(e.Row.Cells[18].Text);
                        }
                        if (!e.Row.Cells[19].Text.Equals(""))
                        {
                            color = colorLine.getColorNightByColum("Color03H", line, planid);
                            e.Row.Cells[19].BackColor = setColor(color);
                            total3 += common.ConvertInt(e.Row.Cells[19].Text);
                        }
                        if (!e.Row.Cells[20].Text.Equals(""))
                        {
                            color = colorLine.getColorNightByColum("Color04H", line, planid);
                            e.Row.Cells[20].BackColor = setColor(color);
                            total4 += common.ConvertInt(e.Row.Cells[20].Text);
                        }
                        if (!e.Row.Cells[21].Text.Equals(""))
                        {
                            color = colorLine.getColorNightByColum("Color05H", line, planid);
                            e.Row.Cells[21].BackColor = setColor(color);
                            total5 += common.ConvertInt(e.Row.Cells[21].Text);
                        }
                        if (!e.Row.Cells[22].Text.Equals(""))
                        {
                            color = colorLine.getColorNightByColum("Color06H", line, planid);
                            e.Row.Cells[22].BackColor = setColor(color);
                            total6 += common.ConvertInt(e.Row.Cells[22].Text);
                        }
                        if (e.Row.Cells[23].Text.Trim().Equals("Run"))
                        {
                            e.Row.Cells[23].Text      = "R";
                            e.Row.Cells[23].BackColor = Color.FromArgb(0, 204, 0);
                        }
                        else if (e.Row.Cells[23].Text.Trim().Equals("Stop"))
                        {
                            e.Row.Cells[23].Text      = "S";
                            e.Row.Cells[23].BackColor = Color.Red;
                        }
                    }
                    else
                    {
                        for (int i = 1; i < 23; i++)
                        {
                            e.Row.Cells[i].Text = "";
                        }
                        e.Row.Cells[23].Text = "-";
                    }
                }
            }
            #endregion
        }