/// <summary> /// /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void gvCashBook_RowDeleting(object sender, GridViewDeleteEventArgs e) { ObjCashBook = new clsCashBookEntry(); DataTable dtCashBook = new DataTable(); int iVoucherNumber; try { iVoucherNumber = Convert.ToInt32(((Label)gvCashBook.Rows[e.RowIndex].FindControl("lblVoucherNumber")).Text); if (iVoucherNumber > 0) { ObjCashBook.VoucherNumber = iVoucherNumber; dtCashBook = ObjCashBook.GetCashBookDetailsByVoucherNumber(); if (dtCashBook.Rows.Count > 0) { ObjCashBook.ExpenditureId = !string.IsNullOrEmpty(dtCashBook.Rows[0]["ExpenditureId"].ToString()) ? Convert.ToInt32(dtCashBook.Rows[0]["ExpenditureId"].ToString()) : 0; ObjCashBook.ExpenditureDate = !string.IsNullOrEmpty(dtCashBook.Rows[0]["ExpenditureDate"].ToString()) ? dtCashBook.Rows[0]["ExpenditureDate"].ToString() : string.Empty; ObjCashBook.ExpenditureAmount = !string.IsNullOrEmpty(dtCashBook.Rows[0]["ExpenditureAmount"].ToString()) ? Convert.ToDecimal(dtCashBook.Rows[0]["ExpenditureAmount"].ToString()) : 0; ObjCashBook.ExpanditureDescription = !string.IsNullOrEmpty(dtCashBook.Rows[0]["ExpanditureDescription"].ToString()) ? dtCashBook.Rows[0]["ExpanditureDescription"].ToString() : string.Empty; ObjCashBook.ExpenditureTypeId = !string.IsNullOrEmpty(dtCashBook.Rows[0]["ExpenditureTypeId"].ToString()) ? Convert.ToInt32(dtCashBook.Rows[0]["ExpenditureTypeId"].ToString()) : 0; ObjCashBook.IsPaidByCash = (dtCashBook.Rows[0]["IsPaidByCash"].ToString().Equals("True")) ? true : false; ObjCashBook.IsPaidByCheque = (dtCashBook.Rows[0]["IsPaidByCheque"].ToString().Equals("True")) ? true : false; ObjCashBook.ChequeNumber = !string.IsNullOrEmpty(dtCashBook.Rows[0]["ChequeNumber"].ToString()) ? Convert.ToInt32(dtCashBook.Rows[0]["ChequeNumber"].ToString()) : 0; ObjCashBook.BankName = !string.IsNullOrEmpty(dtCashBook.Rows[0]["BankName"].ToString()) ? dtCashBook.Rows[0]["BankName"].ToString() : string.Empty; ObjCashBook.ApprovedBy = !string.IsNullOrEmpty(dtCashBook.Rows[0]["ApprovedBy"].ToString()) ? dtCashBook.Rows[0]["ApprovedBy"].ToString() : string.Empty; ObjCashBook.CreatedBy = Convert.ToInt32(AppSessions.GetSession(AppSessions.UDFSessionName._user_id.ToString())); ObjCashBook.CreatedDate = Convert.ToDateTime(txtDate.Text); ObjCashBook.UpdatedBy = Convert.ToInt32(AppSessions.GetSession(AppSessions.UDFSessionName._user_id.ToString())); ObjCashBook.UpdatedDate = Convert.ToDateTime(txtDate.Text); ObjCashBook.IsActive = false; } if (ObjCashBook.Update()) { lblCashbookMessage.CssClass = "SuccessfulMessage"; lblCashbookMessage.Text = (String)GetGlobalResourceObject("SharedResource", "RecordSavedSuccessfully"); } } else { lblCashbookMessage.CssClass = "FailureMessage"; lblCashbookMessage.Text = (String)GetGlobalResourceObject("SharedResource", "LoginSessionExpire"); } ClearCashbookEnriesControls(); BindCashBookGrid(); ShowHideCashBookGrid(true); } catch { lblCashbookMessage.CssClass = "FailureMessage"; lblCashbookMessage.Text = (String)GetGlobalResourceObject("SharedResource", "RecordSavingFailure"); } finally { ObjCashBook = null; } }
/// <summary> /// Added By: pradip pawar /// Date :02-04-2013 /// Description:Update Expendure /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void btnUpdate_Click(object sender, EventArgs e) { ObjCashBook = new clsCashBookEntry(); try { if (!string.IsNullOrEmpty(AppSessions.GetSession(AppSessions.UDFSessionName._user_id.ToString()))) { ObjCashBook.ExpenditureId = !string.IsNullOrEmpty(txtVoucherNo.Text) ? Convert.ToInt32(txtVoucherNo.Text.ToString()) : 0; ObjCashBook.ExpenditureDate = !string.IsNullOrEmpty(txtDate.Text) ? txtDate.Text.ToString() : string.Empty; ObjCashBook.ExpenditureAmount = !string.IsNullOrEmpty(txtAmount.Text) ? Convert.ToDecimal(txtAmount.Text.ToString()) : 0; ObjCashBook.ExpanditureDescription = !string.IsNullOrEmpty(txtDescription.Text) ? txtDescription.Text.ToString() : string.Empty; ObjCashBook.ExpenditureTypeId = !string.IsNullOrEmpty(ddlExpanditureType.SelectedValue) ? Convert.ToInt32(ddlExpanditureType.SelectedValue.ToString()) : 0; ObjCashBook.IsPaidByCash = (chkCash.Checked) ? true : false; ObjCashBook.IsPaidByCheque = (chkCheque.Checked) ? true : false; ObjCashBook.ChequeNumber = !string.IsNullOrEmpty(txtChequeno.Text) ? Convert.ToInt32(txtChequeno.Text.ToString()) : 0; ObjCashBook.BankName = !string.IsNullOrEmpty(txtBank.Text) ? txtBank.Text.ToString() : string.Empty; ObjCashBook.ApprovedBy = !string.IsNullOrEmpty(txtAuthorizedby.Text) ? txtAuthorizedby.Text.ToString() : string.Empty; ObjCashBook.CreatedBy = Convert.ToInt32(AppSessions.GetSession(AppSessions.UDFSessionName._user_id.ToString())); ObjCashBook.CreatedDate = Convert.ToDateTime(txtDate.Text); ObjCashBook.UpdatedBy = Convert.ToInt32(AppSessions.GetSession(AppSessions.UDFSessionName._user_id.ToString())); ObjCashBook.UpdatedDate = Convert.ToDateTime(txtDate.Text); ObjCashBook.IsActive = true; if (ObjCashBook.Update()) { lblCashbookMessage.CssClass = "SuccessfulMessage"; lblCashbookMessage.Text = (String)GetGlobalResourceObject("SharedResource", "RecordSavedSuccessfully"); } } else { lblCashbookMessage.CssClass = "FailureMessage"; lblCashbookMessage.Text = (String)GetGlobalResourceObject("SharedResource", "LoginSessionExpire"); } ClearCashbookEnriesControls(); BindCashBookGrid(); EnableDisableCashBookEnriesControls(true); ShowHideCashBookGrid(true); } catch { lblCashbookMessage.CssClass = "FailureMessage"; lblCashbookMessage.Text = (String)GetGlobalResourceObject("SharedResource", "RecordSavingFailure"); } finally { ObjCashBook = null; } }