Esempio n. 1
0
 protected void btAlteracoes_Click(object sender, EventArgs e)
 {
     try
     {
         clsAutor obj = new clsAutor();
         obj.Id     = Convert.ToInt32(Request.Form["txtEditId"]);
         obj.Nome   = Request.Form["txtEditNome"];
         obj.Origem = Request.Form["txtEditOrigem"];
         string caminhoServer = Server.MapPath("~/IMAGENS/AUTORES/");
         string imgName       = Path.GetFileName(editFoto.PostedFile.FileName);
         if (imgName == "")
         {
             var x = Autores.SelecionarPeloId(obj.Id);
             imgName = x.Foto;
         }
         obj.Foto = Path.Combine(caminhoServer, imgName);
         editFoto.SaveAs(obj.Foto);
         obj.Foto = imgName;
         Autores dalAut = new Autores();
         dalAut.Atualizar(obj);
         Page.ClientScript.RegisterStartupScript(this.GetType(), "", "alert('Atualização Realizada Com Sucesso');window.location.href='Autor.aspx';", true);
     }
     catch
     {
         Page.ClientScript.RegisterStartupScript(this.GetType(), "", "alert('Não foi possivel atualizar!!!');window.location.href='Autor.aspx';", true);
     }
 }
Esempio n. 2
0
        public static void RemoverAutor(int Id)
        {
            Autores.SelecionarPeloId(Id);
            clsAutor autor      = new clsAutor();
            string   deleteFile = Path.Combine(Autor.FullPath + clsAutor.pathForDelete);

            File.Delete(deleteFile);
            Autores.RemoverAutor(Id);
        }
Esempio n. 3
0
 public static clsAutor SelecionarPeloId(int Id)
 {
     return(Autores.SelecionarPeloId(Id));
 }