protected void btnSave_Click(object sender, EventArgs e)
        {
            ChartOfAccountGroup coaGroup=new ChartOfAccountGroup();
            List<ChartOfAccountGroup> coaList = coaGroup.GetAllChartOfAccountGroup(_company.CompanyId);
            int id = 0;
            if (coaList.Count > 0)
            {
                id = coaList.Count;
            }

            coaGroup.CoaGroupId = id+1;
            coaGroup.CoaGroupName = txtGroupName.Value;
            coaGroup.ParentId = coaGroup.CoaGroupId;
            coaGroup.IsActive = true;
            coaGroup.UpdateBy = _user.UserId;
            coaGroup.UpdateDate=DateTime.Now;
            coaGroup.CompanyId = _user.CompanyId;

            int sucess = coaGroup.InsertChartOfAccountGroup();

            if (sucess > 0)
            {
                Alert.Show("Accounts group Insert sucessfully");
                this.Clear();
                this.LoadAccountGroupTable();
            }
        }
        protected void btnSave_Click(object sender, EventArgs e)
        {
            ChartOfAccountGroup coaGroup=new ChartOfAccountGroup();
            List<ChartOfAccountGroup> coaList = coaGroup.GetAllChartOfAccountGroup(_company.CompanyId);
            int id = 0;
            if (coaList.Count > 0)
            {
                id = coaList.Count;
            }

            coaGroup.CoaGroupId = id;
            coaGroup.CoaGroupName = txtGroupName.Value;
            coaGroup.ParentId = coaGroup.CoaGroupId;
            coaGroup.IsActive = true;
            coaGroup.UpdateBy = _user.UserId;
            coaGroup.UpdateDate=DateTime.Now;
            coaGroup.CompanyId = _user.CompanyId;

            int sucess = 0;
            if (lblId.Text == "" || lblId.Text == "0")
            {
                coaGroup.CoaGroupId = new ChartOfAccountGroup().GetMaxCoaGroupId() + 1;

                sucess = coaGroup.InsertChartOfAccountGroup();

                if (sucess > 0)
                {
                    Alert.Show("Chart Of Account Group saved successfully");
                    this.Clear();
                }
            }
            else
            {
                coaGroup.CoaGroupId = int.Parse(lblId.Text);
                sucess = coaGroup.UpdateChartOfAccountGroup();

                if (sucess > 0)
                {
                    Response.Redirect("ChartOfAccountList.aspx", true);
                }
            }
        }
 private void LoadAccountGroup()
 {
     ChartOfAccountGroup group=new ChartOfAccountGroup();
     List<string> nameList =new List<string>();
     accountGroups = group.GetAllChartOfAccountGroup(_company.CompanyId);
     foreach (ChartOfAccountGroup acc in accountGroups)
     {
         nameList.Add(acc.CoaGroupName);
     }
     chartOfAccountGroupIdDropDownList.DataSource = nameList;
     chartOfAccountGroupIdDropDownList.DataBind();
 }
        private void LoadAccountGroupTable()
        {
            try
            {
                coaTableBody.InnerHtml = "";
                string htmlContent = "";
                ChartOfAccountGroup accountGroup = new ChartOfAccountGroup();
                List<ChartOfAccountGroup> allAccountGroups = accountGroup.GetAllChartOfAccountGroup(_company.CompanyId);
                foreach (ChartOfAccountGroup coa in allAccountGroups)
                {
                    htmlContent += "<tr>";
                    htmlContent += String.Format(@"<th>{0}</th><th>{1}</th><th>{2}</th><th>{3}</th><th>{4}</th><th>{5}</th>", coa.CoaGroupName, coa.ParentId, coa.IsActive,  coa.UpdateBy, coa.UpdateDate,coa.CompanyId);
                    htmlContent += "</tr>";
                }

                coaTableBody.InnerHtml += htmlContent;
            }
            catch (Exception exc)
            {
                Alert.Show(exc.Message);
            }
        }
        private void LoadAccountGroupTable()
        {
            try
            {
                ChartOfAccountGroup coaGroup=new ChartOfAccountGroup();
                List<ChartOfAccountGroup>coaList=new List<ChartOfAccountGroup>();

                coaList = coaGroup.GetAllChartOfAccountGroup(_company.CompanyId);
                if (coaList.Count == 0)
                    coaList.Add(new ChartOfAccountGroup());

                RadGrid1.DataSource = coaList;
                RadGrid1.Rebind();
            }
            catch (Exception ex)
            {
                Alert.Show(ex.Message);
            }
        }