private bool EfetuarExclusao(DataRow RegistroAExcluir) { bool bExcluiu = false; UsuarioWeb objUsuario = (UsuarioWeb)Session["ObjetoUsuario"]; string sCdClifor = RegistroAExcluir["CD_ALTER"].ToString(); CliforDAO objCliente = ClienteDAOWeb.GetInstanciaClienteDAOWeb(Session, objUsuario); try { DataTable dtPedidoExclusao = objCliente.Select("(CD_ALTER = '" + sCdClifor + "')"); objCliente.RegistroAtual = dtPedidoExclusao.Rows[0]; bExcluiu = objCliente.ProcessarExclusao(); if (bExcluiu) { SetMensagemExclusao("O cliente " + sCdClifor + " foi excluído com sucesso!!!", false); } else { SetMensagemExclusao(objCliente.GetErros(), true); } } catch { SetMensagemExclusao("Ocorreu um erro durante a exclusão " + "do cliente de código " + sCdClifor + " !!!", true); } finally { objCliente.RegistroAtual = null; } return(bExcluiu); }
private bool ExecutaPosvalidaCad(CliforDAO objCliente, bool bIncluindo) { bool bRetorno = objCliente.ProcessarPosvalidaCad(); string sCdClifor = objCliente.GetValorPrimario("CD_CLIFOR"); if (bRetorno) { if (!bIncluindo) { MessageHLP.ShowPopUpMsg(string.Format("Dados do Cliente {0}, foram alterados com sucesso! {1}Código: {2}", txtNmGuerra.GetValor(), Environment.NewLine, Session["CD_ALTER"].ToString()), this.Page); } else { UsuarioWeb objUsuario = (UsuarioWeb)Session["ObjetoUsuario"]; Session["CD_ALTER"] = objUsuario.oTabelas.hlpDbFuncoes.qrySeekValue("CLIFOR", "FIRST 1 CD_CLIFOR", string.Format("nm_clifor = '{0}' AND nm_guerra = '{1}'", this.txtNmClifor.GetValor(), this.txtNmGuerra.GetValor())); MessageHLP.ShowPopUpMsg(string.Format("Cliente {0} salvo com sucesso! {1}Código: {2}", txtNmGuerra.GetValor(), Environment.NewLine, Session["CD_ALTER"].ToString()), this.Page); } objCliente.ClearComponentes(this); Response.Redirect("~/PesquisarClientes.aspx?CD_ALTER=" + Session["CD_ALTER"].ToString()); } else { MessageHLP.ShowPopUpMsg(objCliente.GetErros(), this.Page); } return(bRetorno); }
private bool ExecutaPosvalidaCad(CliforDAO objCliente, bool bIncluindo) { bool bRetorno = objCliente.ProcessarPosvalidaCad(); string sCdClifor = objCliente.GetValorPrimario("CD_CLIFOR"); if (bRetorno) { if (!bIncluindo) { MessageHLP.ShowPopUpMsg(string.Format("Dados do Cliente {0}, foram alterados com sucesso! {1}Código: {2}", txtNmGuerra.GetValor(), Environment.NewLine, Session["CD_ALTER"].ToString()), this.Page); } else { MessageHLP.ShowPopUpMsg(string.Format("Cliente {0} salvo com sucesso! {1}Código: {2}", txtNmGuerra.GetValor(), Environment.NewLine, Session["CD_ALTER"].ToString()), this.Page); } objCliente.ClearComponentes(this); Response.Redirect("~/PesquisarClientes.aspx?CD_ALTER=" + Session["CD_ALTER"].ToString()); } else { MessageHLP.ShowPopUpMsg(objCliente.GetErros(), this.Page); } return(bRetorno); }