示例#1
0
        protected string getFoto(int _IdFotoGaleria)
        {
            try
            {
                FotoGaleriaDAL fgDAL = new FotoGaleriaDAL();
                FotoGaleria    fg    = fgDAL.ObterDadosPorId(_IdFotoGaleria);

                return("<a rel=\"galeria\" href=\"" + ConfigurationManager.AppSettings["url"] + "/Arquivos/Galerias/" + fg.DSArquivoFoto + "\"><img src=\"" + ConfigurationManager.AppSettings["url"] + "/Arquivos/Galerias/Temp/Temp_" + fg.DSArquivoFoto + "\" alt=\"\" /></a> ");
            }
            catch (Exception)
            { throw; }
        }
示例#2
0
        protected string getFoto(int _IdFotoGaleria)
        {
            try
            {
                FotoGaleriaDAL fgDAL = new FotoGaleriaDAL();
                FotoGaleria    fg    = fgDAL.ObterDadosPorId(_IdFotoGaleria);

                ResizeSettings resizeCropSettings = new ResizeSettings("width=80&height=80&format=jpg&crop=auto");

                string fileName = Path.Combine(ConfigurationManager.AppSettings["path"], System.Guid.NewGuid().ToString());

                fileName = ImageBuilder.Current.Build(ConfigurationManager.AppSettings["path"] + @"\Galerias\" + fg.DSArquivoFoto, ConfigurationManager.AppSettings["path"] + "/Galerias/Temp/Temp_" + fg.IDFotoGaleria, resizeCropSettings, false, true);

                return("<img src=\"" + ConfigurationManager.AppSettings["url"] + "/Arquivos/Galerias/Temp/Temp_" + fg.DSArquivoFoto + "\" />");
            }
            catch (Exception)
            { throw; }
        }
示例#3
0
        protected void Page_Load(object sender, EventArgs e)
        {
            try
            {
                // LISTA AS ÚLTIMAS FOTOS //
                FotoGaleriaDAL fgDAL = new FotoGaleriaDAL();
                rptUltimasFotos.DataSource = fgDAL.Listar().Cast <FotoGaleria>().OrderByDescending(i => i.IDFotoGaleria).Take(6);
                rptUltimasFotos.DataBind();
                // FIM //

                // LISTA AS ÚLTIMAS NOTAS TÉCNICAS //
                NotaTecnicaDAL ntDAL = new NotaTecnicaDAL();
                rptUltimasNotasTecnicas.DataSource = ntDAL.Listar().Cast <NotaTecnica>().Where(a => a.BTAtiva == true).OrderByDescending(n => n.NRNotaTecnica).OrderByDescending(a => a.NRAnoNotaTecnica).Take(10);
                rptUltimasNotasTecnicas.DataBind();
                // FIM //
            }
            catch (Exception)
            { throw; }
        }
示例#4
0
        protected void Page_Load(object sender, EventArgs e)
        {
            try
            {
                if (!Page.IsPostBack)
                {
                    GaleriaDAL gDAL = new GaleriaDAL();
                    Galeria    g    = gDAL.ObterDadosPorId(Convert.ToInt32(Request.QueryString["idGlr"]));

                    litDescricao.Text = g.DSGaleria;

                    // LISTA AS FOTOS DA GALERIA //
                    FotoGaleriaDAL fgDAL = new FotoGaleriaDAL();
                    rptFotosGaleria.DataSource = fgDAL.Listar().Cast <FotoGaleria>().Where(gl => gl.Galeria.IDGaleria == g.IDGaleria);
                    rptFotosGaleria.DataBind();
                    // FIM //
                }
            }
            catch (Exception)
            { throw; }
        }
示例#5
0
        protected void Page_Load(object sender, EventArgs e)
        {
            try
            {
                FotoGaleriaDAL fgDAL = new FotoGaleriaDAL();

                switch (Request.QueryString["act"])
                {
                case "exc":
                    FotoGaleria fg = fgDAL.ObterDadosPorId(Convert.ToInt32(Request.QueryString["idFot"]));

                    string strCaminho = ConfigurationManager.AppSettings["path"];

                    if (File.Exists(strCaminho + "/Temp/Temp_" + fg.DSArquivoFoto))
                    {
                        File.Delete(strCaminho + "/Temp/Temp_" + fg.DSArquivoFoto);
                    }

                    if (File.Exists(strCaminho + fg.DSArquivoFoto))
                    {
                        File.Delete(strCaminho + fg.DSArquivoFoto);
                    }

                    fgDAL.Excluir(fg);

                    Response.Write("<script language='JavaScript'>alert('Foto da Galeria excluída com sucesso');location='FotosGaleria.aspx?idGlr=" + fg.Galeria.IDGaleria + "';</script>");
                    break;

                default:
                    break;
                }

                // LISTA AS FOTOS DA GALERIA //
                rptFotosGaleria.DataSource = fgDAL.Listar().Cast <FotoGaleria>().Where(g => g.Galeria.IDGaleria == Convert.ToInt32(Request.QueryString["idGlr"]));
                rptFotosGaleria.DataBind();
                // FIM //
            }
            catch (Exception)
            { throw; }
        }
示例#6
0
        protected void Cadastrar(object sender, EventArgs e)
        {
            try
            {
                FotoGaleriaDAL fgDAL = new FotoGaleriaDAL();
                GaleriaDAL     gDAL  = new GaleriaDAL();

                #region FOTO 1
                if (txtFoto1.HasFile)
                {
                    switch (txtFoto1.FileName.Substring(txtFoto1.FileName.Length - 4))
                    {
                    case ".jpg":

                        FotoGaleria fg_1 = new FotoGaleria();
                        fg_1.Galeria       = gDAL.ObterDadosPorId(Convert.ToInt32(Request.QueryString["idGlr"]));
                        fg_1.DSArquivoFoto = "-";

                        fgDAL.Cadastrar(fg_1);

                        FotoGaleria fgUltimo = fgDAL.ObterDadosUltimoCadastrado();

                        string strNome;

                        strNome = fgUltimo.IDFotoGaleria + txtFoto1.FileName.Substring(txtFoto1.FileName.Length - 4);
                        fgUltimo.DSArquivoFoto = strNome;

                        txtFoto1.SaveAs(ConfigurationManager.AppSettings["path"] + @"\Galerias\" + strNome);

                        fgDAL.Alterar(fgUltimo);

                        break;

                    default:
                        break;
                    }
                }
                #endregion

                #region FOTO 2
                if (txtFoto2.HasFile)
                {
                    switch (txtFoto2.FileName.Substring(txtFoto2.FileName.Length - 4))
                    {
                    case ".jpg":

                        FotoGaleria fg_2 = new FotoGaleria();
                        fg_2.Galeria       = gDAL.ObterDadosPorId(Convert.ToInt32(Request.QueryString["idGlr"]));
                        fg_2.DSArquivoFoto = "-";

                        fgDAL.Cadastrar(fg_2);

                        FotoGaleria fgUltimo = fgDAL.ObterDadosUltimoCadastrado();

                        string strNome;

                        strNome = fgUltimo.IDFotoGaleria + txtFoto2.FileName.Substring(txtFoto2.FileName.Length - 4);
                        fgUltimo.DSArquivoFoto = strNome;

                        txtFoto2.SaveAs(ConfigurationManager.AppSettings["path"] + @"\Galerias\" + strNome);

                        fgDAL.Alterar(fgUltimo);

                        break;

                    default:
                        break;
                    }
                }
                #endregion

                #region FOTO 3
                if (txtFoto3.HasFile)
                {
                    switch (txtFoto3.FileName.Substring(txtFoto3.FileName.Length - 4))
                    {
                    case ".jpg":

                        FotoGaleria fg_3 = new FotoGaleria();
                        fg_3.Galeria       = gDAL.ObterDadosPorId(Convert.ToInt32(Request.QueryString["idGlr"]));
                        fg_3.DSArquivoFoto = "-";

                        fgDAL.Cadastrar(fg_3);

                        FotoGaleria fgUltimo = fgDAL.ObterDadosUltimoCadastrado();

                        string strNome;

                        strNome = fgUltimo.IDFotoGaleria + txtFoto3.FileName.Substring(txtFoto3.FileName.Length - 4);
                        fgUltimo.DSArquivoFoto = strNome;

                        txtFoto3.SaveAs(ConfigurationManager.AppSettings["path"] + @"\Galerias\" + strNome);

                        fgDAL.Alterar(fgUltimo);

                        break;

                    default:
                        break;
                    }
                }
                #endregion

                #region FOTO 4
                if (txtFoto4.HasFile)
                {
                    switch (txtFoto4.FileName.Substring(txtFoto4.FileName.Length - 4))
                    {
                    case ".jpg":

                        FotoGaleria fg_3 = new FotoGaleria();
                        fg_3.Galeria       = gDAL.ObterDadosPorId(Convert.ToInt32(Request.QueryString["idGlr"]));
                        fg_3.DSArquivoFoto = "-";

                        fgDAL.Cadastrar(fg_3);

                        FotoGaleria fgUltimo = fgDAL.ObterDadosUltimoCadastrado();

                        string strNome;

                        strNome = fgUltimo.IDFotoGaleria + txtFoto4.FileName.Substring(txtFoto4.FileName.Length - 4);
                        fgUltimo.DSArquivoFoto = strNome;

                        txtFoto4.SaveAs(ConfigurationManager.AppSettings["path"] + @"\Galerias\" + strNome);

                        fgDAL.Alterar(fgUltimo);

                        break;

                    default:
                        break;
                    }
                }
                #endregion

                #region FOTO 5
                if (txtFoto5.HasFile)
                {
                    switch (txtFoto5.FileName.Substring(txtFoto5.FileName.Length - 4))
                    {
                    case ".jpg":

                        FotoGaleria fg_3 = new FotoGaleria();
                        fg_3.Galeria       = gDAL.ObterDadosPorId(Convert.ToInt32(Request.QueryString["idGlr"]));
                        fg_3.DSArquivoFoto = "-";

                        fgDAL.Cadastrar(fg_3);

                        FotoGaleria fgUltimo = fgDAL.ObterDadosUltimoCadastrado();

                        string strNome;

                        strNome = fgUltimo.IDFotoGaleria + txtFoto5.FileName.Substring(txtFoto5.FileName.Length - 4);
                        fgUltimo.DSArquivoFoto = strNome;

                        txtFoto5.SaveAs(ConfigurationManager.AppSettings["path"] + @"\Galerias\" + strNome);

                        fgDAL.Alterar(fgUltimo);

                        break;

                    default:
                        break;
                    }
                }
                #endregion

                Response.Write("<script language='JavaScript'>alert('Foto(s) da Galeria cadastrada(s) com sucesso');window.location='FotosGaleria.aspx?idGlr=" + Request.QueryString["idGlr"] + "';</script>");
            }
            catch (Exception)
            { throw; }
        }