protected void btnSave_Click(object sender, EventArgs e) { if (txtBookName.Text != String.Empty) { GlBook book = GlBookManager.getBook(txtBookName.Text); if (book != null) { //if (per.AllowEdit == "Y") //{ book.BookDesc = txtBookDesc.Text; book.BookStatus = ddlBookStatus.SelectedValue; book.SeparatorType = txtSeparatorType.Text; book.CompanyAddress1 = txtCompanyAddress1.Text; book.CompanyAddress2 = txtCompanyAddress2.Text; book.RetdEarnAcc = txtRetdEarnAcc.Text; book.Phone = txtPhone.Text; book.Fax = txtFax.Text; book.Url = txtUrl.Text; book.BankCode = txtBankCode.Text; book.CashCode = txtCashCode.Text; book.logo = ImageLogo; GlBookManager.UpdateGlBook(book); ClientScript.RegisterStartupScript(this.GetType(), "ale", "alert('Record updated successfully!!');", true); //} //else //{ // ClientScript.RegisterStartupScript(this.GetType(), "ale", "alert('You have no permission to edit/update these data!!');", true); //} } else { if (per.AllowAdd == "Y") { book = new GlBook(); book.BookName = txtBookName.Text; book.BookDesc = txtBookDesc.Text; book.BookStatus = ddlBookStatus.SelectedValue; book.SeparatorType = txtSeparatorType.Text; book.CompanyAddress1 = txtCompanyAddress1.Text; book.CompanyAddress2 = txtCompanyAddress2.Text; book.RetdEarnAcc = txtRetdEarnAcc.Text; book.Phone = txtPhone.Text; book.Fax = txtFax.Text; book.Url = txtUrl.Text; book.BankCode = txtBankCode.Text; book.CashCode = txtCashCode.Text; book.logo = ImageLogo; GlBookManager.CreateGlBook(book); ClientScript.RegisterStartupScript(this.GetType(), "ale", "alert('Record created successfully!!');", true); } else { ClientScript.RegisterStartupScript(this.GetType(), "ale", "alert('You have no permission to add data in this form!!');", true); } } } }
protected void btnDelete_Click(object sender, EventArgs e) { if (per.AllowDelete == "Y") { if (txtBookName.Text != String.Empty) { GlBook book = GlBookManager.getBook(txtBookName.Text); if (book != null) { GlBookManager.DeleteGlBook(book); ClientScript.RegisterStartupScript(this.GetType(), "ale", "alert('Record deleted successfully!!');", true); } } } else { ClientScript.RegisterStartupScript(this.GetType(), "ale", "alert('You have no permission to delete these data!!');", true); } }
protected void dgGlBook_SelectedIndexChanged(object sender, EventArgs e) { clearFields(); GlBook book = GlBookManager.getBook(dgGlBook.SelectedRow.Cells[1].Text.ToString().Trim()); if (book != null) { txtBookName.Text = book.BookName; txtBookDesc.Text = book.BookDesc; ddlBookStatus.SelectedValue = book.BookStatus; txtSeparatorType.Text = book.SeparatorType; txtCompanyAddress1.Text = book.CompanyAddress1; txtCompanyAddress2.Text = book.CompanyAddress2; txtRetdEarnAcc.Text = book.RetdEarnAcc; txtPhone.Text = book.Phone; txtFax.Text = book.Fax; txtUrl.Text = book.Url; txtBankCode.Text = book.BankCode; txtCashCode.Text = book.CashCode; imgLogo.ImageUrl = "~/imgHandler.ashx?img='" + book.BookName + "'"; ImageLogo = (byte[])book.logo; } }