public int UpdateACLedger(tblAC_leg_LedgersTransaction_temp atblAC_leg_LedgersTransaction_temp, string trid) { try { tblAC_leg_LedgersTransaction_temp objtblAC_leg_LedgersTransaction_temp = _context.tblAC_leg_LedgersTransaction_temp.First(x => x.Transaction_Code == trid); objtblAC_leg_LedgersTransaction_temp.Ledger_Code = atblAC_leg_LedgersTransaction_temp.Ledger_Code; objtblAC_leg_LedgersTransaction_temp.Particulars = atblAC_leg_LedgersTransaction_temp.Particulars; objtblAC_leg_LedgersTransaction_temp.Nature = atblAC_leg_LedgersTransaction_temp.Nature; objtblAC_leg_LedgersTransaction_temp.Edit_Date = atblAC_leg_LedgersTransaction_temp.Edit_Date; objtblAC_leg_LedgersTransaction_temp.Edit_User = atblAC_leg_LedgersTransaction_temp.Edit_User; _context.SaveChanges(); return(1); } catch (Exception) { throw; } }
public int UpdateACLedger(tblAC_leg_LedgersTransaction_temp atblAC_leg_LedgersTransaction_temp, string trid) { return(objDal.UpdateACLedger(atblAC_leg_LedgersTransaction_temp, trid)); }
protected void grvVoucherDetails_RowUpdating(object sender, GridViewUpdateEventArgs e) { GridViewRow row = grvVoucherDetails.Rows[e.RowIndex]; Label lblTransactionCode = (Label)row.FindControl("lblTransactionCode"); string trCode = lblTransactionCode.Text; Label lblVoucherNo = (Label)row.FindControl("lblVoucherNo"); string VoucherNo = lblVoucherNo.Text; Label lblIsChangable = ((Label)row.FindControl("lblIsChangable")); bool changable = Convert.ToBoolean(lblIsChangable.Text); DropDownList cmbParticulars = (DropDownList)row.FindControl("cmbParticulars"); string ledgerName = cmbParticulars.SelectedItem.Text.ToString(); string ledgerCode = cmbParticulars.SelectedValue; if (ledgerName != null) { var objGetAc_LedgerNature = objCofg.GetAc_Ledger(OCode, CompanyCode).Where(x => x.Ledger_Code == ledgerCode).FirstOrDefault(); tblAC_leg_LedgersTransaction_temp objtblAC_leg_LedgersTransaction_temp = new tblAC_leg_LedgersTransaction_temp(); objtblAC_leg_LedgersTransaction_temp.Voucher_No = VoucherNo; objtblAC_leg_LedgersTransaction_temp.Ledger_Code = ledgerCode; objtblAC_leg_LedgersTransaction_temp.Particulars = ledgerName; objtblAC_leg_LedgersTransaction_temp.Nature = objGetAc_LedgerNature.Ledger_Nature; objtblAC_leg_LedgersTransaction_temp.Edit_User = Edit_User; objtblAC_leg_LedgersTransaction_temp.Edit_Date = DateTime.Now; if (changable == true) { int ledgercount = (from ledger in _context.tblAC_leg_LedgersTransaction_temp where ledger.Ledger_Code == objtblAC_leg_LedgersTransaction_temp.Ledger_Code && ledger.Voucher_No == objtblAC_leg_LedgersTransaction_temp.Voucher_No select ledger.Transaction_ID).Count(); if (ledgercount == 0) { int result = aVoucher_Bll.UpdateACLedger(objtblAC_leg_LedgersTransaction_temp, trCode); if (result == 1) { ScriptManager.RegisterStartupScript(this.Page, Page.GetType(), "text", "func('Ledger Name Updated Successfully')", true); grvVoucherDetails.EditIndex = -1; GetAllVoucher(approval); } else { ScriptManager.RegisterStartupScript(this.Page, Page.GetType(), "text", "func('Data Updating Error!')", true); } } else { ScriptManager.RegisterStartupScript(this.Page, Page.GetType(), "text", "func('Ledger Already Used For This Voucher!')", true); } } else { ScriptManager.RegisterStartupScript(this.Page, Page.GetType(), "text", "func('Access Denied!')", true); grvVoucherDetails.EditIndex = -1; this.GetAllVoucher(approval); } } }