protected void btnSave_Click(object sender, EventArgs e) { ChartOfAccount objChartOfAccount=new ChartOfAccount(); List<ChartOfAccount> myAccounts = objChartOfAccount.GetAllChartOfAccount(_company.CompanyId); objChartOfAccount.CoaId = myAccounts.Count; objChartOfAccount.CoaType = chartOfAccountTypeDropDownList.SelectedItem.ToString(); objChartOfAccount.CoaGroupId = chartOfAccountGroupIdDropDownList.SelectedIndex; objChartOfAccount.CoaCode = txtChartOfAccountCode.Value; objChartOfAccount.CoaTitle = txtChartOfAccountTitle.Value; objChartOfAccount.ParentId = objChartOfAccount.CoaId; objChartOfAccount.IsActive = chkIsActive.Checked; objChartOfAccount.UpdateBy = _user.UserId; objChartOfAccount.UpdateDate = DateTime.Now; objChartOfAccount.CompanyId = _company.CompanyId; int success = 0; success = objChartOfAccount.InsertChartOfAccount(); if (success > 0) { Alert.Show("Inserted sucessfully"); this.LoadChartTable(); this.Clear(); } }
protected void RadGrid1_OnItemCommand(object sender, GridCommandEventArgs e) { try { GridDataItem item = (GridDataItem)e.Item; string id = item["colId"].Text; switch (e.CommandName) { case "btnSelect": Response.Redirect("ChartOfAccounting.aspx?id=" + id, true); break; case "btnDelete": //int delete = new Bank().DeleteBankByBankId(int.Parse(id)); int delete = new ChartOfAccount().DeleteChartOfAccountByCoaId(int.Parse(id)); if (delete == 0) { Alert.Show("Data was not delete.."); } else LoadChartOfAccountTable(); break; } } catch (Exception ex) { Alert.Show(ex.Message); } }
protected void btnSave_Click(object sender, EventArgs e) { ChartOfAccount objChartOfAccount=new ChartOfAccount(); List<ChartOfAccount> myAccounts = objChartOfAccount.GetAllChartOfAccount(_company.CompanyId); objChartOfAccount.CoaId = myAccounts.Count; objChartOfAccount.CoaType = chartOfAccountTypeDropDownList.SelectedItem.Text; objChartOfAccount.CoaGroupId = chartOfAccountGroupIdDropDownList.SelectedIndex; objChartOfAccount.CoaCode = txtChartOfAccountCode.Value; objChartOfAccount.CoaTitle = txtChartOfAccountTitle.Value; objChartOfAccount.ParentId = objChartOfAccount.CoaId; objChartOfAccount.IsActive = chkIsActive.Checked; objChartOfAccount.UpdateBy = _user.UserId; objChartOfAccount.UpdateDate = DateTime.Now; objChartOfAccount.CompanyId = _company.CompanyId; int sucess = 0; if (lblId.Text == "" || lblId.Text == "0") { objChartOfAccount.CoaId = new ChartOfAccount().GetMaxCoaId() + 1; sucess = objChartOfAccount.InsertChartOfAccount(); if (sucess > 0) { Alert.Show("Chart Of Account saved successfully"); this.Clear(); } } else { objChartOfAccount.CoaId = int.Parse(lblId.Text); sucess = objChartOfAccount.UpdateChartOfAccount(); if (sucess > 0) { Response.Redirect("ChartOfAccountingInfoList.aspx", true); } } }
void LoadChartTable() { try { chartTableBody.InnerHtml = ""; string htmlContent = ""; ChartOfAccount coa = new ChartOfAccount(); List<ChartOfAccount>listGroup=new List<ChartOfAccount>(); listGroup = coa.GetAllChartOfAccount(_company.CompanyId); foreach (ChartOfAccount acc in listGroup) { htmlContent += "<tr>"; htmlContent += String.Format(@"<th>{0}</th><th>{1}</th><th>{2}</th><th>{3}</th><th>{4}</th><th>{5}</th><th>{6}</th>", acc.CoaType,acc.CoaGroupId,acc.CoaCode,acc.CoaTitle,acc.IsActive,acc.UpdateBy,acc.UpdateDate); htmlContent += "</tr>"; } chartTableBody.InnerHtml += htmlContent; } catch (Exception exc) { Alert.Show(exc.Message); } }
protected void Page_Load(object sender, EventArgs e) { _company = (Company)Session["Company"]; _user = (Users)Session["user"]; if (!isValidSession()) { string str = Request.QueryString.ToString(); if (str == string.Empty) Response.Redirect("LogIn.aspx?refPage=default.aspx"); else Response.Redirect("LogIn.aspx?refPage=default.aspx?" + str); } if (!IsPostBack) { if (Request.QueryString["id"] != null) { string CoaGroupId = Request.QueryString["id"].ToString(); ChartOfAccount coa = new ChartOfAccount().GetChartOfAccountByCoaId(int.Parse(CoaGroupId), _company.CompanyId); if (coa != null || coa.CoaGroupId != 0) { lblId.Text = coa.CoaId.ToString(); this.LoadAllCompany(); this.LoadAccountGroup(); this.LoadType(); txtChartOfAccountCode.Value = coa.CoaCode; txtChartOfAccountTitle.Value = coa.CoaTitle; } } } this.LoadAllCompany(); this.LoadAccountGroup(); this.LoadType(); }
private void LoadChartOfAccountTable() { try { ChartOfAccount coa = new ChartOfAccount(); List<ChartOfAccount> coaList = new List<ChartOfAccount>(); coaList = coa.GetAllChartOfAccount(_company.CompanyId); if (coaList.Count == 0) coaList.Add(new ChartOfAccount()); RadGrid1.DataSource = coaList; RadGrid1.Rebind(); } catch (Exception ex) { Alert.Show(ex.Message); } }