protected void Grid_ppl_RowCommand(object sender, GridViewCommandEventArgs e) { int pindex = Grid_ppl.PageIndex * Grid_ppl.PageSize; if (e.CommandName == "DelPPL") { DataTable dtgroup = ViewState["CurrentGCGrp"] as DataTable; DataTable dtppl = ViewState["CurrentGCPPL"] as DataTable; int index = Convert.ToInt32(e.CommandArgument.ToString()) + pindex; string group_id = groupLabel.Text; int level = Convert.ToInt32(LevelLabel.Text); // string text = TreeView1.SelectedNode.Text; if (group_id == "-1") { return; } string depart = group_id.Substring(0, 3); OracleQuery2 cc2 = new OracleQuery2(); string d = dtppl.Rows[index]["GROUP_KEY"].ToString(); string person_id = dtppl.Rows[index]["EMPLOYEE_id"].ToString(); string company_id = dtppl.Rows[index]["COMPANY_id"].ToString(); cc2.DeleteGCPPL(group_id, d, person_id, company_id); //TreeView1.Nodes.Clear(); //bindTree(); BindPPLDetail(group_id, level); } if (e.CommandName == "EditPPL") { AddPPLPanel.Visible = true; grpPanel.Visible = true; DataTable dtppl = ViewState["CurrentGCPPL"] as DataTable; int index = Convert.ToInt32(e.CommandArgument.ToString()) + pindex; string EmployeeID = dtppl.Rows[index]["EMPLOYEE_ID"].ToString(); string Name = dtppl.Rows[index]["NAME"].ToString(); string posname = dtppl.Rows[index]["POSITION"].ToString(); string unitname = dtppl.Rows[index]["COMPANY"].ToString(); string MOBILE = dtppl.Rows[index]["MOBILE"].ToString(); string company_id = dtppl.Rows[index]["COMPANY_id"].ToString(); EmployeeIDLabel.Text = EmployeeID; NameLabel.Text = Name; posnameLabel.Text = posname; unitnameLabel.Text = unitname; TelLabel.Text = MOBILE; CompanyIDLabel.Text = company_id; } }
protected void UpdatePPL_Click(object sender, EventArgs e) { string EmployeeID = EmployeeIDLabel.Text; string Name = NameLabel.Text; string posname = posnameLabel.Text; // string unitname = unitnameLabel.Text; string company_id = unitnameList.SelectedValue; string MOBILE = TelLabel.Text; string group_in = GroupIDINLabel.Text; OracleQuery cc = new OracleQuery(); OracleQuery2 cc2 = new OracleQuery2(); var s = cl.Items.Cast <ListItem>() .Where(item => item.Selected) .Aggregate("", (current, item) => current + (item.Text + ", ")); string hh = s.TrimEnd(new[] { ',', ' ' }); if (hh == "") { NoResult.Visible = true; errorlabel.Text = "กรุณาเลือกกลุ่มอย่างน้อย 1 กลุ่ม"; return; } string longinName = Session["ID"].ToString(); int index = cl.Items.Count; for (int i = 0; i < index; i++) { string id = cl.Items[i].Value; if (group_in.Contains(id) && !cl.Items[i].Selected) { cc2.DeleteGCPPL(id, "300", EmployeeID, company_id); } else if (!group_in.Contains(id) && cl.Items[i].Selected) { cc2.InsertGCService(id, EmployeeID, company_id); } } cc2.updateGCPPL(EmployeeID, Name, company_id, MOBILE, posname, longinName); grpPanel.Visible = false; AddPPLPanel.Visible = false; BindPPLDetail(); }