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