public static CustomList <AccReportConfigurationHeadCOAMap> GetAllAccReportConfigurationHeadCOAMap(Int32 headID)
        {
            ConnectionManager conManager = new ConnectionManager(ConnectionName.HR);
            CustomList <AccReportConfigurationHeadCOAMap> AccReportConfigurationHeadCOAMapCollection = new CustomList <AccReportConfigurationHeadCOAMap>();
            IDataReader reader = null;
            String      sql    = "select HeadCOAMapID,HeadID,'' COAName,COAID,IsActive from AccReportConfigurationHeadCOAMap Where HeadID='" + headID + "'";

            try
            {
                conManager.OpenDataReader(sql, out reader);
                while (reader.Read())
                {
                    AccReportConfigurationHeadCOAMap newAccReportConfigurationHeadCOAMap = new AccReportConfigurationHeadCOAMap();
                    newAccReportConfigurationHeadCOAMap.SetData(reader);
                    AccReportConfigurationHeadCOAMapCollection.Add(newAccReportConfigurationHeadCOAMap);
                }
                return(AccReportConfigurationHeadCOAMapCollection);
            }
            catch (Exception ex)
            {
                throw (ex);
            }
            finally
            {
                if (reader != null && !reader.IsClosed)
                {
                    reader.Close();
                }
            }
        }
 public static CustomList<AccReportConfigurationHeadCOAMap> GetAllAccReportConfigurationHeadCOAMap(Int32 headID)
 {
     ConnectionManager conManager = new ConnectionManager(ConnectionName.HR);
     CustomList<AccReportConfigurationHeadCOAMap> AccReportConfigurationHeadCOAMapCollection = new CustomList<AccReportConfigurationHeadCOAMap>();
     IDataReader reader = null;
     String sql = "select HeadCOAMapID,HeadID,'' COAName,COAID,IsActive from AccReportConfigurationHeadCOAMap Where HeadID='" + headID + "'";
     try
     {
         conManager.OpenDataReader(sql, out reader);
         while (reader.Read())
         {
             AccReportConfigurationHeadCOAMap newAccReportConfigurationHeadCOAMap = new AccReportConfigurationHeadCOAMap();
             newAccReportConfigurationHeadCOAMap.SetData(reader);
             AccReportConfigurationHeadCOAMapCollection.Add(newAccReportConfigurationHeadCOAMap);
         }
         return AccReportConfigurationHeadCOAMapCollection;
     }
     catch(Exception ex)
     {
         throw (ex);
     }
     finally
     {
         if (reader != null && !reader.IsClosed)
             reader.Close();
     }
 }
        protected void btnAdd_Click(object sender, EventArgs e)
        {
            List<TreeNode> AllCheckedNodes = new List<TreeNode>();
            CustomList<AccReportConfigurationHeadCOAMap> lstCoaFgrid = new CustomList<AccReportConfigurationHeadCOAMap>();
            CustomList<Acc_COA> lstSessionAcc_COA = new CustomList<Acc_COA>();
            lstSessionAcc_COA = (CustomList<Acc_COA>)Session["COA_COA"];

            string allChkName = "";
            for (int i = 0; i < tv.CheckedNodes.Count; i++)
            {
                AccReportConfigurationHeadCOAMap objCOA = new AccReportConfigurationHeadCOAMap();
                objCOA.COAName = tv.CheckedNodes[i].Text;
                objCOA.COAID = Convert.ToInt32(tv.CheckedNodes[i].Value);
                objCOA.HeadCOAMapID = 0;
                //objCOA.HeadID = 0;
                foreach (Acc_COA acccoa in lstSessionAcc_COA)
                {
                    if (objCOA.COAID == Convert.ToInt32(acccoa.COAKey) && acccoa.IsPostingHead == true)
                    {
                        objCOA.IsActive = true;
                        lstCoaFgrid.Add(objCOA);
                    }
                }
                // lstCoaFgrid.Add(objCOA);
                // allChkName=allChkName+"_"+tv.CheckedNodes[i].Text;
            }

            AccReportConfigurationHeadCOAMapList = lstCoaFgrid;

            ////List<TreeNode> AllCheckedNodes = new List<TreeNode>();
            ////CustomList<Acc_COA> lstCoaFgrid = new CustomList<Acc_COA>();
            ////CustomList<Acc_COA> lstSessionAcc_COA = new CustomList<Acc_COA>();
            ////lstSessionAcc_COA = (CustomList<Acc_COA>)Session["COA_COA"];

            ////string allChkName = "";
            ////for (int i = 0; i < tv.CheckedNodes.Count; i++)
            ////{
            ////    Acc_COA objCOA = new Acc_COA();
            ////    objCOA.COAName = tv.CheckedNodes[i].Text;
            ////    // objCOA.IsActive = false;
            ////    foreach (Acc_COA acccoa in lstSessionAcc_COA)
            ////    {
            ////        if (objCOA.COAName == acccoa.COAName && acccoa.IsPostingHead == true)
            ////        {
            ////            objCOA.IsActive = true;
            ////            lstCoaFgrid.Add(objCOA);
            ////        }
            ////    }
            ////    // lstCoaFgrid.Add(objCOA);
            ////    // allChkName=allChkName+"_"+tv.CheckedNodes[i].Text;
            ////}

            ////Session["GRID_COA"] = lstCoaFgrid;
        }