protected void tv_SelectedNodeChanged(object sender, EventArgs e) { string childcode = ""; txt_roottopic.Text = After(tv.SelectedNode.Text, "-").TrimStart(); txt_roottopic.Enabled = false; txtParticular.Text = ""; int id = Convert.ToInt32(hfValue.Value); if (id == 1 || id == 2) { txtRootCode.Text = BlLa.GetLA_CODE(5, 0, tv.SelectedNode.Value); childcode = BlLa.GetLA_CODE(6, 0, tv.SelectedNode.Value); } else if (id == 3 || id == 4) { txtRootCode.Text = BlIncomeExp.GetIE_CODE(5, 0, tv.SelectedNode.Value); childcode = BlIncomeExp.GetIE_CODE(6, 0, tv.SelectedNode.Value); } if (tv.SelectedNode.Value == "2") { txtParticularcode.Text = childcode; } else if (string.IsNullOrEmpty(childcode)) { txtParticularcode.Text = txtRootCode.Text + "." + "1"; } else { txtParticularcode.Text = txtRootCode.Text + "." + childcode; } bindPearls(); }
private void BuildTree(int id) { tv.Nodes.Clear(); if (id == 1 || id == 2) { NodeItems = BlLa.GetLa(3, 0, id.ToString()); } else { NodeItems = BlIncomeExp.GetIncomeExp(4, 0, id.ToString()); } if (NodeItems.Rows.Count > 0) { // add top level nodes DataView vw = NodeItems.DefaultView; vw.RowStateFilter = DataViewRowState.CurrentRows; vw.RowFilter = "ParentID=0"; // top level items // using the new (.net 2.0)in Memory Table Reader DataTable tb = vw.ToTable(); DataTableReader rdr = tb.CreateDataReader(); // Calls BuildChildNodes for each top level node - it's recursive for nested branches while (rdr.Read()) { TreeNode node = new TreeNode(); node.Text = rdr["Org_Category_Name"].ToString(); node.Value = rdr["ID"].ToString(); // could use ordinal for more speed, using column name for clarity this.tv.Nodes.Add(node); // get children recursively Int32 parentID = Convert.ToInt32(rdr[0]); // first column is item ID this.BuildChildNodes(parentID, ref node); } rdr.Close(); } // add to cache System.Collections.Generic.List <TreeNode> nds = new System.Collections.Generic.List <TreeNode>(); foreach (TreeNode nd in this.tv.Nodes) { nds.Add(nd); } }
private void GetDetails(int id) { txt_roottopic.Enabled = true; if (id == 1 || id == 2) { DataTable dt = BlLa.GetLa(10, 0, tv.SelectedNode.Value); if (dt.Rows.Count > 0) { txt_roottopic.Text = dt.Rows[0]["Parent"].ToString(); txtRootCode.Text = dt.Rows[0]["ParentCode"].ToString(); txtParticular.Text = dt.Rows[0]["LA"].ToString(); txtParticularcode.Text = dt.Rows[0]["LA_Code"].ToString(); if (dt.Rows[0]["LA_Child"] != null) { //ddlUnder.SelectedValue = dt.Rows[0]["LA_Child"].ToString(); } chkPrimary.Checked = Convert.ToBoolean(dt.Rows[0]["LA_Primary"].ToString()); chkIsNeeded.Checked = Convert.ToBoolean(dt.Rows[0]["IsNeeded"].ToString()); btnSubmit.CommandName = "Update"; btnSubmit.Text = "Update"; } } else if (id == 3 || id == 4) { DataTable dt = BlIncomeExp.GetIncomeExp(17, 0, tv.SelectedNode.Value); if (dt.Rows.Count > 0) { txt_roottopic.Text = dt.Rows[0]["Parent"].ToString(); txtRootCode.Text = dt.Rows[0]["ParentCode"].ToString(); txtParticular.Text = dt.Rows[0]["IE"].ToString(); txtParticularcode.Text = dt.Rows[0]["IE_Code"].ToString(); if (dt.Rows[0]["IE_Child"] != null) { //ddlUnder.SelectedValue = dt.Rows[0]["IE_Child"].ToString(); } chkPrimary.Checked = Convert.ToBoolean(dt.Rows[0]["IE_Primary"].ToString()); chkIsNeeded.Checked = Convert.ToBoolean(dt.Rows[0]["IsNeeded"].ToString()); btnSubmit.CommandName = "Update"; btnSubmit.Text = "Update"; } } else { } }
private void InsUpdDelIncomeExp(char Event, int Id) { try { BlIncomeExp objbl = new BlIncomeExp(); PL_IncomeExp obj = new PL_IncomeExp(); obj.IE_ID = Id; obj.EVENT = Event; if (Event == 'D') { } else { obj.IE_Code = txtParticularcode.Text; obj.IE = txtParticular.Text; obj.IE_ParentID = int.Parse(tv.SelectedNode.Value); obj.IE_Primary = chkPrimary.Checked; //obj.Ie_Child = ddlUnder.SelectedValue; obj.IsNeeded = chkIsNeeded.Checked; } string msg = objbl.InsUpdDelIncomeExp(obj, out Id); if (msg == "Record Inserted Successfully" || msg == "Record Updated Successfully" || msg == "Record Deleted Successfully") { msgbox.ShowSuccess(msg); BuildTree(Convert.ToInt32(hfValue.Value)); Clear(); } else { msgbox.ShowWarning(msg); } } catch (Exception ex) { msgbox.ShowWarning(ex.Message); } }