martes, 25 de abril de 2017

Programación en ASP.NET: Resumen

Contenido y Laboratorios


Módulo 01: Introducción

http://galileotalentodigital.blogspot.com/2016/08/programacion-en-aspnet-modulo-01.html


Módulo 02: ADO.NET

http://galileotalentodigital.blogspot.com/2016/08/programacion-en-aspnet-modulo-02-adonet.html

Laboratorios 6 al 8
http://galileotalentodigital.blogspot.com/2016/08/programacion-en-aspnet-modulo-02-adonet_29.html

Programación en ASP.NET: ADO.NET: Seguridad (Laboratorio 9)
http://galileotalentodigital.blogspot.com/2016/08/programacion-en-aspnet-adonet-seguridad.html

Programación en ASP.NET: ADO.NET: Ingreso de Tablas con Relación Padre - Hijo (Parent - Child, Laboratorio 11)
http://galileotalentodigital.blogspot.com/2016/08/programacion-en-aspnet-adonet-ingreso.html


Demostración DropDownList para Seleccionar Elementos
http://galileotalentodigital.blogspot.com/2017/05/aspnet-demostracion-de-dropdownlist.html



Módulo 03: MVC:  (Laboratorio 10)

http://galileotalentodigital.blogspot.com/2016/09/programacion-en-aspnet-mvc-modulo-03.html


Módulo 04: Controller

https://drive.google.com/open?id=0B7Ct7K_LTJvSdUVkX1RNQ0VJZUE

Módulo 04 Laboratorio 01

MVC Controller

https://drive.google.com/open?id=0B7Ct7K_LTJvSVnM5aEs4WU9KT0U



Módulo 05: View

https://drive.google.com/open?id=0B7Ct7K_LTJvSVnAtcUhWZW82RHc

Módulo 05 Laboratorio 01

MVC View

https://drive.google.com/open?id=0B7Ct7K_LTJvSbUtmWGluaW52dVU


Archivo para el Laboratorio
https://drive.google.com/open?id=0B7Ct7K_LTJvSUUdERmJheDJGNmM

Módulo 05 Laboratorio 02

https://drive.google.com/open?id=0B7Ct7K_LTJvSaS12bm93TDhicVE


Archivo para el Laboratorio
https://drive.google.com/open?id=0B7Ct7K_LTJvSaTVrcGVPZ295TTQ




Módulo 06: Seguridad

https://drive.google.com/open?id=0B7Ct7K_LTJvSWGpGY1JXNUhzMEU

Módulo 06 Laboratorio 01

MVC Autenticación
https://drive.google.com/open?id=0B7Ct7K_LTJvSSWlJSVdmbjdfUlE


Módulo 06 Laboratorio 02


MVC Autenticación Facebook
https://drive.google.com/open?id=0B7Ct7K_LTJvSQWhUTmJ5RTNEYTg


Módulo 06 Laboratorio 03


MVC Autorización
https://drive.google.com/open?id=0B7Ct7K_LTJvSTFBVR2lMS00wbkU






Proyecto

http://galileotalentodigital.blogspot.com/2016/08/proyecto.html




Referencias


Programación en ASP.NET: Referencias
http://galileotalentodigital.blogspot.com/2016/07/programacion-en-aspnet-referencias.html

Programación en ASP.NET: Libros
http://galileotalentodigital.blogspot.com/2016/07/programacion-en-aspnet-libros.html

Retrieving and Modifying Data in ADO.NET
https://msdn.microsoft.com/en-us/library/ms254937(v=vs.110).aspx


Programación en ASP.NET: ListView
http://galileotalentodigital.blogspot.com/2016/07/programacion-en-aspnet-listview_23.html

Programación en ASP.NET: Data List
http://galileotalentodigital.blogspot.com/2016/07/programacion-en-aspnet-data-list.html

