Beispiel #1
0
        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; }
        }
Beispiel #2
0
        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; }
        }
Beispiel #3
0
        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; }
        }