public bool LineInputInsert(LineInputDay line) { int result = 0; using (SqlCommand command = new SqlCommand("LineInput_Insert", openConnection())) { try { command.CommandType = CommandType.StoredProcedure; command.Parameters.Add(new SqlParameter("@LineName", line.line)); command.Parameters.Add(new SqlParameter("@PlanId", line.planid)); command.Parameters.Add(new SqlParameter("@Model", line.model)); command.Parameters.Add(new SqlParameter("@ModelA", line.modelA)); command.Parameters.Add(new SqlParameter("@ModelB", line.modelB)); command.Parameters.Add(new SqlParameter("@ModelC", line.modelC)); command.Parameters.Add(new SqlParameter("@RS", line.rs)); command.Parameters.Add(new SqlParameter("@Planed_Worker", line.planed_woker)); command.Parameters.Add(new SqlParameter("@Actual_Worker", line.actual_woker)); command.Parameters.Add(new SqlParameter("@Plan", line.plan)); command.Parameters.Add(new SqlParameter("@Tact_Time", line.tact_time)); command.Parameters.Add(new SqlParameter("@Total_Minute", line.total_min)); command.Parameters.Add(new SqlParameter("@Actual", null)); command.Parameters.Add(new SqlParameter("@Diff", null)); command.Parameters.Add(new SqlParameter("@Target", null)); /* * command.Parameters.Add(new SqlParameter("@Actual", line.actual)); * command.Parameters.Add(new SqlParameter("@Diff", line.diff)); * command.Parameters.Add(new SqlParameter("@Target", line.target)); */ command.Parameters.Add(new SqlParameter("@Archived_Rate", line.acchived_rate)); command.Parameters.Add(new SqlParameter("@Rank", line.rank)); command.Parameters.Add(new SqlParameter("@From1", line.from1)); command.Parameters.Add(new SqlParameter("@To1", line.to1)); command.Parameters.Add(new SqlParameter("@From2", line.from2)); command.Parameters.Add(new SqlParameter("@To2", line.to2)); command.Parameters.Add(new SqlParameter("@From3", line.from3)); command.Parameters.Add(new SqlParameter("@To3", line.to3)); command.Parameters.Add(new SqlParameter("@From4", line.from4)); command.Parameters.Add(new SqlParameter("@To4", line.to4)); command.Parameters.Add(new SqlParameter("@From5", line.from5)); command.Parameters.Add(new SqlParameter("@To5", line.to5)); command.Parameters.Add(new SqlParameter("@From6", line.from6)); command.Parameters.Add(new SqlParameter("@To6", line.to6)); command.Parameters.Add(new SqlParameter("@H07", null)); command.Parameters.Add(new SqlParameter("@H08", null)); command.Parameters.Add(new SqlParameter("@H09", null)); command.Parameters.Add(new SqlParameter("@H10", null)); command.Parameters.Add(new SqlParameter("@H11", null)); command.Parameters.Add(new SqlParameter("@H12", null)); command.Parameters.Add(new SqlParameter("@H13", null)); command.Parameters.Add(new SqlParameter("@H14", null)); command.Parameters.Add(new SqlParameter("@H15", null)); command.Parameters.Add(new SqlParameter("@H16", null)); command.Parameters.Add(new SqlParameter("@H17", null)); command.Parameters.Add(new SqlParameter("@H18", null)); command.Parameters.Add(new SqlParameter("@Comments", line.comment)); command.Parameters.Add(new SqlParameter("@Status", line.status)); result = command.ExecuteNonQuery(); } catch (SqlException) { return(false); } finally { this.closeConnection(); } return(result > 0); } }
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 }
public LineInputDay LineInputSelectByLine(int linename, int planid) { DataTable dt = new DataTable(); LineInputDay objLine = new LineInputDay(); try { using (SqlCommand command = new SqlCommand("Select * from LineInputDay where LineName = @LineName and PlanId = @PlanId", openConnection())) { command.Parameters.AddWithValue("@LineName", linename); command.Parameters.AddWithValue("@PlanId", planid); SqlDataAdapter da = new SqlDataAdapter(command); da.Fill(dt); objLine.line = int.Parse(dt.Rows[0]["LineName"].ToString()); objLine.rs = bool.Parse(dt.Rows[0]["RS"].ToString()); objLine.model = dt.Rows[0]["Model"].ToString(); objLine.changemodel = dt.Rows[0]["ChangeModel"].ToString(); objLine.planed_woker = commonFun.ConvertInt2(dt.Rows[0]["Planed_Worker"].ToString()); objLine.actual_woker = commonFun.ConvertInt2(dt.Rows[0]["Actual_Worker"].ToString()); objLine.plan = commonFun.ConvertInt2(dt.Rows[0]["Plan"].ToString()); objLine.acchived_rate = (float)commonFun.ConvertDouble(dt.Rows[0]["Archived_Rate"].ToString()); objLine.rank = dt.Rows[0]["Rank"].ToString(); objLine.tact_time = (float)commonFun.ConvertDouble(dt.Rows[0]["Tact_Time"].ToString()); objLine.total_min = commonFun.ConvertInt2(dt.Rows[0]["Total_Minute"].ToString()); objLine.actual = commonFun.ConvertInt2(dt.Rows[0]["Actual"].ToString()); objLine.diff = commonFun.ConvertInt2(dt.Rows[0]["Diff"].ToString()); objLine.target = commonFun.ConvertInt2(dt.Rows[0]["Target"].ToString()); objLine.h07 = commonFun.ConvertInt2(dt.Rows[0]["H07"].ToString()); objLine.h08 = commonFun.ConvertInt2(dt.Rows[0]["H08"].ToString()); objLine.h09 = commonFun.ConvertInt2(dt.Rows[0]["H09"].ToString()); objLine.h10 = commonFun.ConvertInt2(dt.Rows[0]["H10"].ToString()); objLine.h11 = commonFun.ConvertInt2(dt.Rows[0]["H11"].ToString()); objLine.h12 = commonFun.ConvertInt2(dt.Rows[0]["H12"].ToString()); objLine.h13 = commonFun.ConvertInt2(dt.Rows[0]["H13"].ToString()); objLine.h14 = commonFun.ConvertInt2(dt.Rows[0]["H14"].ToString()); objLine.h15 = commonFun.ConvertInt2(dt.Rows[0]["H15"].ToString()); objLine.h16 = commonFun.ConvertInt2(dt.Rows[0]["H16"].ToString()); objLine.h17 = commonFun.ConvertInt2(dt.Rows[0]["H17"].ToString()); objLine.h18 = commonFun.ConvertInt2(dt.Rows[0]["H18"].ToString()); objLine.from1 = dt.Rows[0]["From1"].ToString(); objLine.to1 = dt.Rows[0]["To1"].ToString(); objLine.from2 = dt.Rows[0]["From2"].ToString(); objLine.to2 = dt.Rows[0]["To2"].ToString(); objLine.from3 = dt.Rows[0]["From3"].ToString(); objLine.to3 = dt.Rows[0]["To3"].ToString(); objLine.from4 = dt.Rows[0]["From4"].ToString(); objLine.to4 = dt.Rows[0]["To4"].ToString(); objLine.from5 = dt.Rows[0]["From5"].ToString(); objLine.to5 = dt.Rows[0]["To5"].ToString(); objLine.from6 = dt.Rows[0]["From6"].ToString(); objLine.to6 = dt.Rows[0]["To6"].ToString(); objLine.comment = dt.Rows[0]["Comments"].ToString(); objLine.status = dt.Rows[0]["Status"].ToString(); objLine.changedActual = bool.Parse(dt.Rows[0]["ChangedPlaned"].ToString()); } } catch (Exception) { objLine = null; } this.closeConnection(); return(objLine); }
public LineInputDay LineInput_GetStocking(int planid) { DataTable dt = new DataTable(); LineInputDay line_ = new LineInputDay(); using (SqlCommand command = new SqlCommand("Select * FROM LineInputDay Where Model = @Model AND PlanId = @PlanId", openConnection())) { command.Parameters.Add(new SqlParameter("@Model", "Stocking")); command.Parameters.Add(new SqlParameter("@PlanId", planid)); SqlDataAdapter da = new SqlDataAdapter(command); da.Fill(dt); int i = 0; this.closeConnection(); line_.line = int.Parse(dt.Rows[0]["LineName"].ToString()); if (int.TryParse(dt.Rows[0]["Actual"].ToString(), out i)) { line_.actual = i; } if (int.TryParse(dt.Rows[0]["Plan"].ToString(), out i)) { line_.plan = i; } if (int.TryParse(dt.Rows[0]["Diff"].ToString(), out i)) { line_.diff = i; } if (int.TryParse(dt.Rows[0]["Target"].ToString(), out i)) { line_.target = i; } if (int.TryParse(dt.Rows[0]["H07"].ToString(), out i)) { line_.h07 = i; } if (int.TryParse(dt.Rows[0]["H08"].ToString(), out i)) { line_.h08 = i; } if (int.TryParse(dt.Rows[0]["H09"].ToString(), out i)) { line_.h09 = i; } if (int.TryParse(dt.Rows[0]["H10"].ToString(), out i)) { line_.h10 = i; } if (int.TryParse(dt.Rows[0]["H11"].ToString(), out i)) { line_.h11 = i; } if (int.TryParse(dt.Rows[0]["H12"].ToString(), out i)) { line_.h12 = i; } if (int.TryParse(dt.Rows[0]["H13"].ToString(), out i)) { line_.h13 = i; } if (int.TryParse(dt.Rows[0]["H14"].ToString(), out i)) { line_.h14 = i; } if (int.TryParse(dt.Rows[0]["H15"].ToString(), out i)) { line_.h15 = i; } if (int.TryParse(dt.Rows[0]["H16"].ToString(), out i)) { line_.h16 = i; } if (int.TryParse(dt.Rows[0]["H17"].ToString(), out i)) { line_.h17 = i; } if (int.TryParse(dt.Rows[0]["H18"].ToString(), out i)) { line_.h18 = i; } line_.comment = dt.Rows[0]["Comments"].ToString(); line_.status = dt.Rows[0]["Status"].ToString(); } return(line_); }
public bool LineDayUpdate(LineInputDay line) { return(obj.LineInputUpdate(line)); }
public bool LineDayInsert(LineInputDay line) { return(obj.LineInputInsert(line)); }
protected void btnSave_Click(object sender, ImageClickEventArgs e) { ImageButton btnBack = (ImageButton)sender; GridViewRow row = (GridViewRow)btnBack.NamingContainer; ImageButton btnSave = (ImageButton)row.FindControl("btnSave"); LineInputDay line_ = new LineInputDay(); int actualcount = 0; line_ = input.LineDayByLine(int.Parse(row.Cells[0].Text), planid); btnSave.Visible = false; btnBack.Visible = false; for (int i = 7; i <= DateTime.Now.Hour; i++) { int a = 0; string hourStr = this.convertIntegerLessThan10(i); Label lblhour = (Label)row.FindControl("lbl" + hourStr + "H"); TextBox txthour = (TextBox)row.FindControl("txt" + hourStr + "H"); if (int.TryParse(txthour.Text, out a)) { actualcount += a; if (i == 7) { line_.h07 = a; } else if (i == 8) { line_.h08 = a; } else if (i == 9) { line_.h09 = a; } else if (i == 10) { line_.h10 = a; } else if (i == 11) { line_.h11 = a; } else if (i == 12) { line_.h12 = a; } else if (i == 13) { line_.h13 = a; } else if (i == 14) { line_.h14 = a; } else if (i == 15) { line_.h15 = a; } else if (i == 16) { line_.h16 = a; } else if (i == 17) { line_.h17 = a; } else if (i == 18) { line_.h18 = a; } } else { ScriptManager.RegisterStartupScript(this, GetType(), "showalert", "alert('Error: " + txthour.ID + " is not integer type');", true); return; } } line_.actual = actualcount; line_.planid = planid; if (input.LineDayUpdate(line_)) { for (int i = 7; i <= DateTime.Now.Hour; i++) { string hourStr = this.convertIntegerLessThan10(i); Label lblhour = (Label)row.FindControl("lbl" + hourStr + "H"); TextBox txthour = (TextBox)row.FindControl("txt" + hourStr + "H"); lblhour.Text = txthour.Text; lblhour.Visible = true; txthour.Visible = false; setActiveRowEvent(row, false); } input_BLL.LineInput_UpdateChangeActual(int.Parse(row.Cells[0].Text), true, planid); Response.Redirect("ChangeActualInputDay.aspx"); } else { ScriptManager.RegisterStartupScript(this, GetType(), "showalert", "alert('Error: Can't save to Database, try again');", true); return; } }