Programación en ASP.NET: GridView
http://galileotalentodigital.blogspot.com/2016/07/programacion-en-aspnet-gridview.html

Programación en ASP.NET: Controles: GridView, FormView, DataList
http://galileotalentodigital.blogspot.com/2016/07/programacion-en-aspnet-controles.html







jueves, 20 de abril de 2017

Pro C#: Módulo 03: Código Fuente: Estructura EmpleadoEstatico


Código Fuente de Ejemplo

EmpleadoEstatico.cs


    /// <summary>
    /// Estructura para Empleados
    /// </summary>
    public struct EmpleadoEstatico
    {
        private string Temporal; //Campo Privado
        //Propiedad Automática
        public string Apellido { get; set; }

        private string mNombre;

        //Propiedad Codificada
        /// <summary>
        /// Propiedad Nombre
        /// </summary>
        public string Nombre
        {
            get { return mNombre; }
            set { mNombre = value; }
        }

        public DateTime FechaNacimiento { get; set; }

       
        private int mEdad2;

        public int Edad2
        {
            get
            {
                mEdad2 = (int)
                    (Now.Subtract(FechaNacimiento).TotalDays / 365.25);
                return mEdad2;
            }          
        }

        /// <summary>
        /// Método que devuelva la Edad del
        /// Empleado
        /// </summary>
        /// <returns>int positivo</returns>
        public int Edad()
        {
            int mEdad = 0;
            mEdad = (int)
                (Now.Subtract(FechaNacimiento).TotalDays / 365.25f);
            return mEdad;
        }

        /// <summary>
        /// Inicializa la estructura y asigna el Apellido
        /// </summary>
        /// <param name="Apellido"></param>
        public EmpleadoEstatico(string Apellido)
        {
            Temporal = "";
            mEdad2 = 0;
            FechaNacimiento = Now;
            this.Apellido = Apellido;
            mNombre = "N/D";
            //Nombre = "N/D";
        }

        /// <summary>
        /// Inicializa la estructura
        /// Asigna Apellido y Nombre
        /// </summary>
        /// <param name="Apellido"></param>
        /// <param name="Nombre"></param>
        public EmpleadoEstatico(string Apellido,
            string Nombre)
        {
            Temporal = "";
            mEdad2 = 0;
            FechaNacimiento = Now;
            this.Apellido = Apellido;
            mNombre = Nombre;
        }

    }



Program.cs


    class Program
    {
        static void Main(string[] args)

        {
            EmpleadoEstatico Emp1;
            Emp1 = new EmpleadoEstatico();
            Emp1.Apellido = "Ape 1";
            Emp1.FechaNacimiento = new DateTime(1990, 4, 20);
            Console.WriteLine(
                $"Método: {Emp1.Edad()}");
            Console.WriteLine(
                $"Propiedad: {Emp1.Edad2}");

            EmpleadoEstatico Emp2, Emp3;
            Emp2 = new EmpleadoEstatico("Ape 2");
            Emp3 = new EmpleadoEstatico(
                Nombre: "Nombre 3", Apellido: "Ape 3");
           
        }

    }


viernes, 7 de abril de 2017

Pro C#: Módulo 09: Laboratorio 10: Código Fuente

Elementos de la Interfaz

        private System.Windows.Forms.TableLayoutPanel tlPrincipal;
        private System.Windows.Forms.Label label1;
        private System.Windows.Forms.TextBox txtOrigen1;
        private System.Windows.Forms.Label label2;
        private System.Windows.Forms.TextBox txtDestino1;
        private System.Windows.Forms.Button btnArchivo1;
        private System.Windows.Forms.Button btnDescarga1;
        private System.Windows.Forms.ProgressBar pbTarea1;
        private System.Windows.Forms.StatusStrip stPrincipal;
        private System.Windows.Forms.ToolStripStatusLabel stTarea1;
        private System.Windows.Forms.ToolStripStatusLabel stTarea2;
        private System.Windows.Forms.ToolStripStatusLabel stTarea3;
        private System.Windows.Forms.Timer tmTarea1;
        private System.Windows.Forms.Label label3;
        private System.Windows.Forms.OpenFileDialog ofdArchivo;
        private System.Windows.Forms.Label label4;
        private System.Windows.Forms.TextBox txtOrigen2;
        private System.Windows.Forms.ProgressBar pbTarea2;
        private System.Windows.Forms.Button btnDescarga2;
        private System.Windows.Forms.TextBox txtDestino2;
        private System.Windows.Forms.Button btnArchivo2;

