public void BindPPLDetail() { SchPPL.Text = ""; OracleQuery2 cc2 = new OracleQuery2(); DataTable dtppl = cc2.LoadCSPPL(); // dtppl = findPTTPerson(dtppl, group_id); ViewState["CurrentCSEditPPL"] = dtppl; ViewState["ALLPPL"] = dtppl; if (dtppl.Rows.Count > 0) { DataView dv = dtppl.DefaultView; dv.Sort = "LASTUPDATE desc"; DataTable sortedDT = dv.ToTable(); updateLabel.Text = ((DateTime)sortedDT.Rows[0]["LASTUPDATE"]).ToString("dd/MM/yyyy HH:mm:ss");//+ " by " + sortedDT.Rows[0]["UPDATE_BY"].ToString(); Grid_ppl.DataSource = dtppl; Grid_ppl.DataBind(); PPL_PANEL.Visible = true; } else { updateLabel.Text = "-"; Grid_ppl.DataSource = null; Grid_ppl.DataBind(); PPL_PANEL.Visible = false; } }
public void BindPPLDetail(string group_id, int level) { groupLabel.Text = group_id; LevelLabel.Text = level.ToString(); OracleQuery2 cc2 = new OracleQuery2(); SQLServerQuery ss = new SQLServerQuery(); DataTable dt = cc2.LoadPTTPPL(group_id); string result = ""; foreach (DataRow r in dt.Rows) { result = result + r["EMPLOYEE_ID"].ToString() + ","; } result = result.TrimEnd(','); DataTable dt_pis = ss.LoadINPIS("", result); DataTable dtppl = new DataTable(); dtppl.Columns.Add("EMPLOYEE_ID"); dtppl.Columns.Add("NAME"); dtppl.Columns.Add("POSITION"); dtppl.Columns.Add("COMPANY"); dtppl.Columns.Add("MOBILE"); dtppl.Columns.Add("GROUP_KEY"); if (dt != null && dt_pis != null && dt.Rows.Count > 0 && dt_pis.Rows.Count > 0) { var results = from table1 in dt.AsEnumerable() join table2 in dt_pis.AsEnumerable() on table1["EMPLOYEE_ID"].ToString() equals table2["P_ID"].ToString() select new { EMPLOYEE_ID = table1["EMPLOYEE_ID"].ToString(), FULLNAMETH = table2["FULLNAMETH"].ToString(), POSNAME = table2["POSNAME"].ToString(), unitname = table2["unitname"].ToString(), mobile = !string.IsNullOrEmpty(table2["mobile"].ToString()) ? table2["mobile"].ToString() : table1["mobile"].ToString() }; foreach (var item in results) { dtppl.Rows.Add(item.EMPLOYEE_ID, item.FULLNAMETH, item.POSNAME, item.unitname, item.mobile, 200); } } ViewState["CurrentPTTPPL"] = dtppl; if (dtppl.Rows.Count > 0) { Grid_ppl.DataSource = dtppl; Grid_ppl.DataBind(); PPL_PANEL.Visible = true; } else { Grid_ppl.DataSource = null; Grid_ppl.DataBind(); PPL_PANEL.Visible = false; } }
protected void Page_Load(object sender, EventArgs e) { if (IsPostBack) { Grid_ppl.DataSource = ViewState["CurrentPTTEditPPL"] as DataTable; Grid_ppl.DataBind(); } }
public void BindPPLDetail() { SchPPL.Text = ""; OracleQuery2 cc2 = new OracleQuery2(); DataTable dtppl = cc2.LoadGCPPL(); ViewState["CurrentGCEditPPL"] = dtppl; ViewState["ALLPPL"] = dtppl; if (dtppl.Rows.Count > 0) { Grid_ppl.DataSource = dtppl; Grid_ppl.DataBind(); PPL_PANEL.Visible = true; } else { Grid_ppl.DataSource = null; Grid_ppl.DataBind(); PPL_PANEL.Visible = false; } }
protected void SchPPL_TextChanged(object sender, EventArgs e) { string schtext = SchPPL.Text.Trim(); try { OracleQuery cc = new OracleQuery(); DataTable dt = new DataTable(); dt = ViewState["ALLPPL"] as DataTable; dt.DefaultView.RowFilter = "[keyword] LIKE '%" + schtext + "%'"; DataTable dtOutput = dt.DefaultView.ToTable(); ViewState["CurrentGCEditPPL"] = dtOutput; Grid_ppl.DataSource = dtOutput; Grid_ppl.DataBind(); } catch { DataTable dtOutput = ViewState["ALLPPL"] as DataTable; ViewState["CurrentGCEditPPL"] = dtOutput; Grid_ppl.DataSource = dtOutput; Grid_ppl.DataBind(); } }
public void BindPPLDetail(string group_id, int level) { groupLabel.Text = group_id; LevelLabel.Text = level.ToString(); OracleQuery2 cc2 = new OracleQuery2(); DataTable dtppl = cc2.LoadGCPPL(group_id); //dtppl = findPTTPerson(dtppl, group_id); ViewState["CurrentGCPPL"] = dtppl; if (dtppl.Rows.Count > 0) { Grid_ppl.DataSource = dtppl; Grid_ppl.DataBind(); PPL_PANEL.Visible = true; } else { Grid_ppl.DataSource = null; Grid_ppl.DataBind(); PPL_PANEL.Visible = false; } }
public void BindPPLDetail() { SchPPL.Text = ""; OracleQuery2 cc2 = new OracleQuery2(); SQLServerQuery ss = new SQLServerQuery(); DataTable dt = cc2.LoadPTTPPL(); string result = ""; foreach (DataRow r in dt.Rows) { result = result + r["EMPLOYEE_ID"].ToString() + ","; } result = result.TrimEnd(','); DataTable dt_pis = ss.LoadINPIS("", result); DataTable dtppl = new DataTable(); dtppl.Columns.Add("EMPLOYEE_ID"); dtppl.Columns.Add("NAME"); dtppl.Columns.Add("POSITION"); dtppl.Columns.Add("COMPANY"); dtppl.Columns.Add("UNITCODE"); dtppl.Columns.Add("MOBILE"); dtppl.Columns.Add("LASTUPDATE", typeof(DateTime)); dtppl.Columns.Add("UPDATE_BY"); dtppl.Columns.Add("Keyword"); dtppl.Columns.Add("GROUP_KEY"); dtppl.Columns.Add("MOBILE_FM"); dtppl.Columns.Add("STATUS"); if (dt != null && dt_pis != null && dt.Rows.Count > 0 && dt_pis.Rows.Count > 0) { var results = from table1 in dt.AsEnumerable() join table2 in dt_pis.AsEnumerable() on table1["EMPLOYEE_ID"].ToString() equals table2["P_ID"].ToString() select new { EMPLOYEE_ID = table1["EMPLOYEE_ID"].ToString(), FULLNAMETH = table2["FULLNAMETH"].ToString(), POSNAME = table2["POSNAME"].ToString(), unitname = table2["unitname"].ToString(), unitcode = table2["UNITCODE"].ToString(), lastupdate = table1["LASTUPDATE"], updateby = table1["UPDATE_BY"].ToString(), keyword = table1["EMPLOYEE_ID"].ToString() + " " + table2["FULLNAMETH"].ToString() + " " + table2["POSNAME"].ToString() + " " + table2["unitname"].ToString(), mobile = !string.IsNullOrEmpty(table2["mobile"].ToString()) ? table2["mobile"].ToString() : table1["mobile"].ToString(), MOBILE_FM = string.IsNullOrEmpty(table2["mobile"].ToString()) ?1:0, STATUS = table1["STATUS"].ToString(), }; foreach (var item in results) { dtppl.Rows.Add(item.EMPLOYEE_ID, item.FULLNAMETH, item.POSNAME, item.unitname, item.unitcode, item.mobile, item.lastupdate, item.updateby, item.keyword, 200, item.MOBILE_FM, item.STATUS); } } // dtppl = findPTTPerson(dtppl, group_id); ViewState["CurrentPTTEditPPL"] = dtppl; ViewState["ALLPPL"] = dtppl; if (dtppl.Rows.Count > 0) { Grid_ppl.DataSource = dtppl; Grid_ppl.DataBind(); PPL_PANEL.Visible = true; } else { Grid_ppl.DataSource = null; Grid_ppl.DataBind(); PPL_PANEL.Visible = false; } }
protected void Grid_ppl_PageIndexChanging(object sender, GridViewPageEventArgs e) { Grid_ppl.PageIndex = e.NewPageIndex; Grid_ppl.DataBind(); ViewState["CurrentPTTEditPPL"] = Grid_ppl.DataSource as DataTable; }