protected string getOpcoes(Int32 _IdDocumento) { try { String strOpcoes = ""; DocumentoDAL dDAL = new DocumentoDAL(); ArquivamentoInternoDAL aiDAL = new ArquivamentoInternoDAL(); ArquivamentoInterno ai = aiDAL.CarregarDadosPorIdDocumento(_IdDocumento); if (ai.ArquivoDocumento == "-") { strOpcoes = strOpcoes + "<a href=\\\"JavaScript:alert('Documento sem arquivo cadastrado');\\\" data-toggle=\\\"tooltip\\\" data-placement=\\\"top\\\" title=\\\"Visualizar Documento\\\"><i class=\\\"fa fa-search\\\" style=\\\"margin-right:10px\\\"></i></a>"; } else { strOpcoes = strOpcoes + "<a href=\\\"http://www.lfcnet.org.br/gesdoc/arquivos/ArquivamentosInternos/" + ai.ArquivoDocumento + "\\\" data-toggle=\\\"tooltip\\\" data-placement=\\\"top\\\" title=\\\"Visualizar Documento\\\" target=\\\"_blank\\\"><i class=\\\"fa fa-search\\\" style=\\\"margin-right:10px\\\"></i></a>"; } strOpcoes = strOpcoes + "<a href=\\\"HistoricoDocumento.aspx?idDoc=" + _IdDocumento + "\\\" data-toggle=\\\"tooltip\\\" data-placement=\\\"top\\\" title=\\\"Histórico do Documento\\\" class=\\\"historicoDocumento\\\"><i class=\\\"fa fa-calendar\\\" style=\\\"margin-right:10px\\\"></i></a>"; strOpcoes = strOpcoes + "<a href=\\\"ArquivarExterno.aspx?idDoc=" + _IdDocumento + "\\\" data-toggle=\\\"tooltip\\\" data-placement=\\\"top\\\" title=\\\"Arquivar Externamente o Documento\\\"><i class=\\\"fa fa-globe\\\" style=\\\"margin-right:10px\\\"></i></a>"; strOpcoes = strOpcoes + "<a href=\\\"#\\\" onclick=\\\"return confirmaDesarquivamento(this, " + _IdDocumento + ");\\\" data-toggle=\\\"tooltip\\\" data-placement=\\\"top\\\" title=\\\"Desarquivar Documento\\\"><i class=\\\"fa fa-folder-open\\\"></i>"; return(strOpcoes); } catch (Exception) { throw; } }
protected string getOpcoes(Int32 _IdDocumento) { try { String strOpcoes = ""; DocumentoDAL dDAL = new DocumentoDAL(); if (dDAL.NaoRecebido(_IdDocumento, Convert.ToInt32(Session["sesIdProcesso"]))) { strOpcoes = strOpcoes + "<button class=\\\"btn btn-danger btn-xs\\\" onclick=\\\"return confirmaRecebimento(this, " + _IdDocumento + ");\\\"><i class=\\\"fa fa-mail-reply\\\"></i></button>"; } else { strOpcoes = strOpcoes + "<a href=\\\"MovimentarDocumento.aspx?idDoc=" + _IdDocumento + "\\\" class=\\\"movimentarDocumento\\\"><button class=\\\"btn btn-success btn-xs\\\"><i class=\\\"fa fa-mail-forward\\\"></i></button></a>"; } strOpcoes = strOpcoes + " <a href=\\\"HistoricoDocumento.aspx?idDoc=" + _IdDocumento + "\\\" class=\\\"historicoDocumento\\\"><button class=\\\"btn btn-primary btn-xs\\\"><i class=\\\"fa fa-calendar\\\"></i></button></a> <a href=\\\"AlterarDocumento.aspx?idDoc=" + _IdDocumento + "\\\"><button class=\\\"btn btn-primary btn-xs\\\"><i class=\\\"fa fa-edit\\\"></i></button></a>"; if (!dDAL.NaoRecebido(_IdDocumento, Convert.ToInt32(Session["sesIdProcesso"]))) { strOpcoes = strOpcoes + " <button class=\\\"btn btn-primary btn-xs\\\" onclick=\\\"return arquivarDocumento(this, " + _IdDocumento + ");\\\"><i class=\\\"fa fa-folder-open\\\"></i></button>"; } //strOpcoes = strOpcoes + " <button class=\\\"btn btn-primary btn-xs\\\" onclick=\\\"return confirmaExclusao(this, " + _IdDocumento + ");\\\"><i class=\\\"fa fa-trash\\\"></i></button>"; return(strOpcoes); } catch (Exception) { throw; } }
protected string getOpcoes(int _IdDocumento) { try { string strOpcoes = ""; DocumentoDAL dDAL = new DocumentoDAL(); if (dDAL.NaoRecebido(_IdDocumento, Convert.ToInt32(Session["sesIdProcesso"]))) { strOpcoes = strOpcoes + "<a href=\\\"#\\\" onclick=\\\"return confirmaRecebimento(this, " + _IdDocumento + ");\\\" data-toggle=\\\"tooltip\\\" data-placement=\\\"top\\\" title=\\\"Receber Documento\\\"><i class=\\\"fa fa-mail-reply\\\" style=\\\"margin-right:10px\\\"></i></a>"; } else { strOpcoes = strOpcoes + "<a href=\\\"MovimentarDocumento.aspx?idDoc=" + _IdDocumento + "\\\" data-toggle=\\\"tooltip\\\" data-placement=\\\"top\\\" title=\\\"Movimentar Documento\\\" class=\\\"movimentarDocumento\\\"><i class=\\\"fa fa-mail-forward\\\" style=\\\"margin-right:10px\\\"></i></a>"; } strOpcoes = strOpcoes + "<a href=\\\"HistoricoDocumento.aspx?idDoc=" + _IdDocumento + "\\\" data-toggle=\\\"tooltip\\\" data-placement=\\\"top\\\" title=\\\"Histórico do Documento\\\" class=\\\"historicoDocumento\\\"><i class=\\\"fa fa-calendar\\\" style=\\\"margin-right:10px\\\"></i></a>"; if (!dDAL.NaoRecebido(_IdDocumento, Convert.ToInt32(Session["sesIdProcesso"]))) { strOpcoes = strOpcoes + "<a href=\\\"#\\\" onclick=\\\"return arquivarDocumento(this, " + _IdDocumento + ");\\\" data-toggle=\\\"tooltip\\\" data-placement=\\\"top\\\" title=\\\"Arquivar Documento\\\"><i class=\\\"fa fa-folder-open\\\"></i></a>"; } //strOpcoes = strOpcoes + " <button class=\\\"btn btn-primary btn-xs\\\" onclick=\\\"return confirmaExclusao(this, " + _IdDocumento + ");\\\"><i class=\\\"fa fa-trash\\\"></i></button>"; return(strOpcoes); } catch (Exception) { throw; } }
protected void Buscar(object sender, EventArgs e) { try { try { DocumentoDAL dDAL = new DocumentoDAL(); Int32 intIdProcesso = Convert.ToInt32(ddlProcesso.SelectedValue); String strDescricao = txtDescricao.Text; Int32 intIdTipoDocumento = Convert.ToInt32(ddlTipoDocumento.SelectedValue); DateTime datCadastro = new DateTime(); if (txtDataCadastro.Text != "") { datCadastro = Convert.ToDateTime(txtDataCadastro.Text); } Documentos.DataSource = dDAL.Buscar(intIdProcesso, strDescricao, datCadastro, intIdTipoDocumento); Documentos.DataBind(); divResultadoBusca.Visible = true; } catch (Exception) { throw; } } catch (Exception) { throw; } }
protected void Page_Load(object sender, EventArgs e) { try { if (!Page.IsPostBack) { DocumentoDAL dDAL = new DocumentoDAL(); Documento d = dDAL.CarregarDadosPorIdDocumento(Convert.ToInt32(Request.QueryString["idDoc"])); // PREENCHE OS TIPOS DE DOCUMENTOS // TipoDocumentoDAL tdDAL = new TipoDocumentoDAL(); ddlTipoDocumento.DataSource = tdDAL.Listar(); ddlTipoDocumento.DataBind(); ddlTipoDocumento.SelectedValue = d.TipoDocumento.IdTipoDocumento.ToString(); // FIM // txtDescricao.Text = d.Descricao; txtNomePortador.Text = d.NomePortador; txtRg.Text = d.RG; txtNumeroInss.Text = d.NumeroINSS; txtCpfCnpj.Text = d.CPFCNPJ; txtVigencia.Text = d.Vigencia.ToString(); DateTime dtNula = new DateTime(0001, 1, 1); if (d.VencimentoVigencia != dtNula) { txtVencimentoVigencia.Text = d.VencimentoVigencia.ToShortDateString(); } if (d.DataEmissao != dtNula) { txtDataEmissao.Text = d.DataEmissao.ToShortDateString(); } if (d.DataAssinatura != dtNula) { txtDataAssinatura.Text = d.DataAssinatura.ToShortDateString(); } if (d.DataPagamentoRecebimento != dtNula) { txtDataPagamentoRecebimento.Text = d.DataPagamentoRecebimento.ToShortDateString(); } txtNumeroParcelas.Text = d.NumeroParcelas; txtValorPrevistoParcela.Text = d.ValorPrevistoParcela; if (d.Descarte != dtNula) { txtDescarte.Text = d.Descarte.ToShortDateString(); } } } catch (Exception) { throw; } }
public static sgd_documentoEntity getDocumentoById(int id) { try { return(DocumentoDAL.getDocumentoById(id)); } catch (Exception ex) { throw new Exception("Error al Buscar id del documento"); } }
public static int setDocumentoMA(sgd_documentoEntity nuevo) { try { return(DocumentoDAL.setDocumentoMA(nuevo)); } catch (Exception) { throw new Exception("No se puede crear el archivo"); } }
public static void setSaveDocumento(sgd_documentoEntity documento) { try { DocumentoDAL.setSaveDocumento(documento); } catch (Exception) { throw; } }
public static void deleteById(int id) { try { DocumentoDAL.deleteById(id); } catch (Exception) { throw; } }
public static bool setDocumento(sgd_documentoEntity nuevo) { try { return(DocumentoDAL.setDocumento(nuevo)); } catch (Exception ex) { return(false); } }
protected void Page_Load(object sender, EventArgs e) { try { DocumentoDAL dDAL = new DocumentoDAL(); MovimentacaoDAL mDAL = new MovimentacaoDAL(); litDocumentosProcesso.Text = dDAL.ListarPorIdProcesso(Convert.ToInt32(Session["sesIdProcesso"])).Count.ToString(); litDocumentosReceber.Text = mDAL.ListarPorProcessoDestinoRecebido(Convert.ToInt32(Session["sesIdProcesso"]), "Não").Count.ToString(); litDocumentosArquivados.Text = dDAL.ListarPorIdProcessoArquivado(Convert.ToInt32(Session["sesIdProcesso"]), "1").Count.ToString(); } catch (Exception) { throw; } }
protected string getOpcoes(Int32 _IdDocumento) { try { String strOpcoes = ""; DocumentoDAL dDAL = new DocumentoDAL(); strOpcoes = strOpcoes + "<a href=\"HistoricoDocumento.aspx?idDoc=" + _IdDocumento + "\" data-toggle=\"tooltip\" data-placement=\"top\" title=\"Histórico do Documento\" class=\"historicoDocumento\"><i class=\"fa fa-calendar\"></i></a>"; return(strOpcoes); } catch (Exception) { throw; } }
protected void Page_Load(object sender, EventArgs e) { try { if (Request.QueryString["act"] == "dsr") { DocumentoDAL dDAL = new DocumentoDAL(); dDAL.Desarquivar(Convert.ToInt32(Request.QueryString["idDoc"])); Response.Write("<script language='JavaScript'>alert('O Documento foi desarquivado com sucesso');location='ListarDocumentosArquivados.aspx';</script>"); } } catch (Exception) { throw; } }
protected string getOpcoes(Int32 _IdDocumento) { try { String strOpcoes = ""; DocumentoDAL dDAL = new DocumentoDAL(); strOpcoes = strOpcoes + "<a href=\"HistoricoDocumento.aspx?idDoc=" + _IdDocumento + "\" class=\"historicoDocumento\"><button class=\"btn btn-primary btn-xs\"><i class=\"fa fa-calendar\"></i></button></a>"; return(strOpcoes); } catch (Exception) { throw; } }
protected void Page_Load(object sender, EventArgs e) { try { DocumentoDAL dDAL = new DocumentoDAL(); MovimentacaoDAL mDAL = new MovimentacaoDAL(); lblDescricao.Text = dDAL.CarregarDadosPorIdDocumento(Convert.ToInt32(Request.QueryString["idDoc"])).Descricao; rptHistoricoDocumento.DataSource = mDAL.ListarPorIdDocumento(Convert.ToInt32(Request.QueryString["idDoc"])); rptHistoricoDocumento.DataBind(); } catch (Exception) { throw; } }
protected string getOpcoes(Int32 _IdDocumento) { try { String strOpcoes = ""; DocumentoDAL dDAL = new DocumentoDAL(); strOpcoes = strOpcoes + "<a href=\"HistoricoDocumento.aspx?idDoc=" + _IdDocumento + "\" class=\"historicoDocumento\"><button class=\"btn btn-primary btn-xs\"><i class=\"fa fa-calendar\"></i></button></a> <a href=\"AlterarDocumento.aspx?idDoc=" + _IdDocumento + "\"><button class=\"btn btn-primary btn-xs\"><i class=\"fa fa-edit\"></i></button></a>"; strOpcoes = strOpcoes + " <button class=\"btn btn-primary btn-xs\" onclick=\"return confirmaExclusao(this, " + _IdDocumento + ");\"><i class=\"fa fa-trash\"></i></button>"; return(strOpcoes); } catch (Exception) { throw; } }
protected string getOpcoes(Int32 _IdDocumento) { try { String strOpcoes = ""; DocumentoDAL dDAL = new DocumentoDAL(); strOpcoes = strOpcoes + "<a href=\"HistoricoDocumento.aspx?idDoc=" + _IdDocumento + "\" data-toggle=\"tooltip\" data-placement=\"top\" title=\"Histórico do Documento\" class=\"historicoDocumento\"><i class=\"fa fa-calendar\" style=\"margin-right:10px\"></i></a>"; strOpcoes = strOpcoes + "<a href=\"#\" onclick=\"return confirmaExclusao(this, " + _IdDocumento + ");\" data-toggle=\"tooltip\" data-placement=\"top\" title=\"Excluir Documento\"><i class=\"fa fa-trash\"></i></a>"; return(strOpcoes); } catch (Exception) { throw; } }
public IList <GedDocumentoDTO> selectDocumento(GedDocumentoDTO documento) { try { using (ISession session = NHibernateHelper.getSessionFactory().OpenSession()) { DocumentoDAL documentoDAL = new DocumentoDAL(session); IList <GedDocumentoDTO> resultado = documentoDAL.selectDocumentosAtivos(documento); session.Flush(); return(resultado); } } catch (Exception ex) { throw ex; } }
protected void ReceberSelecionados(object sender, EventArgs e) { try { string f = Request.Form["chkDocumentos"]; string[] documentos = f.Split(','); foreach (string documento in documentos) { DocumentoDAL dDAL = new DocumentoDAL(); dDAL.Receber(Convert.ToInt32(documento)); } Response.Write("<script language='JavaScript'>alert('Documento(s) recebido(s) com sucesso');window.parent.location='../Home/Default.aspx';</script>"); } catch (Exception) { throw; } }
protected void Page_Load(object sender, EventArgs e) { try { DocumentoDAL dDAL = new DocumentoDAL(); switch (Request.QueryString["act"]) { case "exc": Documento d = dDAL.CarregarDadosPorIdDocumento(Convert.ToInt32(Request.QueryString["idDoc"])); dDAL.Excluir(d); Response.Write("<script language='JavaScript'>alert('O Documento foi excluído com sucesso');location='ListarDocumentos.aspx';</script>"); break; case "rcv": dDAL.Receber(Convert.ToInt32(Request.QueryString["idDoc"])); Response.Write("<script language='JavaScript'>alert('O Documento foi recebido com sucesso');location='ListarDocumentos.aspx';</script>"); break; default: break; } if (!Page.IsPostBack) { // PREENCHE OS TIPOS DE DOCUMENTOS // TipoDocumentoDAL tdDAL = new TipoDocumentoDAL(); ddlTipoDocumento.DataSource = tdDAL.Listar(); ddlTipoDocumento.DataBind(); if (Request.QueryString["idTpd"] == null) { ddlTipoDocumento.Items.Insert(0, (new ListItem("Selecione o tipo de documento", ""))); } else { ddlTipoDocumento.SelectedValue = Request.QueryString["idTpd"]; } // FIM // } } catch (Exception) { throw; } }
protected void Page_Load(object sender, EventArgs e) { try { DocumentoDAL dDAL = new DocumentoDAL(); switch (Request.QueryString["act"]) { case "rcv": dDAL.Receber(Convert.ToInt32(Request.QueryString["idDoc"])); Response.Write("<script language='JavaScript'>alert('O Documento foi recebido com sucesso');location='ListarDocumentos.aspx';</script>"); break; default: break; } } catch (Exception) { throw; } }
protected string getOpcoes(Int32 _IdDocumento) { try { String strOpcoes = ""; DocumentoDAL dDAL = new DocumentoDAL(); //if (dDAL.NaoRecebido(_IdDocumento, Convert.ToInt32(Session["sesIdProcesso"]))) //{ strOpcoes = strOpcoes + "<button class=\\\"btn btn-danger btn-xs\\\" onclick=\\\"return confirmaRecebimento(this, " + _IdDocumento + ");\\\"><i class=\\\"fa fa-mail-reply\\\"></i></button>"; } //else //{ strOpcoes = strOpcoes + "<a href=\\\"MovimentarDocumento.aspx?idDoc=" + _IdDocumento + "\\\" class=\\\"movimentarDocumento\\\"><button class=\\\"btn btn-success btn-xs\\\"><i class=\\\"fa fa-mail-forward\\\"></i></button></a>"; } //strOpcoes = strOpcoes + " <a href=\\\"HistoricoDocumento.aspx?idDoc=" + _IdDocumento + "\\\" class=\\\"historicoDocumento\\\"><button class=\\\"btn btn-primary btn-xs\\\"><i class=\\\"fa fa-calendar\\\"></i></button></a> <a href=\\\"AlterarDocumento.aspx?idDoc=" + _IdDocumento + "\\\"><button class=\\\"btn btn-primary btn-xs\\\"><i class=\\\"fa fa-edit\\\"></i></button></a>"; ArquivamentoInternoDAL aiDAL = new ArquivamentoInternoDAL(); ArquivamentoInterno ai = aiDAL.CarregarDadosPorIdDocumento(_IdDocumento); if (ai.ArquivoDocumento == "-") { strOpcoes = strOpcoes + "<a href=\\\"JavaScript:alert('Documento sem arquivo cadastrado');\\\"><button class=\\\"btn btn-primary btn-xs\\\"><i class=\\\"fa fa-search\\\"></i></button></a>"; } else { strOpcoes = strOpcoes + "<a href=\\\"http://www.lfcnet.org.br/gesdoc/sgd/img/arquivamentosInternos/" + ai.ArquivoDocumento + "\\\" target=\\\"_blank\\\"><button class=\\\"btn btn-primary btn-xs\\\"><i class=\\\"fa fa-search\\\"></i></button></a>"; } strOpcoes = strOpcoes + " <a href=\\\"HistoricoDocumento.aspx?idDoc=" + _IdDocumento + "\\\" class=\\\"historicoDocumento\\\"><button class=\\\"btn btn-primary btn-xs\\\"><i class=\\\"fa fa-calendar\\\"></i></button></a>"; strOpcoes = strOpcoes + " <a href=\\\"ArquivarExterno.aspx?idDoc=" + _IdDocumento + "\\\" class=\\\"arquivarExterno\\\"><button class=\\\"btn btn-primary btn-xs\\\"><i class=\\\"fa fa-globe\\\"></i></button></a>"; strOpcoes = strOpcoes + " <button class=\\\"btn btn-primary btn-xs\\\" onclick=\\\"return confirmaDesarquivamento(this, " + _IdDocumento + ");\\\"><i class=\\\"fa fa-folder-open\\\"></i></button>"; return(strOpcoes); } catch (Exception) { throw; } }
protected void Page_Load(object sender, EventArgs e) { try { if (!Page.IsPostBack) { DocumentoDAL dDAL = new DocumentoDAL(); Documento d = dDAL.CarregarDadosPorIdDocumento(Convert.ToInt32(Request.QueryString["idDoc"])); litDescricao.Text = d.Descricao; litTipo.Text = d.TipoDocumento.DSTipoDocumento; litPortador.Text = d.NomePortador; // PREENCHE OS PROCESSOS // ProcessoDAL pDAL = new ProcessoDAL(); ddlProcessoDestino.DataSource = pDAL.Listar(); ddlProcessoDestino.DataBind(); ddlProcessoDestino.Items.Insert(0, (new ListItem("", ""))); // FIM // } } catch (Exception) { throw; } }
protected void Movimentar(object sender, EventArgs e) { try { DocumentoDAL dDAL = new DocumentoDAL(); Documento d = dDAL.CarregarDadosPorIdDocumento(Convert.ToInt32(Request.QueryString["idDoc"])); UsuarioDAL uDAL = new UsuarioDAL(); Usuario u = uDAL.ObterDadosPorId(Convert.ToInt32(Session["sesIdUsuario"])); ProcessoDAL pDAL = new ProcessoDAL(); Processo p = pDAL.ObterDadosPorId(Convert.ToInt32(ddlProcessoDestino.SelectedValue)); DateTime dtPrazo = DateTime.Now.AddDays(p.NRPrazoMaximo); Movimentacao m = new Movimentacao(); m.Documento = d; m.ProcessoOrigem = Convert.ToInt32(Session["sesIdProcesso"]); m.ProcessoDestino = Convert.ToInt32(ddlProcessoDestino.SelectedValue); m.DataHoraMovimentacao = DateTime.Now.ToShortDateString() + " " + DateTime.Now.ToLongTimeString(); m.MovimentadoPor = u.DSNome; m.Recebido = "Não"; m.DataHoraRecebimento = ""; m.Prazo = dtPrazo; m.Despacho = txtDespacho.Text.Replace("\n", "<br />"); m.EntreguePara = txtEntreguePara.Text.Replace("'", ""); m.AlertaPrazo = "Não"; dDAL.Movimentar(m, d.IdDocumento); // ENVIA O E-MAIL // string strNomeRemetente = "LFC - GesDoc"; string strEmailRemetente = "*****@*****.**"; string strSenha = "01!GesDoc!"; string strSMTP = "smtp.lfc.org.br"; string strEmailDestinatario = "*****@*****.**"; string strAssunto = "Documento movimentado para este processo"; string strConteudo = "Teste de envio de emails usando System.Net.Mail em C#"; //Cria objeto com dados do e-mail. MailMessage objEmail = new MailMessage(); objEmail.From = new System.Net.Mail.MailAddress(strNomeRemetente + "<" + strEmailRemetente + ">"); objEmail.To.Add(strEmailDestinatario); objEmail.Priority = System.Net.Mail.MailPriority.Normal; objEmail.IsBodyHtml = true; objEmail.Subject = strAssunto; objEmail.Body = strConteudo; //Para evitar problemas de caracteres "estranhos", configuramos o charset para "ISO-8859-1" objEmail.SubjectEncoding = System.Text.Encoding.GetEncoding("ISO-8859-1"); objEmail.BodyEncoding = System.Text.Encoding.GetEncoding("ISO-8859-1"); //Cria objeto com os dados do SMTP System.Net.Mail.SmtpClient objSmtp = new System.Net.Mail.SmtpClient(); //Alocamos o endereço do host para enviar os e-mails objSmtp.Credentials = new System.Net.NetworkCredential(strEmailRemetente, strSenha); objSmtp.Host = strSMTP; objSmtp.Port = 587; //Enviamos o e-mail através do método .send() try { objSmtp.Send(objEmail); } catch (Exception ex) { Response.Write("Ocorreram problemas no envio do e-mail. Erro = " + ex.Message); } finally { objEmail.Dispose(); } // FIM // Response.Write("<script language='JavaScript'>alert('O Documento foi movimentado com sucesso');parent.location='ListarDocumentos.aspx';</script>"); } catch (Exception) { throw; } }
protected void Cadastrar(object sender, EventArgs e) { try { Documento d = new Documento(); TipoDocumentoDAL tdDAL = new TipoDocumentoDAL(); d.TipoDocumento = tdDAL.ObterDadosPorId(Convert.ToInt32(ddlTipoDocumento.SelectedValue)); d.Descricao = txtDescricao.Text; d.NomePortador = txtNomePortador.Text; d.RG = txtRg.Text; d.NumeroINSS = txtNumeroInss.Text; d.CPFCNPJ = txtCpfCnpj.Text; if (txtVigencia.Text == "") { d.Vigencia = 0; } else { d.Vigencia = Convert.ToInt32(txtVigencia.Text); } if (txtVencimentoVigencia.Text == "") { d.VencimentoVigencia = new DateTime(1900, 1, 1); } else { d.VencimentoVigencia = Convert.ToDateTime(txtVencimentoVigencia.Text); } if (txtDataEmissao.Text == "") { d.DataEmissao = new DateTime(1900, 1, 1); } else { d.DataEmissao = Convert.ToDateTime(txtDataEmissao.Text); } if (txtDataAssinatura.Text == "") { d.DataAssinatura = new DateTime(1900, 1, 1); } else { d.DataAssinatura = Convert.ToDateTime(txtDataAssinatura.Text); } d.DataCadastro = DateTime.Now; if (txtDescarte.Text == "") { d.Descarte = new DateTime(1900, 1, 1); } else { d.Descarte = Convert.ToDateTime(txtDescarte.Text); } d.SetorAtual = Convert.ToInt32(Session["sesIdProcesso"]); d.Arquivado = "0"; d.AlertaVencimentoVigencia = "Não"; if (txtDataPagamentoRecebimento.Text == "") { d.DataPagamentoRecebimento = new DateTime(1900, 1, 1); } else { d.DataPagamentoRecebimento = Convert.ToDateTime(txtDataPagamentoRecebimento.Text); } d.NumeroParcelas = txtNumeroParcelas.Text; d.ValorPrevistoParcela = txtValorPrevistoParcela.Text; d.Arquivo = "-"; d.Ativo = "S"; DocumentoDAL dDAL = new DocumentoDAL(); dDAL.Cadastrar(d); //Documento dUltimo = dDAL.CarregarDadosUltimoCadastrado(); Response.Write("<script language='JavaScript'>alert('Documento cadastrado com sucesso');window.parent.location='ListarDocumentos.aspx';</script>"); } catch (Exception) { throw; } }
protected void Arquivar(object sender, EventArgs e) { try { DocumentoDAL dDAL = new DocumentoDAL(); // CADASTRA O ARQUIVAMENTO EXTERNO // bool boolArquivoInvalido = false; if (txtArquivoDocumento.HasFile) { switch (txtArquivoDocumento.FileName.Substring(txtArquivoDocumento.FileName.Length - 4)) { case ".pdf": ArquivamentoExterno ae = new ArquivamentoExterno(); ae.Documento = dDAL.CarregarDadosPorIdDocumento(Convert.ToInt32(Request.QueryString["idDoc"])); ae.Estante = Convert.ToInt32(txtEstante.Text); ae.Prateleira = Convert.ToInt32(txtPrateleira.Text); ae.Caixa = Convert.ToInt32(txtCaixa.Text); ae.ArquivoDocumento = "-"; ArquivamentoExternoDAL aeDAL = new ArquivamentoExternoDAL(); aeDAL.Cadastrar(ae); ArquivamentoExterno aeUltimo = new ArquivamentoExterno(); aeUltimo = aeDAL.CarregarDadosUltimoCadastrado(); String strNome; strNome = aeUltimo.IdArquivamentoExterno + txtArquivoDocumento.FileName.Substring(txtArquivoDocumento.FileName.Length - 4); aeUltimo.ArquivoDocumento = strNome; txtArquivoDocumento.SaveAs(Server.MapPath(@"../../../sgd/img/arquivamentosExternos/") + strNome); aeDAL.Alterar(aeUltimo); break; default: boolArquivoInvalido = true; break; } } // FIM // // ALTERA O STATUS DO DOCUMENTO // Documento d = dDAL.CarregarDadosPorIdDocumento(Convert.ToInt32(Request.QueryString["idDoc"])); d.Arquivado = "2"; dDAL.Alterar(d); // FIM // // EXCLUI TODOS OS ARQUIVAMENTOS INTERNOS DO DOCUMENTO // ArquivamentoInternoDAL aiDAL = new ArquivamentoInternoDAL(); aiDAL.ExcluirPorIdDocumento(d.IdDocumento); // FIM // } catch (Exception) { throw; } }
protected void Arquivar(object sender, EventArgs e) { try { DocumentoDAL dDAL = new DocumentoDAL(); ArquivamentoInterno ai = new ArquivamentoInterno(); // CADASTRA O ARQUIVAMENTO INTERNO // bool boolArquivoInvalido = false; if (txtArquivoDocumento.HasFile) { switch (txtArquivoDocumento.FileName.Substring(txtArquivoDocumento.FileName.Length - 4)) { case ".pdf": ai.Documento = dDAL.CarregarDadosPorIdDocumento(Convert.ToInt32(Request.QueryString["idDoc"])); ai.Arquivo = Convert.ToInt32(txtArquivo.Text); ai.Gaveta = Convert.ToInt32(txtGaveta.Text); ai.Pasta = Convert.ToInt32(txtPasta.Text); ai.ArquivoDocumento = "-"; ArquivamentoInternoDAL aiDAL = new ArquivamentoInternoDAL(); aiDAL.Cadastrar(ai); ArquivamentoInterno aiUltimo = new ArquivamentoInterno(); aiUltimo = aiDAL.CarregarDadosUltimoCadastrado(); String strNome; strNome = aiUltimo.IdArquivamentoInterno + txtArquivoDocumento.FileName.Substring(txtArquivoDocumento.FileName.Length - 4); aiUltimo.ArquivoDocumento = strNome; txtArquivoDocumento.SaveAs(Server.MapPath(@"../../../sgd/img/arquivamentosInternos/") + strNome); aiDAL.Alterar(aiUltimo); break; default: boolArquivoInvalido = true; break; } } else { ai.Documento = dDAL.CarregarDadosPorIdDocumento(Convert.ToInt32(Request.QueryString["idDoc"])); ai.Arquivo = Convert.ToInt32(txtArquivo.Text); ai.Gaveta = Convert.ToInt32(txtGaveta.Text); ai.Pasta = Convert.ToInt32(txtPasta.Text); ai.ArquivoDocumento = "-"; ArquivamentoInternoDAL aiDAL = new ArquivamentoInternoDAL(); aiDAL.Cadastrar(ai); } // FIM // // ALTERA O STATUS DO DOCUMENTO // Documento d = dDAL.CarregarDadosPorIdDocumento(Convert.ToInt32(Request.QueryString["idDoc"])); d.Arquivado = "1"; //Response.Write(d.VencimentoVigencia == new DateTime(0001, 1, 1)); //Response.End(); dDAL.Alterar(d); // FIM // // EXCLUI TODOS OS ARQUIVAMENTOS EXTERNOS DO DOCUMENTO // ArquivamentoExternoDAL aeDAL = new ArquivamentoExternoDAL(); aeDAL.ExcluirPorIdDocumento(d.IdDocumento); // FIM // Response.Write("<script language='JavaScript'>alert('Arquivamento Interno do Documento realizado com sucesso');window.parent.location='ListarDocumentos.aspx';</script>"); } catch (Exception) { throw; } }
protected void Alterar(object sender, EventArgs e) { try { DocumentoDAL dDAL = new DocumentoDAL(); Documento d = dDAL.CarregarDadosPorIdDocumento(Convert.ToInt32(Request.QueryString["idDoc"])); TipoDocumentoDAL tdDAL = new TipoDocumentoDAL(); d.TipoDocumento = tdDAL.CarregarDadosPorIdTipoDocumento(Convert.ToInt32(ddlTipoDocumento.SelectedValue)); d.Descricao = txtDescricao.Text; d.NomePortador = txtNomePortador.Text; d.RG = txtRg.Text; d.NumeroINSS = txtNumeroInss.Text; d.CPFCNPJ = txtCpfCnpj.Text; if (txtVigencia.Text == "") { d.Vigencia = 0; } else { d.Vigencia = Convert.ToInt32(txtVigencia.Text); } if (txtVencimentoVigencia.Text == "") { d.VencimentoVigencia = new DateTime(1900, 1, 1); } else { d.VencimentoVigencia = Convert.ToDateTime(txtVencimentoVigencia.Text); } if (txtDataEmissao.Text == "") { d.DataEmissao = new DateTime(1900, 1, 1); } else { d.DataEmissao = Convert.ToDateTime(txtDataEmissao.Text); } if (txtDataAssinatura.Text == "") { d.DataAssinatura = new DateTime(1900, 1, 1); } else { d.DataAssinatura = Convert.ToDateTime(txtDataAssinatura.Text); } if (txtDataPagamentoRecebimento.Text == "") { d.DataPagamentoRecebimento = new DateTime(1900, 1, 1); } else { d.DataPagamentoRecebimento = Convert.ToDateTime(txtDataPagamentoRecebimento.Text); } d.NumeroParcelas = txtNumeroParcelas.Text; d.ValorPrevistoParcela = txtValorPrevistoParcela.Text; if (txtDescarte.Text == "") { d.Descarte = new DateTime(1900, 1, 1); } else { d.Descarte = Convert.ToDateTime(txtDescarte.Text); } dDAL.Alterar(d); Response.Write("<script language='JavaScript'>alert('Documento alterado com sucesso');window.parent.location='ListarDocumentos.aspx';</script>"); } catch (Exception) { throw; } }