Esempio n. 1
0
        /// <summary>
        /// Propósito: Método Insertar de la clase de negocios. Este método inserta una fila nueva en la base de datos.
        /// </summary>
        /// <returns>True si tuvo éxito, sino genera una Exception. </returns>
        /// <remarks>
        /// Propiedades necesarias para este método:
        /// <UL>
        ///		 <LI>Fk_idDepartamento</LI>
        ///		 <LI>Fk_idJornada</LI>
        ///		 <LI>Fk_idtipoProfesor</LI>
        ///		 <LI>FechaIngreso</LI>
        ///		 <LI>Fk_idGradoAcademico. May be SqlInt32.Null</LI>
        ///		 <LI>Notas. May be SqlString.Null</LI>
        ///		 <LI>Fk_idUsuario</LI>
        ///		 <LI>Eliminado</LI>
        /// </UL>
        /// Propiedades actualizadas luego de una llamada exitosa a este método:
        /// <UL>
        ///		 <LI>IdProfesor</LI>
        ///		 <LI>CodError</LI>
        /// </UL>
        /// </remarks>
        public override bool Insertar()
        {
            string operacion;

            //SeguridadSoapClient wsseg = new SeguridadSoapClient();
            try
            {
                //Construir aqui el string a guardar en la bitacora.
                operacion = "Insertar cProfesor;"
                            + "Fk_idDepartamento:" + Fk_idDepartamento.ToString() + ";"
                            + "Fk_idJornada:" + Fk_idJornada.ToString() + ";"
                            + "Fk_idtipoProfesor:" + Fk_idtipoProfesor.ToString() + ";"
                            + "FechaIngreso:" + FechaIngreso.ToString() + ";"
                            + "Fk_idGradoAcademico:" + Fk_idGradoAcademico.ToString() + ";"
                            + "Notas:" + Notas.ToString() + ";"
                            + "Fk_idUsuario:" + Fk_idUsuario.ToString() + ";"
                            + "Eliminado:" + Eliminado.ToString() + ";";
                //wsseg.BitacoraRegistrarUso(_COD_APLICACIONBitacora, _COD_FUNCIONALIDADBitacora, _COD_SEDEBitacora, eTipoEventoBitacora.UsoFuncionalidad, _ID_USUARIOBitacora,operacion);
                return(base.Insertar());
            }
            catch (Exception ex)
            {
                //Construir el string a guardar en la bitácora en caso de error.
                operacion = "Error Insertar cProfesor;" + ex.Message;
                //wsseg.BitacoraRegistrarUso(_COD_APLICACIONBitacora, _COD_FUNCIONALIDADBitacora, _COD_SEDEBitacora, eTipoEventoBitacora.Error, _ID_USUARIOBitacora,operacion);
                throw ex;
            }
        }
Esempio n. 2
0
 public override string ToString()
 {
     return(IdVendedor.ToString() + "\t" + Cedula.ToString() + "\t" + Nombre + "\t" + FechaNacimiento.ToShortDateString() + "\t" +
            Sexo.ToString() + "\t" + Telefono.ToString() + "\t" + Correo + "\t" + Direccion + "\t" +
            EstadoCivil.ToString() + "\t" + FechaIngreso.ToShortDateString() + "\t" +
            Salario.ToString() + "\t" + Profesion + "\t" + Calificacion.ToString());
 }
 public override DateTime GenerarFechaEntrega()
 {
     if (CodigoPostalDestino == CodigoPostalOrigen)
     {
         if (Peso > 5)
         {
             int DiasExtas = Convert.ToInt32(Peso) - 5;
             return(FechaEntrega = FechaIngreso.AddDays(DiasExtas));
         }
         else
         {
             return(FechaEntrega = FechaIngreso);
         }
     }
     else
     {
         if (Peso > 5)
         {
             Peso += 1; //Agrego uno para que abajo cuando reste este agregado el dia que tarda al ser de otra ciudad
             int DiasExtas = Convert.ToInt32(Peso - 5);
             return(FechaEntrega = FechaIngreso.AddDays(DiasExtas));
         }
         else
         {
             return(FechaEntrega = FechaIngreso.AddDays(1));
         }
     }
 }
Esempio n. 4
0
        private void Save()
        {
            StreamWriter writer = new StreamWriter("Files/Inventario.txt", true);

            writer.WriteLine(Cantidad.ToString() + "," + PrecioBase.ToString() + "," + PrecioVenta.ToString() + "," +
                             FechaIngreso.ToString() + "," + FechaSalida.ToString() + "," + Car.ToString() + "," + IdInventario.ToString());

            writer.Close();
        }
Esempio n. 5
0
        public override string ToString()
        {
            String datos;

            datos  = "Id: " + IdPaciente + "\n";
            datos += base.ToString();
            datos += "Fecha ingreso: " + FechaIngreso.ToShortDateString() + "\n";
            datos += CobreturaMedica.ToString() + "\n";

            return(datos);
        }
 public override DateTime GenerarFechaEntrega()
 {
     return(FechaEntrega = FechaIngreso.AddDays(5));
 }
