protected void btnEdit_Click(object sender, EventArgs e) { GLAccount glaccount = new GLAccount(); glaccount.ID = Convert.ToInt32(Request.QueryString["id"].ToString()); glaccount.Name = txtAcctName.Text; glaccount.Status = Convert.ToInt32(lstAcctStatus.SelectedValue.ToString()); glaccount.Balance = Convert.ToDecimal(txtBalance.Text); glaccount.Description = txtDesc.Text; glaccount.AcctCode = Convert.ToInt32(txtacctcode.Text); glaccount.AcctType = Convert.ToInt32(ddlAcctType.SelectedValue); glaccount.ParentAcctID = Convert.ToInt32(ddlParentGL.SelectedValue.ToString()); if (glaccount.AccountCodeExist(Convert.ToInt32(txtacctcode.Text))) { GLAccount glaccount2 = new GLAccount(); glaccount2.get(Convert.ToInt32(glaccount.ID)); if (glaccount2.AcctCode != glaccount.AcctCode) { Response.Redirect("~/Finance_Module/CreateNewGLAccount.aspx?id=" + glaccount.ID + "&&alert=AccountCodeExist"); } } int id = glaccount.update(); if (id > 0) { Response.Redirect("~/Finance_Module/GLAccounts.aspx?alert=success"); } else { Response.Redirect("~/Finance_Module/CreateNewGLAccount.aspx?id=0&&alret=notpass"); } }
protected void btnSave_Click(object sender, EventArgs e) { GLAccount glaccount = new GLAccount(); glaccount.Name = txtAcctName.Text; glaccount.Status = Convert.ToInt32(lstAcctStatus.SelectedValue.ToString()); glaccount.Balance = Convert.ToDecimal(txtBalance.Text); glaccount.Description = txtDesc.Text; glaccount.OperatorID = 1;////to do glaccount.AcctCode = Convert.ToInt32(txtacctcode.Text); glaccount.AcctType = Convert.ToInt32(ddlAcctType.SelectedValue); glaccount.ParentAcctID = Convert.ToInt32(ddlParentGL.SelectedValue); if (glaccount.AccountCodeExist(Convert.ToInt32(txtacctcode.Text))) { Response.Redirect("~/Finance_Module/CreateNewGLAccount.aspx?alert=AccountCodeExist"); } int id = glaccount.save(); if (id > 0) { Response.Redirect("~/Finance_Module/GLAccounts.aspx?alert=success"); } else { Response.Redirect("~/Finance_Module/CreateNewGLAccount.aspx?id=0&&alret=notpass"); } }