protected override void btnGuardar_Click(object sender, System.EventArgs e) { if (reloj == null) { return; } if (!Validar()) { return; } try { LogicReloj lr = new LogicReloj(); reloj = MapearDeFormulario(); lr.ModifReloj(reloj); PanelReloj.Instancia.RefreshGrid(); base.Informar("Dispositivo guardado correctamente.", "Editar Dispositivo"); reloj = null; PanelReloj.Instancia.RefreshGrid(); this.Close(); } catch (Exception ex) { base.InformarError(ex.Message, "Editar Equipos"); } }
private void dgvReloj_CellContentClick(object sender, DataGridViewCellEventArgs e) { if (dgvReloj.SelectedRows.Count != 0) { DataGridViewRow row = this.dgvReloj.SelectedRows[0]; row.Cells[0].Value = Resources.ic_check_circle_green_400_18dp; Reloj objR = new Reloj(); objR.cvReloj = Convert.ToInt32(row.Cells["Clave"].Value.ToString()); objR.IpReloj = row.Cells["IP"].Value.ToString(); objR.Teclado = Convert.ToBoolean(row.Cells["Teclado"].Value); objR.Huella = Convert.ToBoolean(row.Cells["Huella"].Value); objR.Rostro = Convert.ToBoolean(row.Cells["Rostro"].Value); objR.MultipleHuella = Convert.ToBoolean(row.Cells["multiplehuella"].Value); objR.UltimaDescargaAsistencia = row.Cells["Última Descarga Asistencias"].Value.ToString(); objR.Descripcion = row.Cells["Descripción"].Value.ToString(); objR.UsuDescargaAsistencia = row.Cells["Usuario Sincronizó Asistencias"].Value.ToString(); objR.UltimaSincronizacion = row.Cells["Última Sincronización Usuarios"].Value.ToString(); objR.UltimoUsuarioSinc = row.Cells["Usuario Sincronizó Usuarios"].Value.ToString(); ValidarExistencia(ltReloj, objR); if (row.Cells[0].Tag.ToString() == "check") { row.Cells[0].Value = Resources.ic_lens_blue_grey_600_18dp; row.Cells[0].Tag = "uncheck"; } else if (row.Cells[0].Tag.ToString() == "uncheck") { row.Cells[0].Value = Resources.ic_check_circle_green_400_18dp; row.Cells[0].Tag = "check"; } } }
private void finAtencion(Operario o) { //Termina de controlar, cargo acumuladores cantidadRelojesControlados++; tiempoTotalControl += o.relojAtendiendo.tiempoFinControl - o.relojAtendiendo.tiempoComienzoControl; o.tiempoOcupado += o.relojAtendiendo.tiempoFinControl - o.relojAtendiendo.tiempoComienzoControl; o.relojAtendiendo.estado = "Ok"; //Si hay cola tomo el siguiente reloj, sino paso estado a Libre if (cola != 0) { Reloj proxReloj = null; for (int i = 0; i < listaRelojes.Count; i++) { if (listaRelojes.ElementAt <Reloj>(i).estado == "En cola") { proxReloj = listaRelojes.ElementAt <Reloj>(i); break; } } inicioControl(proxReloj, o); cola--; //Aumento acumulador de tiempo de cola tiempoColaTotal += proxReloj.tiempoComienzoControl - proxReloj.tiempoEntrada; } else { o.estado = "Libre"; } }
private void linkReiniciarDisp_Click(object sender, EventArgs e) { try { relojAct = MapearDeGrid(); if (!relojAct.Estado) { InformarError("El equipo '" + relojAct.Nombre + "' no está conectado.", "Reiniciar Dispositivo."); return; } logicOperaciones = new LogicOperaciones(); logicOperaciones.Reboot(relojAct); LoguearInforme("Se ha reiniciado correctamente el reloj: " + relojAct.Nombre); } catch (AppException appex) { LoguearError(appex.Message); } finally { relojAct.ActivarDispositivo(); relojAct = null; logicOperaciones = null; } }
/** * LOAD ENS CARREGA AL PRIMER COP QUE ENTREM TOT EL CONTINGUT **/ private void FormPrincipal_Load(object sender, EventArgs e) { pictureBoxImagenPrincipal.Image = pictureBox1.Image; Reloj.Start(); //incia el rellotge pictureBoxImagenPrincipal.Select(); //seleccionem imatge perque no es seleccioni ninguna grid bindingSourceEntitats.DataSource = EntitatsORM.SelectAllEntitiesByTemporadaActual("2018-2019"); }
private void linkInicializar_Click(object sender, EventArgs e) { try { relojAct = MapearDeGrid(); if (!relojAct.Estado) { InformarError("El equipo '" + relojAct.Nombre + "' no está conectado.", "Incializar Dispositivo."); return; } logicOperaciones = new LogicOperaciones(); logicOperaciones.InitializeDevice(relojAct); LoguearInforme("Se ha inicializado el equipo: " + relojAct.Nombre); } catch (AppException appex) { LoguearError(appex.Message); } finally { relojAct.ActivarDispositivo(); relojAct = null; logicOperaciones = null; } }
private void FormEntitats_Load(object sender, EventArgs e) { Reloj.Start(); pictureBox7.Select(); omplirComboTemp(); bindingSourceEntitats.DataSource = EntitatsORM.SelectAllEntitiesByTemporadaActual(Utilitats.tempActual()); }
//ImprimirReloj mostrará en pantalla el valor recibido, dependiendo del valor del enumerado, //siendo Reloj.Primero el label lblTimer1 (primero de izquierda a derecha) y así sucesibamente. public void ImprimirReloj(Reloj reloj, string dato) { if (this.InvokeRequired) { Item.EventoTiempo pos = new Item.EventoTiempo(ImprimirReloj); object[] obj = new object[] { reloj, dato }; this.Invoke(pos, obj); } else { switch (reloj) { case Reloj.Primero: lbl1.Text = dato; break; case Reloj.Segundo: lbl2.Text = dato; break; case Reloj.Tercero: lbl3.Text = dato; break; case Reloj.Cuarto: lbl4.Text = dato; break; } } }
private void Principal_Load(object sender, EventArgs e) { // Permisos.SetPermissions(); //Basico.crear_archivo_properties(); //string _efact = Path.GetDirectoryName(Application.ExecutablePath).ToString() + "/Efact"; //MessageBox.Show(_efact); //verificar si es que los archivos de configuracion existe del app.config //if Basico._cerificado string _error = ""; Basico.copiar_archivo_config(ref _error); if (_error.Length > 0) { MessageBox.Show(_error + "==>> CONSULTE CON SISTEMA ACERCA DEL ERROR....", Global.mensaje, MessageBoxButtons.OK, MessageBoxIcon.Exclamation); } Reloj.Start(); menu = new Ventana(this); Basico._form_principal = this; //MessageBox.Show(Path.GetDirectoryName(Application.ExecutablePath).ToString()); //Config_Imp.GenerarTicketFact("",2); //Config_Imp.Mainimp(); }
private void linkSincHora_Click(object sender, EventArgs e) { try { relojAct = MapearDeGrid(); if (!relojAct.Estado) { InformarError("El equipo '" + relojAct.Nombre + "' no está conectado.", "Sincronizar Hora."); return; } logicOperaciones = new LogicOperaciones(); logicOperaciones.SincHora(relojAct); LoguearInforme("Se sincronizó correctamente la hora con el reloj: '" + relojAct.Nombre + "'"); } catch (AppException appex) { LoguearError(appex.Message); } finally { relojAct.ActivarDispositivo(); relojAct = null; logicOperaciones = null; } }
private void linkDesconnect_Click(object sender, EventArgs e) { try { relojAct = MapearDeGrid(); if (!relojAct.Estado) { InformarError("El dispositivo: '" + relojAct.Nombre + "' ya se encuentra desconectado.", "Desconectar Reloj."); return; } logicOperaciones = new LogicOperaciones(); logicOperaciones.Disconnect(relojAct); MapearAGrid(relojAct); LoguearInforme("El dispositivo: '" + relojAct.Nombre + "' se desconectó correctamente"); } catch (AppException appex) { LoguearError(appex.Message); } finally { relojAct.ActivarDispositivo(); relojAct = null; logicOperaciones = null; } }
private void btIniciar_Click(object sender, EventArgs e) { //Almacenar los datos de los controles string resultado = validarDatos(); //Validar si hay errores if (resultado != String.Empty) { MessageBox.Show("Se encontraron los siguientes errores:" + resultado); } else { //Almacenar en datos generales almacenarDatosGenerales(); //Deshabilitar botones de iniciar y de acciones btIniciar.Enabled = false; btAcciones.Enabled = false; txFrecuencia.Enabled = false; btDetener.Enabled = true; //Configurar e iniciar Reloj Reloj.Interval = int.Parse(txFrecuencia.Text); Reloj.Start(); } }
private void linkConnect_Click(object sender, EventArgs e) { try { relojAct = MapearDeGrid(); if (relojAct.Estado) { InformarError("El dispositivo: '" + relojAct.Nombre + "' ya se encuentra conectado.", "Conectar Reloj."); return; } LoguearInforme("Conectando con '" + relojAct.Nombre + "'..."); logicOperaciones = new LogicOperaciones(); if (logicOperaciones.Connect(relojAct)) { LoguearInforme("El dispositivo: '" + relojAct.Nombre + "' se conectó correctamente"); MapearAGrid(relojAct); } else { LoguearError("Ocurrió un error al intentar conectar con: '" + relojAct.Nombre); } } catch (AppException appex) { LoguearError(appex.Message); } finally { relojAct.ActivarDispositivo(); relojAct = null; logicOperaciones = null; } }
private void btnUsuarios_Click(object sender, EventArgs e) { if (cbRelojes.SelectedIndex < 0) { base.InformarError("Por favor seleccione un dispositivo", "Sincronizar Datos."); } // SI SE UTILIZO OTRO RELOJ LO DESCONECTO // if (relojAct != null && !relojAct.Estado) { relojAct.Desconectar(); } try { gridPersonalReloj.AutoGenerateColumns = false; // Para que respete las columnas ya diseñadas relojAct = (Reloj)cbRelojes.SelectedItem; relojAct.Conectar(); gridPersonalReloj.DataSource = null; gridPersonalReloj.Refresh(); gridPersonalReloj.DataSource = relojAct.DescargarInfo(); relojAct.Desconectar(); gridPersonalReloj.Refresh(); lblDispositivo.Text = "Usuarios en dispositivo: " + relojAct.Nombre; } catch (AppException appex) { base.InformarError(appex.Message, "Sincronizar Datos."); } }
private void Ckheader_CheckedChanged(object sender, EventArgs e) { CheckBox chk = (CheckBox)sender; if (chk.Checked == true) { ltReloj.Clear(); foreach (DataGridViewRow row in dgvReloj.Rows) { row.Cells[0].Value = Resources.ic_check_circle_green_400_18dp; Reloj objR = new Reloj(); objR.cvReloj = Convert.ToInt32(row.Cells["Clave"].Value.ToString()); objR.IpReloj = row.Cells["IP"].Value.ToString(); ltReloj.Add(objR); } } else { ltReloj.Clear(); foreach (DataGridViewRow row in dgvReloj.Rows) { row.Cells[0].Value = Resources.ic_lens_blue_grey_600_18dp; row.Cells[0].Tag = "uncheck"; } } }
private void linkBorrarAdmin_Click(object sender, EventArgs e) { try { relojAct = MapearDeGrid(); if (!relojAct.Estado) { InformarError("El equipo '" + relojAct.Nombre + "' no está conectado.", "Eliminar Administradores."); return; } if (!base.Question("Está seguro que desea eliminar los administradores del equipo?", "Eliminar Administradores.")) { return; } logicOperaciones = new LogicOperaciones(); logicOperaciones.DeleteAdmin(relojAct); LoguearInforme("Todos los administradores fuero borrados del reloj: " + relojAct.Nombre); } catch (AppException appex) { LoguearError(appex.Message); } finally { relojAct.ActivarDispositivo(); relojAct = null; logicOperaciones = null; } }
//En su constructor se instanciará e iniciará un nuevo Thread para el atributo hilo y se asociará a //EventoTiempo el manejador ImprimirReloj de la interfaz IEvento. public Item(IEvento imprimir, Reloj r) { //Creamos un delegado indicándole el nombre del método que correrá, luego creamos una instancia de //Thread indicandole el delegado que será ejecutado y por último damos inicio al proceso pero por //medio del hilo. (en un subproceso). this.reloj = r; this.hilo = new Thread(EjecutarReloj); this.EventoReloj += imprimir.ImprimirReloj; this.hilo.Start(); }
private void MapearAGrid(Reloj r) { if (r.Estado) { gridEquipos.CurrentRow.Cells["Estado"].Value = "Conectado"; } else { gridEquipos.CurrentRow.Cells["Estado"].Value = "Desconectado"; } }
//El método StartStopReloj invocará al método de la interfaz CargarReloj, //controlando la excepción que sea necesaria y mostrando el mensaje de error con un MessageBox. private void StartStopReloj(Reloj reloj) { try { IRelojes.CargarReloj(reloj); } catch (Exception e) { throw new SinEspacioException(e.Message); } }
void Awake() { if (instance == null) { instance = this; } else if (instance != this) { Destroy(gameObject); } DontDestroyOnLoad(gameObject); }
private void btDetener_Click(object sender, EventArgs e) { //Solicita al Reloj que se detenga Reloj.Stop(); //Habilitar botones de iniciar y de acciones btIniciar.Enabled = true; btAcciones.Enabled = true; txFrecuencia.Enabled = true; btDetener.Enabled = false; }
private void Principal_Load(object sender, EventArgs e) { // Permisos.SetPermissions(); //Basico.crear_archivo_properties(); //string _efact = Path.GetDirectoryName(Application.ExecutablePath).ToString() + "/Efact"; //MessageBox.Show(_efact); Reloj.Start(); menu = new Ventana(this); Basico._form_principal = this; //Config_Imp.GenerarTicketFact("",2); //Config_Imp.Mainimp(); }
public List <Reloj> GetAll() { List <Reloj> relojes = new List <Reloj>(); IDataReader dr = null; try { query = "SELECT Clave, DNS, IdReloj, IP, Nombre, Puerto, Numero, Rutina, IdFormato FROM Relojes;"; dr = FactoryConnection.Instancia.GetReader(query, FactoryConnection.Instancia.GetConnection()); while (dr.Read()) { Reloj r = new Reloj(); r.Id = Convert.ToInt32(dr["IdReloj"]); r.Nombre = dr["Nombre"].ToString(); r.Numero = Convert.ToInt32(dr["Numero"]); r.IP = dr["IP"].ToString(); r.Puerto = Convert.ToInt32(dr["Puerto"]); r.DNS = dr.IsDBNull(dr.GetOrdinal("DNS")) ? string.Empty : dr["DNS"].ToString(); r.Clave = dr.IsDBNull(dr.GetOrdinal("Clave")) ? string.Empty : dr["Clave"].ToString(); r.Rutina = Convert.ToBoolean(dr["Rutina"]); r.Formato = new DataFormatos().GetById(Convert.ToInt32(dr["IdFormato"])); relojes.Add(r); } } catch (AppException appex) { throw appex; } catch (DbException dbex) { throw new AppException("Error al consultar datos de los relojes", "Error", dbex); } catch (Exception ex) { throw new AppException("Error desconocido al consultar datos de los relojes", "Fatal", ex); } finally { try { if (dr != null) { dr.Close(); } FactoryConnection.Instancia.ReleaseConn(); } catch (Exception ex) { throw ex; } } return(relojes); }
private void CompartirButton_Click(object sender, EventArgs e) { if (CompartirButton.ButtonText.StartsWith("Transmitir")) { Reloj.Start(); CompartirButton.ButtonText = "Dejar de Transmitir"; } else { Reloj.Stop(); CompartirButton.ButtonText = "Transmitir Pantalla"; } }
private void linkEdit_Click(object sender, EventArgs e) { try { relojAct = MapearDeGrid(); EditReloj er = new EditReloj(); er.MapearAFormulario(relojAct); er.Show(); } catch (Exception ex) { base.InformarError(ex.Message, "Modificar Equipos."); } }
private void pasoLlegadaReloj() { //Llega un reloj, lo creo y agrego a la lista Reloj relojNuevo = new Reloj(idReloj, tiempo); idReloj++; listaRelojes.Add(relojNuevo); //Cuando llegara el proximo? rndLlegadaReloj = randomGenerator.generarRandom(); demoraProxLlegada = randomGenerator.generarTiempoExponencial(rndLlegadaReloj, mediaExponencial); proxLlegada = tiempo + demoraProxLlegada; //Hay algun operario libre? Sino aumentamos la cola bool libre = false; if ((op1.estado == "Libre") || (op2.estado == "Libre") || (op3.estado == "Libre")) { libre = true; } if (libre == true) { if (op1.estado == "Libre") { inicioControl(relojNuevo, op1); } else { if (op2.estado == "Libre") { inicioControl(relojNuevo, op2); } else { if (op3.estado == "Libre") { inicioControl(relojNuevo, op3); } } } } else { cola = cola + 1; } }
public int AgregarHuella(Empleado emp, Reloj reloj) { /*Recibo todos los legajos seleccionados en el dgv junto con el reloj. * Por cada legajo obtengo una list con todas las huellas que tenga en el equipo. * Por cada legajo, consulto el empid. --> El legajo existe SI O SI en la BD ya que anteriormente descargué y guardé los datos del equipo. * Por cada huella guardo el empid, template, fingerindex, largo de la huella. * */ dataTemplates = new DataTemplates(); int total = 0; try { reloj.LeerTodasLasHuellas(); List <Huella> huellas = new List <Huella>(); huellas = reloj.ObtenerHuella(emp); total = huellas.Count; foreach (Huella h in huellas) { if (IsSaftime()) { dataEmpleadoSaftime = new DataEmpleadoSaftime(); h.Empleado = dataEmpleadoSaftime.GetDataByLegajo(h.Empleado); } else { dataEmpleado = new DataEmpleado(); h.Empleado = dataEmpleado.GetDataByLegajo(h.Empleado); } if (!dataTemplates.Existe(h)) { dataTemplates.InsertarHuella(h); } else { dataTemplates.ActualizarHuella(h); } } } catch (AppException appex) { throw appex; } catch (Exception ex) { throw new AppException("Error no controlado durante la actualización de huellas", "Fatal", ex); } return(total); }
public void Disconnect(Reloj device) { try { device.Desconectar(); } catch (AppException appex) { throw appex; } catch (Exception ex) { throw new AppException("Error no controlado al intentar desconectar el dispositivo.", "Fatal", ex); } }
public void SincHora(Reloj device) { try { device.SincronizarHora(); } catch (AppException appex) { throw appex; } catch (Exception ex) { throw new AppException("Error no controlado al intentar sincronizar hora con el dispositivo.", "Fatal", ex); } }
private Reloj MapearDeGrid() { Reloj r = new Reloj(); int valor = 0; // Lo uso para los TryParse a int. if (int.TryParse(gridEquipos.CurrentRow.Cells["Id"].Value.ToString(), out valor)) { r.Id = valor; } else { throw new AppException("Error al intentar convertir Id a INT."); } return(equipos[equipos.IndexOf(r)]); }