public void Edit(string newFIO, int rowId)
 {
     if (check.Firmness(newFIO) && check.FIOvalidation(newFIO))
     {
         try
         {
             Lector newRow       = new Lector(newFIO);
             var    equalRecords = LectorDB.Lectors.Where(l => l.FIO.Equals(newFIO));
             if (equalRecords.Any())
             {
                 MessageBox.Show("Такой преподаватель уже существует в базе", "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
             }
             else
             {
                 var EditedValue = LectorDB.Lectors.Where(c => c.Id == rowId)
                                   .FirstOrDefault();
                 EditedValue.FIO = newFIO;
                 LectorDB.SaveChanges();
             }
         }
         catch (Exception ex)
         {
             MessageBox.Show("Произошла ошибка редактирования\n" + ex.Message, "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
         }
     }
 }
Example #2
0
        public static List<ClienteEN> CargarCliente()
        {
            var ListaClientes = new List<ClienteEN>();
            using (var Cnn = new SqlConnection(ConfigurationManager.ConnectionStrings["Mercader"].ToString()))
            {
                Cnn.Open();
                string ConsultaCarga = "SELECT C.CodCli,C.RazonSocial,C.Cuit,(C.Calle + ' ' + C.Numero) AS Direccion,C.Activo,L.Descripcion " + "FROM Cliente C, Localidad L " + "WHERE C.Localidad_CodLoc= L.CodLoc AND C.Activo=1";

                var Cmd = new SqlCommand(ConsultaCarga, Cnn);
                SqlDataReader Lector;
                Lector = Cmd.ExecuteReader();
                while (Lector.Read())
                {
                    var UnCliente = new ClienteEN();
                    UnCliente.CodCli = Conversions.ToInteger(Lector[0]);
                    UnCliente.RazonSocial = Conversions.ToString(Lector[1]);
                    UnCliente.Cuit = Conversions.ToString(Lector[2]);
                    UnCliente.Direccion = Conversions.ToString(Lector[3]);
                    UnCliente.Activo = Conversions.ToBoolean(Lector[4]);
                    UnCliente.Localidad = Conversions.ToString(Lector[5]);
                    ListaClientes.Add(UnCliente);
                }

                return ListaClientes;
            }
        }
Example #3
0
        private static void ObserverExample()
        {
            var observer = new LessonObserver();

            var student1 = new Student("Adam");
            var student2 = new Student("Peter");
            var student3 = new Student("Max");

            var lector = new Lector("Prof. Smith");

            observer.Attach(student1);
            observer.Attach(student2);
            observer.Attach(student3);
            observer.Attach(lector);

            student1.Say("something");
            Console.WriteLine();

            student2.Say("some noize!");
            Console.WriteLine();

            observer.Detach(student1);
            student3.Say("question?");
            Console.WriteLine();

            Console.WriteLine("Ring");
            observer.Ring();
            Console.WriteLine();
        }
Example #4
0
 public IHttpActionResult Add([FromBody] Lector lectorDto)
 {
     try
     {
         if (!ModelState.IsValid)
         {
             response.Status  = Constants.ResponseStatus.error;
             response.Code    = HttpStatusCode.BadRequest;
             response.Message = Constants.ErrorMessage.bad_request;
             return(Content(HttpStatusCode.BadRequest, response));
         }
         else
         {
             t_lector lector = Mapper.Map <Lector, t_lector>(lectorDto);
             repository.Add(lector);
             repository.Save();
             lectorDto.id_lector = lector.id_lector;
             return(Created(new Uri($"{Request.RequestUri}/{lectorDto.id_lector}"), lectorDto));
         }
     }
     catch (Exception ex)
     {
         response.Status  = Constants.ResponseStatus.error;
         response.Message = Constants.ErrorMessage.internal_server_error;
         return(Content(HttpStatusCode.InternalServerError, response));
     }
 }
        public Lector Buscar(long Ndoc)
        {
            Lector        a         = null;
            SqlConnection oConexion = new SqlConnection(Conexion.Cnn);
            SqlCommand    oComando  = new SqlCommand("Exec BuscoLector " + Ndoc, oConexion);

            SqlDataReader oReader;

            try
            {
                oConexion.Open();
                oReader = oComando.ExecuteReader();
                if (oReader.Read())
                {
                    long   ndoc       = (long)oReader["Ndoc"];
                    string nombre     = (string)oReader["NomUsuario"];
                    string usuario    = (string)oReader["Usuario"];
                    string contraseña = (string)oReader["Constraseña"];
                    string correo     = (string)oReader["Correo"];

                    a = new Lector(ndoc, nombre, usuario, contraseña, correo);
                }
                oReader.Close();
            }
            catch (Exception ex)
            {
                throw new Exception(ex.Message);
            }
            finally
            {
                oConexion.Close();
            }
            return(a);
        }
        /// <summary>
        /// Metodo que carga todos los elementos del inventario de la base de datos a una tabla.
        /// </summary>
        /// <param name="Tabla"></param>

        public static void Lote_Inventario(ListView Tabla)
        {
            try
            {
                int I = 0;
                Conexion.Open();
                SqlCommand cmd = new SqlCommand();
                cmd.CommandText = "Lote_Inventario";
                cmd.CommandType = CommandType.StoredProcedure;
                cmd.Connection  = Conexion;
                SqlDataReader Lector;
                Lector = cmd.ExecuteReader();
                while (Lector.Read())
                {
                    Tabla.Items.Add(Lector["Codigo"].ToString());
                    Tabla.Items[I].SubItems.Add(Lector["Material"].ToString());
                    Tabla.Items[I].SubItems.Add(string.Format("{0:n}", Convert.ToDouble(Lector["Costo"])));
                    Tabla.Items[I].SubItems.Add(Lector["Existencia"].ToString());
                    Tabla.Items[I].SubItems.Add(Lector["UMD"].ToString());
                    I++;
                }
                Conexion.Close();
            }
            catch (Exception ex)
            {
                EMensaje.Error("Error : " + ex, "Ruta del error : DT/Inventario/Lote_Inventario");
            }
        }
 public void Buscar(int posicion)
 {
     if (Lector != null)
     {
         Lector.Seek(Lector.WaveFormat.AverageBytesPerSecond * posicion, System.IO.SeekOrigin.Begin);
     }
 }
Example #8
0
 /// <summary>
 /// Obtener movimiento segun la fecha de registro del material y vaciarlo en una tabla.
 /// </summary>
 /// <param name="Tabla"></param>
 public static void Obtener_Mov_Fecha(ListView Tabla)
 {
     try
     {
         int I = 0;
         Conexion.Open();
         OleDbCommand cmd = new OleDbCommand();
         cmd.CommandText = "Obtener_Mov_Fecha";
         cmd.CommandType = CommandType.StoredProcedure;
         cmd.Connection  = Conexion;
         {
             cmd.Parameters.Add("@Movimiento", OleDbType.Char, 55).Value = EMovimientos.Movimiento;
             cmd.Parameters.Add("@Mes", OleDbType.Char, 55).Value        = EMovimientos.Mes;
             cmd.Parameters.Add("@Año", OleDbType.Char, 55).Value        = EMovimientos.Año;
             OleDbDataReader Lector;
             Lector = cmd.ExecuteReader();
             while (Lector.Read())
             {
                 Tabla.Items.Add(Lector["Codigo"].ToString());
                 Tabla.Items[I].SubItems.Add(Lector["Documento"].ToString());
                 Tabla.Items[I].SubItems.Add(Lector["Descripcion"].ToString());
                 Tabla.Items[I].SubItems.Add(Lector["Cantidad"].ToString());
                 Tabla.Items[I].SubItems.Add(Lector["Fecha"].ToString());
                 Tabla.Items[I].SubItems.Add(Lector["Usuario"].ToString());
                 I++;
             }
             Conexion.Close();
         }
         Conexion.Close();
     }
     catch (Exception ex)
     {
         EMensaje.Error("Error : " + ex, "Ruta del error : DT/Movimientos/Obtener_Movimiento");
     }
 }
Example #9
0
        public static List<UsuarioEN> CargarUsuario()
        {
            var ListaUsuarios = new List<UsuarioEN>();
            using (var Cnn = new SqlConnection(ConfigurationManager.ConnectionStrings["Mercader"].ToString()))
            {
                Cnn.Open();
                string ConsultaUsuarios = "SELECT CodUsu,Usuario,Apellido,Nombre,CorreoElectronico,CAST(DATEDIFF(dd,CONVERT(VARCHAR(20),FechaNacimiento),CONVERT(date,GETDATE())) / 365.25 AS INT),Bloqueado" + " FROM Usuario WHERE Activo=1";
                var Cmd = new SqlCommand(ConsultaUsuarios, Cnn);
                SqlDataReader Lector;
                Lector = Cmd.ExecuteReader();
                while (Lector.Read())
                {
                    var UnUsuario = new UsuarioEN();
                    UnUsuario.CodUsu = Conversions.ToInteger(Lector[0]);
                    UnUsuario.Usuario = Conversions.ToString(Lector[1]);
                    UnUsuario.Apellido = Conversions.ToString(Lector[2]);
                    UnUsuario.Nombre = Conversions.ToString(Lector[3]);
                    UnUsuario.CorreoElectronico = Conversions.ToString(Lector[4]);
                    UnUsuario.Edad = Conversions.ToInteger(Lector[5]);
                    UnUsuario.Bloqueado = Conversions.ToBoolean(Lector[6]);
                    ListaUsuarios.Add(UnUsuario);
                }
            }

            return ListaUsuarios;
        }
Example #10
0
        private void btnRutaArchStock_Click(object sender, EventArgs e)
        {
            OpenFileDialog openFileDialog = new OpenFileDialog
            {
                Filter      = "Archivos de Excel|*.xls;*.xlsx;*.xlsm",
                FilterIndex = 1,
                Multiselect = false
            };

            DialogResult result = openFileDialog.ShowDialog();

            if (result == DialogResult.OK)
            {
                txtRutaArchStock.Text = openFileDialog.FileName;
            }

            Data         data    = new Data(txtRutaArchStock.Text);
            Lector       lector  = new Lector(txtRutaArchStock.Text);
            FormCargando loading = new FormCargando(FormCargando.LECTOR_STOCKS, lector, data);

            loading.ShowDialog(this);
            this.listaStocks = lector.listaStocks;

            //Lector lector = new Lector(txtRutaArchStock.Text);
            //this.listaStocks = lector.LeerArchStocks();
        }
        public void UpdateLector(LectorId lectId, Lector lector)
        {
            if (lector == null)
            {
                _logger.Log(string.Format("You sent a null lector:\n {0}", nameof(NullReferenceException)));
            }
            string sql = "Update Lectors Set " +
                         "firstName = @firstName, secondName = @secondName, email = @email " +
                         "Where lectorId = @lectorId";

            try
            {
                using (var sqlConnection = new SqlConnection(_connectionString))
                {
                    sqlConnection.Open();
                    using (SqlCommand command = new SqlCommand(sql, sqlConnection))
                    {
                        command.Parameters.AddWithValue("@lectorId", lectId.Id);
                        command.Parameters.AddWithValue("@firstName", lector.firstName);
                        command.Parameters.AddWithValue("@secondName", lector.secondName);
                        command.Parameters.AddWithValue("@email", lector.email);
                        command.ExecuteNonQuery();
                    }
                }
            }
            catch (SqlException sqlException)
            {
                _logger.Log(string.Format("You have an error with sql:\n {0}", sqlException));
            }
            catch (ArgumentNullException argException)
            {
                _logger.Log(string.Format("You have a null argument:\n {0}", argException));
            }
        }
        public void InsertLector(Lector lector)
        {
            if (lector == null)
            {
                _logger.Log(string.Format("You sent a null lector:\n {0}", nameof(NullReferenceException)));
            }
            string sql = "Insert Into Lectors " +
                         "(firstName, secondName, email) Values " +
                         "(@firstName, @secondName, @email) ";

            try
            {
                using (var sqlConnection = new SqlConnection(_connectionString))
                {
                    sqlConnection.Open();
                    using (SqlCommand command = new SqlCommand(sql, sqlConnection))
                    {
                        command.Parameters.AddWithValue("@firstName", lector.firstName);
                        command.Parameters.AddWithValue("@secondName", lector.secondName);
                        command.Parameters.AddWithValue("@email", lector.email);
                        command.ExecuteNonQuery();
                    }
                }
            }
            catch (SqlException sqlException)
            {
                _logger.Log(string.Format("You have an error with sql:\n {0}", sqlException));
            }
            catch (ArgumentNullException argException)
            {
                _logger.Log(string.Format("You have a null argument:\n {0}", argException));
            }
        }
        public List <Prestamo> PrestamosLector(string numeroCarnetS, out string msg)
        {
            if (String.IsNullOrWhiteSpace(numeroCarnetS))
            {
                msg = "El número de carnet no puede estar vacío";
                return(null);
            }

            int numeroCarnet;

            if (!int.TryParse(numeroCarnetS, out numeroCarnet))
            {
                msg = "El número de carnet debe ser numérico";
                return(null);
            }

            Lector lector = proyectoBiblioteca.Lectors.Find(numeroCarnet);

            if (lector == null)
            {
                msg = "Este socio no existe";
                return(null);
            }

            if (lector.Prestamos.Count == 0)
            {
                msg = "Este socio no tiene ningún préstamo";
                return(null);
            }

            msg = "";
            return(lector.Prestamos.ToList());
        }
Example #14
0
        public void Delete(int id)
        {
            Lector lector = _context.Lectoren.FirstOrDefault(l => l.Id == id);

            _context.Lectoren.Remove(lector);
            _context.SaveChanges();
        }
Example #15
0
        public async Task <ActionResult> Index()
        {
            //If admin
            if (AccountCredentials.GetRole() != RoleName.Lecturer)
            {
                var adminModel = new ReasignViewModel
                {
                    Disciplines  = await Context.Disciplines.ToListAsync(),
                    Lectures     = await Context.Lectures.ToListAsync(),
                    Modules      = await Context.Modules.ToListAsync(),
                    Questions    = await Context.Questions.ToListAsync(),
                    Answers      = await Context.Answers.ToListAsync(),
                    Specialities = await Context.Specialities.ToListAsync(),
                    Groups       = await Context.Groups.ToListAsync(),
                    Students     = await Context.Students.ToListAsync(),
                    Lectors      = await Context.Lectors.ToListAsync()
                };
                return(View(adminModel));
            }
            //If lector
            Lector lector = await AccountCredentials.GetLector();

            if (await Context.LecturesHistories.AnyAsync(lh => lh.IsFrozen == false && lh.LectorId == lector.Id && lh.EndTime == null))
            {
                if (await Context.ModuleHistories.AnyAsync(mh => mh.StartTime != null && mh.IsPassed == false && mh.LectorId == lector.Id))
                {
                    return(RedirectToAction("modulestatistics", "quiz"));
                }
                return(RedirectToAction("activelecture", "admin"));
            }
            var checkIfLector = await _adminPageHelper.LecturesIndexPage(lector);

            return(View(checkIfLector));
        }
Example #16
0
 /// <summary>
 /// Metodo que vacia todos los movimientos de entradas y salidas en una sola tabla.
 /// </summary>
 /// <param name="Tabla"></param>
 public static void Obtener_Movimientos(ListView Tabla)
 {
     try
     {
         int I = 0;
         Conexion.Open();
         OleDbCommand cmd = new OleDbCommand();
         cmd.CommandText = "Obtener_Movimientos";
         cmd.CommandType = CommandType.StoredProcedure;
         cmd.Connection  = Conexion;
         OleDbDataReader Lector;
         Lector = cmd.ExecuteReader();
         while (Lector.Read())
         {
             Tabla.Items.Add(Lector["Codigo"].ToString());
             Tabla.Items[I].SubItems.Add(Lector["Material"].ToString());
             Tabla.Items[I].SubItems.Add(Lector["Descripcion"].ToString());
             Tabla.Items[I].SubItems.Add(Lector["Cantidad"].ToString());
             Tabla.Items[I].SubItems.Add(Lector["Fecha"].ToString());
             I++;
         }
         Conexion.Close();
     }
     catch (Exception ex)
     {
         EMensaje.Error("Error : " + ex, "Ruta del error : DT/Movimiento/Obtner_Movimiento");
     }
 }
Example #17
0
 /// <summary>
 /// Metodo que busca al usuario en la base de datos y vacial sus dato en la entidad.
 /// </summary>
 public static void Buscar()
 {
     try
     {
         Conexion.ConnectionString = _Conexion.Conexion;
         Conexion.Open();
         SqlCommand cmd = new SqlCommand();
         cmd.CommandText = "Usuario_Buscar";
         cmd.CommandType = CommandType.StoredProcedure;
         cmd.Connection  = Conexion;
         cmd.Parameters.Add("@Usuario", SqlDbType.Char, 55).Value = EUsuarios.Usuario;
         SqlDataReader Lector;
         Lector = cmd.ExecuteReader();
         while (Lector.Read())
         {
             EUsuarios.Usuario    = Lector["Usuario"].ToString();
             EUsuarios.Contraseña = Lector["Contraseña"].ToString();
             EUsuarios.Nombre     = Lector["Nombre"].ToString();
             EUsuarios.Apellido   = Lector["Apellido"].ToString();
             EUsuarios.Cargo      = Lector["Cargo"].ToString();
             EUsuarios.Almacen    = Lector["Almacen"].ToString();
             EUsuarios.ID         = Lector["id"].ToString();
         }
         Conexion.Close();
     }
     catch (Exception ex)
     {
         EMensaje.Error("Error : " + ex, "Ruta del error : DT/Usuarios/Buscar");
     }
 }
        public void Baja(Lector B)
        {
            SqlConnection _cnn = new SqlConnection(Conexion.Cnn);

            SqlCommand _comando = new SqlCommand("BajaLector", _cnn);

            _comando.CommandType = System.Data.CommandType.StoredProcedure;
            _comando.Parameters.AddWithValue("@Ndoc", B.Ndoc);
            SqlParameter _retorno = new SqlParameter("@Retorno", System.Data.SqlDbType.Int);

            _retorno.Direction = System.Data.ParameterDirection.ReturnValue;
            _comando.Parameters.Add(_retorno);

            try
            {
                _cnn.Open();
                _comando.ExecuteNonQuery();
                if ((int)_retorno.Value == -1)
                {
                    throw new Exception("El Lector no existe");
                }
            }
            catch (Exception ex)
            {
                throw new Exception(ex.Message);
            }
            finally
            {
                _cnn.Close();
            }
        }
        private void Builder()
        {
            BuilderZapatas builder = new BuilderZapatas();

            builder.BuildZapatas(Lector.Get_Fuerzas(), ETipoZapata.Zapata_Aislada, modelo_proyecto);
            Zapatas = builder.Zapatas;
        }
Example #20
0
 /// <summary>
 /// Metodo que buscar el material en la base de datos, y vacia sus datos en la entidad.
 /// </summary>
 public static void Buscar()
 {
     try
     {
         Conexion.Open();
         SqlCommand cmd = new SqlCommand();
         cmd.CommandText = "Inventario_Buscar";
         cmd.CommandType = CommandType.StoredProcedure;
         cmd.Connection  = Conexion;
         cmd.Parameters.Add("@Codigo", SqlDbType.Char, 55).Value = EInventario.Codigo;
         SqlDataReader Lector;
         Lector = cmd.ExecuteReader();
         while (Lector.Read())
         {
             EInventario.Codigo     = Lector["Codigo"].ToString();
             EInventario.Material   = Lector["Material"].ToString();
             EInventario.Existencia = Lector["Existencia"].ToString();
             EInventario.UMD        = Lector["UMD"].ToString();
             EInventario.Costo      = Convert.ToDouble(Lector["Costo"].ToString());
             EInventario.Precio     = Convert.ToDouble(Lector["Precio_Venta"].ToString());
             EInventario.ID         = Lector["id_Material"].ToString();
         }
     }
     catch (Exception ex)
     {
         EMensaje.Error("Error : " + ex, "Ruta del error : DT/Inventario/Buscar");
     }
     Conexion.Close();
 }
Example #21
0
        public async Task <ReasignViewModel> LecturesIndexPage(Lector lector)
        {
            ReasignViewModel model = new ReasignViewModel();

            model.Lector = lector;
            var lectorsDisciplines = await _db.LectorDisciplines.Where(t => t.LectorId == model.Lector.Id).Select(t => t.DisciplineId)
                                     .ToListAsync();

            var students = await _db.StudentDisciplines.Where(t => lectorsDisciplines.Contains(t.DisciplineId))
                           .Select(t => t.StudentId).ToListAsync();

            var groups = await _db.Students.Where(t => students.Contains(t.Id)).Select(t => t.GroupId).ToListAsync();

            model.Disciplines = await _db.Disciplines.Where(t => lectorsDisciplines.Contains(t.Id)).ToListAsync();

            model.Modules = await _db.Modules.Where(t => lectorsDisciplines.Contains(t.DisciplineId)).ToListAsync();

            model.Lectures = await _db.Lectures.Where(t => lectorsDisciplines.Contains(t.DisciplineId)).ToListAsync();

            model.Groups = await _db.Groups.Where(t => groups.Contains(t.Id)).ToListAsync();

            model.LecturesHistories = await _db.LecturesHistories.Where(t => t.EndTime == null && t.LectorId == model.Lector.Id)
                                      .ToListAsync();

            model.ModuleHistories =
                (from mh in await _db.ModuleHistories.ToListAsync()
                 join lh in model.LecturesHistories on mh.LectureHistoryId equals lh.Id
                 select mh).ToList();
            return(model);
        }
Example #22
0
        public async Task <StatisticsViewModel> GetHistoriesForLector()
        {
            Lector lector = await AccountCredentials.GetLector();

            IEnumerable <Discipline> disciplines =
                await(from ld in _context.LectorDisciplines
                      join d in _context.Disciplines on ld.DisciplineId equals d.Id
                      where ld.LectorId == lector.Id
                      select d).ToListAsync();
            IEnumerable <Lecture> lectures =
                (from d in disciplines
                 join l in await _context.Lectures.ToListAsync() on d.Id equals l.DisciplineId
                 select l).ToList();
            IEnumerable <LecturesHistory> histories =
                (from l in lectures
                 join h in await _context.LecturesHistories.ToListAsync() on l.Id equals h.LectureId
                 select h).ToList();
            StatisticsViewModel totalStatistics = new StatisticsViewModel
            {
                Lector      = lector,
                Disciplines = disciplines,
                Lectures    = lectures,
                Histories   = histories
            };

            return(totalStatistics);
        }
 protected void Page_Load(object sender, EventArgs e)
 {
     Label1.ForeColor = System.Drawing.Color.Red;
     if (!IsPostBack)
     {
         if (Session["USU"] is Lector)
         {
             btnbaja.Enabled = true;
             btnmod.Enabled  = true;
             Usuarios usuario = new Service1Client().BuscarUsuario(((Lector)Session["USU"]).Ndoc);
             Session["USU"] = usuario;
             Lector objlector = (Lector)Session["USU"];
             objlector          = ((Lector)usuario);
             txtndoc.Text       = objlector.Ndoc.ToString();
             txtnom.Text        = objlector.NomUsu.ToString();
             txtusuario.Text    = objlector.Usuario.ToString();
             txtcontraseña.Text = objlector.Contraseña.ToString();
             txtcorreo.Text     = objlector.Correo.ToString();
         }
         else
         {
             Response.Redirect("Default.aspx");
         }
     }
 }
Example #24
0
        public void Add(string name, string lector, int hoursPlan, List <Group> groups)
        {
            var findLector = DB.Lectors.Where(l => l.FIO == lector);

            if (check.Firmness(name) && check.IntegerValidation(hoursPlan) && findLector.Any())
            {
                try
                {
                    string groupsStr = "";
                    foreach (Group group in groups)
                    {
                        groupsStr += group.Name + ";";
                    }
                    Lector     lessonLector = DB.Lectors.Where(l => l.FIO.Equals(lector)).FirstOrDefault();
                    Discipline newRow       = new Discipline(name, lessonLector, hoursPlan, groupsStr);
                    var        equalRecords = DB.Disciplines.Where(l => l.Name.Equals(name) && l.HoursPlan.Equals(hoursPlan) && l.Lector.FIO == lector);
                    if (equalRecords.Any())
                    {
                        MessageBox.Show("Такая дисциплина уже существует в базе", "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    }
                    else
                    {
                        DB.Disciplines.Add(newRow);
                        DB.SaveChanges();
                    }
                }
                catch (Exception ex)
                {
                    MessageBox.Show("Произошла ошибка добавления\n" + ex.Message, "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
            }
        }
Example #25
0
        private void Ejecutar()
        {
            StringBuilder sbQuery = new StringBuilder();

            sbQuery.Append("select secuencia,linea,usuario,cia,time(fecha) as hora,date_format(fecha,'%d/%m/%Y') as fecha,");
            sbQuery.Append("message,programa");
            sbQuery.Append(" from errors");
            sbQuery.Append(" where secuencia = '" + txtNoError.Text + "'");
            MySqlConnection oCnn = new MySqlConnection(this.cCadenaConexion);
            MySqlCommand    oCmd = new MySqlCommand(sbQuery.ToString(), oCnn);
            MySqlDataReader Lector;

            oCnn.Open();
            Lector = oCmd.ExecuteReader();
            if (Lector.Read())
            {
                txtNoError.Text  = Lector.GetString("secuencia");
                txtCompania.Text = Convert.ToString(Lector.GetDecimal("cia"));
                //txtFecha.Text = Convert.ToString(registro["fecha"]);
                txtFecha.Text        = Convert.ToDateTime(Lector.GetString("fecha")).ToLongDateString();
                txtHora.Text         = Lector.GetString("hora");
                txtLinea.Text        = Lector.GetString("linea");;
                txtUsuario.Text      = Lector.GetString("usuario");;
                txtPrograma.Text     = Lector.GetString("programa");;
                txtMensajeError.Text = Lector.GetString("message");;
            }
            oCnn.Close();
        }
Example #26
0
        public static List<ProveedorEN> CargarProveedor()
        {
            var ListaProveedor = new List<ProveedorEN>();
            using (var Cnn = new SqlConnection(ConfigurationManager.ConnectionStrings["Mercader"].ToString()))
            {
                Cnn.Open();
                string ConsultaCarga = "SELECT CodProv,RazonSocial,Cuit,CorreoElectronico,(Calle + ' ' + Numero) AS Direccion,Activo  " + "FROM Proveedor WHERE Activo=1";
                var Cmd = new SqlCommand(ConsultaCarga, Cnn);
                SqlDataReader Lector;
                Lector = Cmd.ExecuteReader();
                while (Lector.Read())
                {
                    var UnProveedor = new ProveedorEN();
                    UnProveedor.CodProv = Conversions.ToInteger(Lector[0]);
                    UnProveedor.RazonSocial = Conversions.ToString(Lector[1]);
                    UnProveedor.Cuit = Conversions.ToString(Lector[2]);
                    UnProveedor.CorreoElectronico = Conversions.ToString(Lector[3]);
                    UnProveedor.Direccion = Conversions.ToString(Lector[4]);
                    UnProveedor.Activo = Conversions.ToBoolean(Lector[5]);
                    ListaProveedor.Add(UnProveedor);
                }

                return ListaProveedor;
            }
        }
Example #27
0
        public IActionResult Create(string Carne, string Nombre, string Telefono, string Direccion, int CargoId, int SexoId)
        {
            if (CargoId > 0 && SexoId > 0 && !string.IsNullOrEmpty(Carne) && !string.IsNullOrEmpty(Nombre) && !string.IsNullOrEmpty(Telefono) && !string.IsNullOrEmpty(Direccion))
            {
                var persistencia = new Lector()
                {
                    Carne     = Carne,
                    Nombre    = Nombre,
                    Telefono  = Telefono,
                    Direccion = Direccion,
                    CargoId   = CargoId,
                    SexoId    = SexoId
                };

                _service.Create(persistencia);

                TempData["created"] = "Registro Creado Correctamente";
                return(RedirectToAction("Index"));
            }

            else
            {
                TempData["created"] = "Error";
                return(RedirectToAction("Index"));
            }
        }
Example #28
0
        private bool ExisteEnLaBaseDeDatos()
        {
            repos = new RepositorioBase <Lector>(new Contexto());
            Lector lector = repos.Buscar((int)IDnumericUpDown.Value);

            return(lector != null);
        }
Example #29
0
 public LectorModel(Lector lector)
 {
     lectorID    = lector.lectorID;
     firstName   = lector.firstName;
     lastnName   = lector.lastnName;
     phoneNumber = lector.phoneNumber;
     email       = lector.email;
 }
        public ActionResult DeleteConfirmed(int id)
        {
            Lector lector = db.Lectores.Find(id);

            db.Lectores.Remove(lector);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }