public void QueryDetailClick(object sender, System.EventArgs e) { try { string Line = hfLine.Value; string Model = hfModel.Value; if (Model == "") { Model = hidOriModelList.Value; } if (Line == " ") { Line = ""; } if (Line == "" && hidOriLine.Value != "") { Line = hidOriLine.Value; } string Connection = CmbDBType.ddlGetConnection(); if (FAOnlineStation.IndexOf(hfStation.Value) > -1) { hidSelectDN.Value = ""; } DataTable dt = PoWIPTracking.GetSelectDetail2(Connection, hidOriDate.Value, Model, Line, hfStation.Value, hidSelectDN.Value); if (dt.Rows.Count > 0) { gvStationDetail.Visible = true; this.gvStationDetail.DataSource = dt; this.gvStationDetail.DataBind(); InitGridViewDetail(); } else { this.gvStationDetail.DataSource = getNullDataTableDetail(1); this.gvStationDetail.DataBind(); InitGridViewDetail(); showErrorMessage("Not Found Any Information!!"); } } catch (Exception ex) { showErrorMessage(ex.Message); BindNoData(); } finally { endWaitingCoverDiv(); } }
protected void btnQuery_Click(object sender, EventArgs e) { GetProcess(); try { DateTime ToDate = DateTime.Now; hfFromDate.Value = DateTime.Parse(txtFromDate.Text.ToString()).ToString(); hfToDate.Value = DateTime.Parse(txtToDate.Text.ToString()).ToString(); IList<string> lstPdLine = new List<string>(); foreach (ListItem item in lboxPdLine.Items) { if (item.Selected) { lstPdLine.Add(item.Value); } } IList<string> Model = new List<string>(); hidModelList.Value = hidModelList.Value.Replace("'", ""); txtModel.Text = txtModel.Text.Replace("'", ""); if (txtModel.Text != "") { Model.Add(txtModel.Text.Trim()); } else { Model = hidModelList.Value.Split(new string[] { "," }, StringSplitOptions.RemoveEmptyEntries); } string prdType; prdType = defaultSelectDB.Equals("Docking") ? "" : ChxLstProductType1.GetCheckList(); DataTable dt = MPLineInput.GetQueryResult(DBConnection, DateTime.Parse(hfFromDate.Value), DateTime.Parse(hfToDate.Value), lstPdLine, ddlFamily.SelectedValue, Model, StationList, bool.Parse(hfLineShife.Value), ddlStation.SelectedValue, false, prdType); if (dt.Rows.Count > 0) { this.gvResult.DataSource = getNullDataTable(dt.Rows.Count); this.gvResult.DataBind(); int[] sum = new int[dt.Columns.Count]; for (int i = 0; i <= dt.Rows.Count - 1; i++) { gvResult.Rows[i].Cells[0].Text = dt.Rows[i]["Line"].ToString(); gvResult.Rows[i].Cells[1].Text = dt.Rows[i]["Family"].ToString(); gvResult.Rows[i].Cells[2].Text = dt.Rows[i]["Model"].ToString(); string r_Family = ""; string r_Line = ""; string r_Model = ""; r_Line = gvResult.Rows[i].Cells[0].Text.Trim(); r_Family = gvResult.Rows[i].Cells[1].Text.Trim(); r_Model = gvResult.Rows[i].Cells[2].Text.Trim(); int MVS = 0 ; int ITCND = 0 ; int COA = 0 ; for (int j = FixedColCount; j <= dt.Columns.Count - 1; j++) { string r_Station = ""; r_Station = dt.Columns[j].ColumnName.ToString(); gvResult.Rows[i].Cells[j].Text = string.IsNullOrEmpty(dt.Rows[i][j].ToString()) ? "0" : dt.Rows[i][j].ToString(); if (gvResult.Rows[i].Cells[j].Text != "0") { gvResult.Rows[i].Cells[j].CssClass = "querycell"; gvResult.Rows[i].Cells[j].Attributes.Add("onclick", "SelectDetail('" + r_Station + "','" + r_Line + "','" + r_Model + "','" + r_Family + "','" + hfLineShife.Value + "')"); if (Array.IndexOf(MVS_SUM.Split(','), r_Station) > -1) { MVS += int.Parse(gvResult.Rows[i].Cells[j].Text); } if (Array.IndexOf(ITCND_SUM.Split(','), r_Station) > -1) { ITCND += int.Parse(gvResult.Rows[i].Cells[j].Text); } if (Array.IndexOf(COA_SUM.Split(','), r_Station) > -1) { COA += int.Parse(gvResult.Rows[i].Cells[j].Text); } sum[j] += int.Parse(gvResult.Rows[i].Cells[j].Text); } } gvResult.Rows[i].Cells[3].Text = (-1 * MVS).ToString(); gvResult.Rows[i].Cells[3].CssClass = MVS > 0 ? "querycell nopointer" : ""; sum[3] += (-1 *MVS); gvResult.Rows[i].Cells[4].Text = (-1 * ITCND).ToString(); gvResult.Rows[i].Cells[4].CssClass = ITCND > 0 ? "querycell nopointer" : ""; sum[4] += (-1 *ITCND); gvResult.Rows[i].Cells[5].Text = (-1 * COA).ToString(); gvResult.Rows[i].Cells[5].CssClass = COA > 0 ? "querycell nopointer" : ""; sum[5] += (-1 *COA); } //加入Header for (int j = FixedColCount; j <= dt.Columns.Count - 1; j++) { gvResult.HeaderRow.Cells[j].Attributes.Add("onclick", "SelectDetail('" + gvResult.HeaderRow.Cells[j].Text + "','All','All','All','true')"); } //加入Footer if (dt.Rows.Count > 0) { gvResult.FooterStyle.Font.Bold = true; gvResult.FooterRow.Cells[0].Text = ""; gvResult.FooterRow.Cells[1].Text = ""; gvResult.FooterRow.Cells[2].Text = "TOTAL"; for (int j = FixedColCount; j <= dt.Columns.Count - 1; j++) { gvResult.FooterRow.Cells[j].Text = sum[j].ToString(); gvResult.FooterRow.Cells[j].Font.Bold = true; gvResult.FooterRow.Cells[j].Font.Size = FontUnit.Parse("16px"); if (sum[j] > 0) { gvResult.HeaderRow.Cells[j].Attributes.Add("onmouseover", "currentcolor=this.style.backgroundColor; this.style.backgroundColor='blue';this.className='rowclient'; "); gvResult.HeaderRow.Cells[j].Attributes.Add("onmouseout", "this.style.backgroundColor=currentcolor;"); gvResult.HeaderRow.Cells[j].Attributes.Add("onclick", "SelectDetail('" + gvResult.HeaderRow.Cells[j].Text + "','All','All','All','true')"); } } gvResult.FooterRow.Visible = true; gvResult.FooterStyle.BorderColor = System.Drawing.Color.White; } InitGridViewHeader(); InitGridView(); EnableBtnExcel(this, true, btnExport.ClientID); //gvResult.GvExtHeight = "370px"; gvStationDetail.Visible = false; gvStationDetail.DataSource = null; gvStationDetail.DataBind(); } else { BindNoData(); showErrorMessage("Not Found Any Information!!"); } } catch (Exception ex) { showErrorMessage(ex.Message); BindNoData(); } finally { endWaitingCoverDiv(this); } }
public void QueryDetailClick(object sender, System.EventArgs e) { try { gvResult.GvExtHeight = "200px"; CallReset(); string Station = hfStation.Value; string Line = hfLine.Value; string Model = hfModel.Value; if (Model == "") { Model = hidOriModelList.Value; } if (Line == "" && hidOriLine.Value!="") { Line = hidOriLine.Value; } string Connection = CmbDBType.ddlGetConnection(); DataTable dt = PoWIPTracking.GetSelectDetail2(Connection, hidOriDate.Value, Model, Line, hfStation.Value,hidOriFamily.Value); if (dt.Rows.Count > 0) { gvStationDetail.Visible = true; this.gvStationDetail.DataSource = dt; // this.gvStationDetail.DataSource = getNullDataTableDetail(dt.Rows.Count); this.gvStationDetail.DataBind(); //for (int i = 0; i <= dt.Rows.Count - 1; i++) //{ // gvStationDetail.Rows[i].Cells[0].Text = dt.Rows[i]["ProductID"].ToString(); // gvStationDetail.Rows[i].Cells[1].Text = dt.Rows[i]["CUSTSN"].ToString(); // gvStationDetail.Rows[i].Cells[2].Text = dt.Rows[i]["Descr"].ToString(); // gvStationDetail.Rows[i].Cells[3].Text = dt.Rows[i]["Line"].ToString(); // gvStationDetail.Rows[i].Cells[4].Text = dt.Rows[i]["Editor"].ToString(); //} InitGridViewDetail(); } else { this.gvStationDetail.DataSource = getNullDataTableDetail(1); this.gvStationDetail.DataBind(); InitGridViewDetail(); showErrorMessage("Not Found Any Information!!"); } } catch (Exception ex) { showErrorMessage(ex.Message); BindNoData(); } endWaitingCoverDiv(); }
protected void gvResult_RowDataBound(object sender, GridViewRowEventArgs e) { string StationWC =""; string Line = ""; string Model = ""; if (e.Row.RowType == DataControlRowType.DataRow) { int idx = 1; if (droGroupType.SelectedValue == "Line") { idx = 2; } if (modeltemp == "") { modeltemp = e.Row.Cells[idx].Text; } if (e.Row.Cells[idx].Text == modeltemp) { } else { modeltemp = e.Row.Cells[idx].Text; count += 1; } e.Row.BackColor = bgc[count %2]; Model = e.Row.Cells[1].Text.Trim(); Line = e.Row.Cells[2].Text.Trim(); if (Model == "ALL") { Model = ""; } if (Line == "ALL") { Line = ""; } for (int i = 3; i < e.Row.Cells.Count; i++) { StationWC = gvResult.HeaderRow.Cells[i].Text.Trim(); if (e.Row.Cells[i].Text == " ") { e.Row.Cells[i].Text = "0"; } else { e.Row.Cells[i].BackColor=System.Drawing.ColorTranslator.FromHtml("#F78181"); e.Row.Cells[i].Attributes.Add("onmouseover", "currentcolor=this.style.backgroundColor; this.style.backgroundColor='yellow';this.className='rowclient' "); e.Row.Cells[i].Attributes.Add("onmouseout", "this.style.backgroundColor=currentcolor;"); e.Row.Cells[i].Attributes.Add("onclick", "SelectDetail('" + StationWC + "','" + Line + "','" + Model + "')"); } } } }
protected void gvResult_RowDataBound(object sender, GridViewRowEventArgs e) { string StationWC = ""; string Line = ""; string Model = ""; // e.Row.Cells[0].CssClass = "FreezingCol"; string DN = ""; if (e.Row.RowType == DataControlRowType.DataRow) { int idx = 1; if (e.Row.Cells[idx].Text == modeltemp) { // e.Row.CssClass = "row1"; // e.Row.Cells[4].Text = ""; e.Row.Cells[5].Text = ""; e.Row.Cells[6].Text = ""; e.Row.Cells[7].Text = ""; } else { modeltemp = e.Row.Cells[idx].Text; count += 1; // e.Row.CssClass = "row2"; } //e.Row.BackColor = bgc[count % 2]; e.Row.CssClass = bgclass[count % 2]; DN = e.Row.Cells[0].Text.Trim(); Model = e.Row.Cells[1].Text.Trim(); Line = e.Row.Cells[2].Text.Trim(); if (Model == "ALL") { Model = ""; } if (Line == "ALL") { Line = ""; } for (int i =8; i < e.Row.Cells.Count; i++) { StationWC = gvResult.HeaderRow.Cells[i].Text.Trim(); if (e.Row.Cells[i].Text == " " || e.Row.Cells[i].Text == "0") { // e.Row.Cells[i].Text = "0"; // e.Row.Attributes.Add("onclick", "ChangeRowColor()"); } else { e.Row.Cells[i].CssClass = "querycell"; // e.Row.Cells[i].BackColor = System.Drawing.ColorTranslator.FromHtml("#F78181"); // e.Row.Cells[i].Attributes.Add("onmouseover", "currentcolor=this.style.backgroundColor; this.style.backgroundColor='yellow';this.className='rowclient' "); // e.Row.Cells[i].Attributes.Add("onmouseout", "this.style.backgroundColor=currentcolor;"); e.Row.Cells[i].Attributes.Add("onclick", "SelectDetail('" + StationWC + "','" + Line + "','" + Model + "','"+DN+ "')"); } } } }