Esempio n. 7
0
 private string GetLine()
 {
     return($"{IdVendedor},{Cedula},{Nombre},{FechaNacimiento.ToShortDateString()},{Sexo},{Telefono},{Correo},{Direccion}," +
            $"{EstadoCivil},{FechaIngreso.ToShortDateString()},{Salario},{Profesion},{Calificacion}");
 }
 public void mostrarDatos()
 {
     Console.Write(" Nombre: " + Nombre + "\n Apellido: " + Apellido + "\n Edad: " + edad() + "\n Estado civil: " + estadoCivil + "\n Genero: " + genero + "\n Sueldo: $" + Sueldo + "\n Cargo: " + Cargo +
                   "\n Fecha de nacimiento: " + FechaNacimiento.ToString("dd/MM/yyyy") + "\n Fecha de Ingreso: " + FechaIngreso.ToString("dd/MM/yyyy") + "\n Antigüedad: " + antiguedad() +
                   "\n Años para jubilarse: " + jubilacion() + "\n Salario: $" + salario() + "\n\n");
 }
Esempio n. 9
0
 public override string ToString()
 {
     return(IdInventario.ToString() + "\t" + Car.ToString() + "\t" + Cantidad.ToString() + "\t" + PrecioBase.ToString() + "\t" +
            PrecioVenta.ToString() + "\t" + FechaIngreso.ToString() + "\t" + FechaSalida.ToString());
 }
Esempio n. 10
0
        //public string List()
        //{
        //    string todos = "";
        //    foreach (Inventario Inventario in ListaInventario)
        //    {
        //        todos += Inventario.ToString();
        //    }
        //    return todos;
        //}

        /// <summary>
        /// Muestra los datos de un Inventario
        /// </summary>
        public void Show()
        {
            Console.WriteLine(Cantidad.ToString().PadRight(10) + PrecioBase.ToString().PadLeft(12).PadRight(10) + PrecioVenta.ToString().PadLeft(12).PadRight(10) +
                              FechaIngreso.ToString().PadRight(2).PadLeft(2) + FechaSalida.ToString().PadRight(2).PadLeft(2) + Car.ToString().PadRight(2).PadLeft(2) + IdInventario.ToString().PadRight(2).PadLeft(4));
        }
Esempio n. 11
0
 public override int GetHashCode()
 {
     return(Id.GetHashCode() & FechaIngreso.GetHashCode() & EstaEliminado.GetHashCode() & MaterialId.GetHashCode() & ObraId.GetHashCode() & EncargadoId.GetHashCode() & Cantidad.GetHashCode() & CantidadDevuelta.GetHashCode());
 }
