using System; using System.Collections; using System.Configuration; using System.Data; using System.Linq; using System.Web; using System.Web.Security; using System.Web.UI; using System.Web.UI.HtmlControls; using System.Web.UI.WebControls; using System.Web.UI.WebControls.WebParts; using System.Xml.Linq; using System.Text; using System.Drawing; using System.Collections.Generic; using Telerik.Web.UI; namespace PEWebApp.Pages.ResultMgt { public partial class Res27 : PageBase { protected int iPage; protected int iPageSize; protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { InitControl(); } } public override void VerifyRenderingInServerForm(Control control) { } private void InitControl() { Common_nTx bzobj = new Common_nTx(); Utility.BindDropDownList1(this.ddlYear, bzobj.GetProdYearDropDownList(), true, "", "Select"); this.ddlYear.SelectedIndex = 0; this.ddlYear.SelectedValue = Convert.ToString(System.DateTime.Now.Year); this.ddlMonth.SelectedIndex = System.DateTime.Now.Month; this.lblInquiryTime.Text = System.DateTime.Now.ToString("HH:mm:ss"); } private void BindGrid() { Common_nTx com_nTX = new Common_nTx(); this.lblInquiryTime.Text = System.DateTime.Now.ToString("HH:mm:ss"); Pln16_nTx bzobj = new Pln16_nTx(); string sShopCd = this.ddlShop.Text; string sPlanMonth = this.ddlYear.SelectedValue + this.ddlMonth.SelectedValue; string[] sLineTemp = this.ddlLine.SelectedValue.Split(':'); DataTable dt = bzobj.GetDailyProdResultList(sShopCd, sLineCode, sPlanMonth); if (dt.Rows.Count == 0) { gv.DataSource = new string[] { }; } else { this.gv.DataSource = dt; } if (gv.Items.Count > 0) { foreach (GridDataItem item in gv.Items) { if (item.Cells[2].Text == "합계") { item.BackColor = System.Drawing.Color.LightPink; item.CssClass = "pinkCell"; break; } } } iPage = gv.CurrentPageIndex; iPageSize = gv.PageSize; } private void BindGridDetail(int nRowIndex, string sColIndex, string sColVal) { Pln16_nTx bzobj = new Pln16_nTx(); string sShopCd = this.ddlShop.Text; string sPlanMonth = this.ddlYear.SelectedValue + this.ddlMonth.SelectedValue; string sPlanDate = sPlanMonth + sColIndex; string sLineCode = this.ddlLine.SelectedValue; string sProductCode = gv.Items[nRowIndex].Cells[4].Text; DataTable dt = bzobj.GetDailyProdResultDetailList(sShopCd, sLineCode, sPlanDate, sProductCode); if (dt.Rows.Count == 0) { gvDetail.DataSource = new string[] { }; } else { this.gvDetail.DataSource = dt; } iPage = gvDetail.CurrentPageIndex; iPageSize = gvDetail.PageSize; return; } protected void ibtnInquiry_Click(object sender, ImageClickEventArgs e) { gv.CurrentPageIndex = 0; gv.Rebind(); } protected void btnInquiry_Click(object sender, EventArgs e) { gv.CurrentPageIndex = 0; gv.Rebind(); } protected void gv_SelectedIndexChanged(object sender, EventArgs e) { BindGrid(); } protected void gv_NeedDataSource(object sender, GridNeedDataSourceEventArgs e) { BindGrid(); } protected void gvDetail_NeedDataSource(object sender, GridNeedDataSourceEventArgs e) { } protected void gv_ItemDataBound(object sender, GridItemEventArgs e) { } protected void gv_ItemConmmand(object source, GridCommandEventArgs e) { /* if (e.CommandName == "RowClick") { gvDetail.CurrentPageIndex = 0; gvDetail.Rebind(); var itemIndex = e.Item.ItemIndexHierarchical; string scriptstring = "alert('Row was clicked, Index: " + itemIndex + "');"; ScriptManager.RegisterStartupScript(Page, Page.GetType(), "myalert", scriptstring, true); } */ if (e.CommandName == "cellSelected") { var clickedColumnName = e.CommandArgument.ToString(); string str = clickedColumnName.ToString(); string strRowCol = str; string[] strTemp = strRowCol.Split(','); string[] strRow = strTemp[0].Split(':'); string sRow = strRow[1]; string[] strCol = strTemp[1].Split(':'); string sCol = strCol[1]; string sColIndex = sCol.Replace("D_", ""); int nRowIndex = Convert.ToInt32(sRow); BindGridDetail(nRowIndex, sColIndex, sCol); gvDetail.CurrentPageIndex = 0; gvDetail.Rebind(); } } protected void RadGrid1_SelectedIndexChanged(object sender, EventArgs e) { var dataItem = gv.SelectedItems[0] as GridDataItem; if (dataItem != null) { var name = dataItem["ColUniqueName"].Text; } } } }