protected void TreeView1_SelectedNodeChanged(object sender, EventArgs e) { SegCoa segcoa = SegCoaManager.getSegCoa(TreeView1.SelectedNode.Value.ToString()); if (segcoa != null) { txtSegCode.Text = segcoa.GlSegCode; txtSegDesc.Text = segcoa.SegCoaDesc; ddlAccType.SelectedValue = segcoa.AccType; ddlBudAllowed.SelectedValue = segcoa.BudAllowed; txtLvlCode.Text = segcoa.LvlCode; txtOpenDate.Text = segcoa.OpenDate; txtParentCode.Text = segcoa.ParentCode; ddlPostAllowed.SelectedValue = segcoa.PostAllowed; ddlRootLeaf.SelectedValue = segcoa.RootLeaf; ddlTaxable.SelectedValue = segcoa.Taxable; ddlStatus.SelectedValue = segcoa.Status; foreach (GridViewRow gvr in dgGlCoaGen.Rows) { string lvl = ""; string connectionString = DataManager.OraConnString(); OracleDataReader dReader; OracleConnection conn = new OracleConnection(); conn.ConnectionString = connectionString; OracleCommand cmd = new OracleCommand(); cmd = new OracleCommand(); cmd.Connection = conn; cmd.CommandType = CommandType.Text; cmd.CommandText = "select lvl_code from gl_level_type where lvl_desc='" + gvr.Cells[0].Text.ToString().Trim() + "'"; conn.Open(); dReader = cmd.ExecuteReader(); if (dReader.HasRows == true) { while (dReader.Read()) { lvl = dReader["lvl_code"].ToString(); } } if (lvl == segcoa.LvlCode) { gvr.Cells[1].Text = segcoa.GlSegCode; gvr.Cells[2].Text = segcoa.SegCoaDesc; } } lblTransStatus.Text = ""; } }
protected void btnSave_Click(object sender, EventArgs e) { System.Threading.Thread.Sleep(3000); if (txtSegCode.Text != "") { SegCoa sgcoa = SegCoaManager.getSegCoa(txtSegCode.Text); if (sgcoa != null) { sgcoa.SegCoaDesc = txtSegDesc.Text; sgcoa.RootLeaf = ddlRootLeaf.SelectedValue; sgcoa.Taxable = ddlTaxable.SelectedValue; sgcoa.Status = ddlStatus.SelectedValue; sgcoa.PostAllowed = ddlPostAllowed.SelectedValue; sgcoa.ParentCode = txtParentCode.Text; sgcoa.OpenDate = txtOpenDate.Text; sgcoa.LvlCode = txtLvlCode.Text; sgcoa.BudAllowed = ddlBudAllowed.SelectedValue; sgcoa.AccType = ddlAccType.SelectedValue; SegCoaManager.UpdateSegCoa(sgcoa); } else { sgcoa = new SegCoa(); sgcoa.GlSegCode = txtSegCode.Text; sgcoa.BookName = Session["book"].ToString(); sgcoa.SegCoaDesc = txtSegDesc.Text; sgcoa.RootLeaf = ddlRootLeaf.SelectedValue; sgcoa.Taxable = ddlTaxable.SelectedValue; sgcoa.Status = ddlStatus.SelectedValue; sgcoa.PostAllowed = ddlPostAllowed.SelectedValue; sgcoa.ParentCode = txtParentCode.Text; sgcoa.OpenDate = txtOpenDate.Text; sgcoa.LvlCode = txtLvlCode.Text; sgcoa.BudAllowed = ddlBudAllowed.SelectedValue; sgcoa.AccType = ddlAccType.SelectedValue; SegCoaManager.CreateSegCoa(sgcoa); } TreeView1.Nodes.Clear(); Populate(); TreeNode node = TreeView1.FindNode(Server.HtmlEncode(txtParentCode.Text)); if (node != null) { node.Expand(); } ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "ale", "alert('***Segment Codes Saved in Database Successfully!!');", true); //ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "ale", "alert('***Segment Codes Saved in Database Successfully!!');", true); } }
protected void btnDelete_Click(object sender, EventArgs e) { System.Threading.Thread.Sleep(3000); if (txtSegCode.Text != "") { int coaF = SegCoaManager.getChild(txtSegCode.Text.ToString()); if (coaF < 1) { SegCoa sgcoa = SegCoaManager.getSegCoa(txtSegCode.Text.ToString()); if (sgcoa != null) { SegCoaManager.DeleteSegCoa(sgcoa); TreeView1.Nodes.Clear(); Populate(); ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "ale", "alert('***Segment Codes deleted from Database Successfully!!');", true); btnClear_Click(sender, e); } } else { ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "ale", "alert('*** You cannnot delete this segment code while child segment is exist!!');", true); } } }