Esempio n. 12
0
 public override string ToString()
 {
     return(base.ToString() + String.Format("\nDocumento: {0}\nNombre Completo: {2}, {1}\nFecha de Ingreso: {3}\nSueldo: {4}", Documento.ToString(), Nombre, Apellido, FechaIngreso.ToShortDateString(), Sueldo));
 }
        private async void BtnGuardarEmpleados_Clicked(object sender, EventArgs e)
        {
            string connectionString = ConfigurationManager.AppSettings["ipServer"];

            try
            {
                var rolIDV            = (PosicionesListView)pickerPosiciones.SelectedItem;
                var areaProduccionIDV = (SubDepartamentosListView)pickerSubDepartamentos.SelectedItem;
                var codigoEmpleadoV   = codigoEmpleado.Text;
                var nombreV           = nombre.Text;
                var apellidoV         = apellido.Text;
                var sexoV             = sexo.SelectedIndex;
                var direccionV        = direccion.Text;
                var telefonoV         = telefono.Text;
                var cedulaV           = cedula.Text;
                var fnV           = FN.Date;
                var fechaIngresoV = FechaIngreso.Date;



                if (string.IsNullOrEmpty(rolIDV.ToString()))
                {
                    await DisplayAlert("Validacion", "Ingresar el puesto del empleado", "Aceptar");

                    pickerPosiciones.Focus();
                    return;
                }
                if (string.IsNullOrEmpty(areaProduccionIDV.ToString()))
                {
                    await DisplayAlert("Validacion", "Ingresar el departamento del empleado", "Aceptar");

                    pickerSubDepartamentos.Focus();
                    return;
                }
                if (string.IsNullOrEmpty(codigoEmpleadoV))
                {
                    await DisplayAlert("Validacion", "Ingresar el codigo del empleado", "Aceptar");

                    codigoEmpleado.Focus();
                    return;
                }
                if (string.IsNullOrEmpty(nombreV))
                {
                    await DisplayAlert("Validacion", "Ingrese el nombre de Usuario", "Aceptar");

                    nombre.Focus();
                    return;
                }

                if (string.IsNullOrEmpty(apellidoV))
                {
                    await DisplayAlert("Validacion", "Ingresar el apellido del empleado", "Aceptar");

                    apellido.Focus();
                    return;
                }

                if (string.IsNullOrEmpty(direccionV))
                {
                    await DisplayAlert("Validacion", "Ingreser la direccion del empleado", "Aceptar");

                    direccion.Focus();
                    return;
                }

                if (string.IsNullOrEmpty(telefonoV))
                {
                    await DisplayAlert("Validacion", "Ingresar el numero telefonico del empleado", "Aceptar");

                    telefono.Focus();
                    return;
                }

                if (string.IsNullOrEmpty(cedulaV))
                {
                    await DisplayAlert("Validacion", "Ingreser la cedula del empleado", "Aceptar");

                    cedula.Focus();
                    return;
                }
                if (string.IsNullOrEmpty(fnV.ToString()))
                {
                    await DisplayAlert("Validacion", "Ingresar la fecha de nacimiento del empleado", "Aceptar");

                    FN.Focus();
                    return;
                }
                if (string.IsNullOrEmpty(fechaIngresoV.ToString()))
                {
                    await DisplayAlert("Validacion", "Ingresar la fecha de ingreso del empleado", "Aceptar");

                    FechaIngreso.Focus();
                    return;
                }

                HttpClient client = new HttpClient();
                client.BaseAddress = new Uri(connectionString);

                var empleados = new Emple()
                {
                    EmpleadoID        = 0,
                    PosicionID        = rolIDV.PosicionID,
                    SubDepartamentoID = areaProduccionIDV.SubDepartamentoID,
                    CodigoEmpleado    = codigoEmpleadoV,
                    Nombres           = nombreV,
                    Apellidos         = apellidoV,
                    Sexo             = (sexo.SelectedIndex == 0) ? false : true,
                    Direccion        = direccionV,
                    Telefono         = telefonoV,
                    Fecha_Nacimiento = fnV,
                    Cedula           = cedulaV,
                    Edad             = DateTime.Now.Year - fnV.Value.Year,
                    FechaIngreso     = fechaIngresoV
                };

                //Convetir a Json
                var           json          = JsonConvert.SerializeObject(empleados);
                StringContent stringContent = new StringContent(json, Encoding.UTF8, "application/json");

                //Ejecutar el api el introduces el metodo
                var request = await client.PostAsync("/api/Empleados/registrar", stringContent);

                if (request.IsSuccessStatusCode)
                {
                    var responseJson = await request.Content.ReadAsStringAsync();

                    var respuesta = JsonConvert.DeserializeObject <Request>(responseJson);

                    //Status
                    if (respuesta.status)
                    {
                        await MaterialDialog.Instance.AlertAsync(message : "Usuario registrado correctamente",
                                                                 title : "Registro",
                                                                 acknowledgementText : "Aceptar");
                    }
                    else
                    {
                        await MaterialDialog.Instance.AlertAsync(message : "Usuario no pudo registrarse correctamente",
                                                                 title : "Registro",
                                                                 acknowledgementText : "Aceptar");
                    }
                }
                else
                {
                    await MaterialDialog.Instance.AlertAsync(message : "Error",
                                                             title : "Error",
                                                             acknowledgementText : "Aceptar");
                }
            }
            catch (Exception ex)
            {
                await MaterialDialog.Instance.AlertAsync(message : ex.Message,
                                                         title : "Error",
                                                         acknowledgementText : "Aceptar");
            }
        }
Esempio n. 14
0
        private void Save()
        {
            System.IO.StreamWriter writer = new System.IO.StreamWriter("Files/Vendedor.txt", true);

            writer.WriteLine(Cedula.ToString() + "," + Nombre + "," + FechaNacimiento.ToShortDateString() + "," +
                             Sexo.ToString() + "," + Telefono.ToString() + "," + Correo + "," + Direccion + "," +
                             EstadoCivil.ToString() + "," + IdVendedor.ToString() + "," + FechaIngreso.ToShortDateString() + "," +
                             Salario.ToString() + "," + Profesion + "," + Calificacion.ToString());

            writer.Close();
        }
Esempio n. 15
0
 //public string List()
 //{
 //    string todos = "";
 //    foreach (Vendedor vendedor in ListaVendedor)
 //    {
 //        todos += vendedor.ToString();
 //    }
 //    return todos;
 //}
 /// <summary>
 /// Muestra los datos de un vendedor
 /// </summary>
 public void Show()
 {
     Console.WriteLine(Cedula.ToString().PadRight(12) + Nombre.PadRight(35) + FechaNacimiento.ToShortDateString().PadLeft(12) +
                       Sexo.ToString().PadRight(12).PadLeft(15) + Telefono.ToString().PadLeft(12).PadRight(15) + Correo.PadRight(40) + Direccion.PadRight(40) +
                       EstadoCivil.ToString().PadRight(12) + IdVendedor.ToString().PadLeft(5) + FechaIngreso.ToShortDateString().PadLeft(12) +
                       Salario.ToString().PadLeft(10) + Profesion.PadLeft(20).PadRight(17) + Calificacion.ToString().PadLeft(5));
 }
Esempio n. 16
0
 public override string ToString()
 {
     return($"Nro. {NumeroCheque} Librador {LibradorNombre} Banco {BancoEmisor.Nombre} F.Dep. {FechaDesposito.ToShortDateString()} F.Ing. {FechaIngreso.ToShortDateString()}");
 }