Código Fuente de Ejemplo:


public partial class frmFTP : Form
    {
        int Intervalo = 1;
        int CHUNK_SIZE = 512;

        public frmFTP()
        {
            InitializeComponent();
        }

        private void descargaArch(string Origen, string Destino)
        {
            //Request para el Servidor 
            FtpWebRequest peticion = (FtpWebRequest)WebRequest.Create(Origen);
            peticion.Method = WebRequestMethods.Ftp.DownloadFile;

            //Usuario Anónimo 
            peticion.Credentials = new NetworkCredential("anonymous", "dsantizo@galileo.edu");
            //Response creado a partir del Request
            FtpWebResponse respuesta = (FtpWebResponse)peticion.GetResponse();
            //Stream de Respuesta
            Stream respuestaStrm = respuesta.GetResponseStream();
            BinaryReader lector = new BinaryReader(respuestaStrm);

            //Stream de Escritura
            FileStream Archivo =
                new FileStream(Destino, FileMode.Create, FileAccess.Write);
            BinaryWriter escritor = new BinaryWriter(Archivo);
            //Define Buffer
            Byte[] Datos = new Byte[CHUNK_SIZE];
            int Posicion = 0;
            //Lee Datos
            Datos = lector.ReadBytes(CHUNK_SIZE);
            //Verifica que obtuvo información
            while(Datos.Length > 0)
            {
               
                escritor.Write(Datos);
              
                Posicion += Datos.Length;
                Datos = lector.ReadBytes(CHUNK_SIZE);
                Debug.WriteLine($"Posición: {Posicion:N0}");               
            }

            Archivo.Close();

            //TODO : Cambiar código para que escriba en un archivo destino


            Debug.WriteLine(
                $"Descarga Completa, Estado {respuesta.StatusDescription}");

            lector.Close();
            respuesta.Close();
        }

        private void frmFTP_Load(object sender, EventArgs e)
        {

        }


        private void btnArchivo1_Click(object sender, EventArgs e)
        {
            ofdArchivo.ShowDialog();
            txtDestino1.Text = ofdArchivo.FileName;
        }


        private void btnDescarga1_Click(object sender, EventArgs e)
        {
            tmTarea1.Enabled = true;
            Task tarea1 = new Task(() => descargaArch(txtOrigen1.Text, txtDestino1.Text));
            tarea1.Start();
            tmTarea1.Enabled = false;
            string sDestino = Path.GetFileName(txtDestino1.Text);
            stTarea1.Text = $"Tarea 1: {sDestino} Completo";
        }

        private void tmTarea1_Tick(object sender, EventArgs e)
        {
            if ((pbTarea1.Value + Intervalo) > pbTarea1.Maximum)
                pbTarea1.Value = pbTarea1.Minimum;
            else
                pbTarea1.Value += Intervalo;
        }

        private void btnDescarga2_Click(object sender, EventArgs e)
        {
            descargaArch(txtOrigen2.Text, txtDestino2.Text);
            string sDestino = Path.GetFileName(txtDestino1.Text);
            stTarea2.Text = $"Tarea 2: {sDestino} Completo";
        }

        private void btnArchivo2_Click(object sender, EventArgs e)
        {
            ofdArchivo.ShowDialog();
            txtDestino2.Text = ofdArchivo.FileName;
        }

    }