Created
April 26, 2011 14:49
-
-
Save kaldas/942398 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Imports BLL | |
| Imports Model | |
| Public Class Editar2 | |
| Inherits System.Web.UI.Page | |
| Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load | |
| If Not IsPostBack Then | |
| If Request.QueryString("id") IsNot Nothing Then | |
| Dim myCase As CaseSucesso = CaseSucessoBLL.retornaCaseSucessoPorID(New Guid(Request.QueryString("id"))) | |
| lnkImagemConteudo.Text = myCase.Imagem | |
| lnkImagemConteudo.NavigateUrl = "../../Uploads/Case/Imagens-Conteudo/" & myCase.Imagem | |
| lnkImagemConteudo.Target = "_blank" | |
| lnkImagemIntroducao.Text = myCase.Imagem_Introducao | |
| lnkImagemIntroducao.NavigateUrl = "../../Uploads/Case/Imagens-Introducao/" & myCase.Imagem_Introducao | |
| lnkImagemIntroducao.Target = "_blank" | |
| lnkVideoAnexo.Text = myCase.Video | |
| lnkVideoAnexo.NavigateUrl = "../../Uploads/Case/Videos/" & myCase.Video | |
| lnkVideoAnexo.Target = "_blank" | |
| txtConteudo.Text = myCase.Conteudo | |
| txtIntroducao.Text = myCase.Introducao | |
| Else | |
| Response.Redirect("Default.aspx") | |
| End If | |
| End If | |
| End Sub | |
| Protected Sub editCaseSucesso_Click(ByVal sender As Object, ByVal e As EventArgs) Handles editCaseSucesso.Click | |
| Try | |
| Dim myCase As CaseSucesso = CaseSucessoBLL.retornaCaseSucessoPorID(New Guid(Request.QueryString("id"))) | |
| myCase.Conteudo = txtConteudo.Text | |
| myCase.Introducao = txtIntroducao.Text | |
| If introFile.HasFile Then | |
| myCase.Imagem_Introducao = System.IO.Path.GetFileName(introFile.FileName) | |
| introFile.SaveAs(Server.MapPath("../../Uploads/Case/Imagens-Introducao/") & myCase.Imagem_Introducao) | |
| End If | |
| If contFile.HasFile Then | |
| myCase.Imagem = System.IO.Path.GetFileName(contFile.FileName) | |
| contFile.SaveAs(Server.MapPath("../../Uploads/Case/Imagens-Conteudo/") & myCase.Imagem) | |
| End If | |
| If videoFile.HasFile Then | |
| myCase.Video = System.IO.Path.GetFileName(videoFile.FileName) | |
| videoFile.SaveAs(Server.MapPath("../../Uploads/Case/Videos/") & myCase.Video) | |
| End If | |
| CaseSucessoBLL.atualizaCaseSucesso(myCase) | |
| Catch ex As Exception | |
| Response.Redirect("../../AvisoErro.aspx") | |
| End Try | |
| Response.Redirect("Default.aspx") | |
| End Sub | |
| End Class |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment