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); } } }