private void btnLimpiar_Click(object sender, EventArgs e) { if (opcionelegida == 1) { txtApellido.Text = ""; txtCambioPlan.Text = ""; txtDireccion.Text = ""; txtDni.Text = ""; txtMail.Text = ""; txtNombre.Text = ""; txtTelefono.Text = ""; cmbEstadoCivil.SelectedItem = cmbEstadoCivil.Items[0]; cmbPlan.SelectedItem = cmbPlan.Items[0]; cmbSexo.SelectedItem = cmbSexo.Items[0]; dtpFecha.Value = ConfigTime.getFechaSinHora(); } else if (opcionelegida == 3 || opcionelegida == 4) { txtApellido.Text = ""; txtCambioPlan.Text = ""; txtDireccion.Text = ""; txtDni.Text = ""; txtMail.Text = ""; txtNombre.Text = ""; txtTelefono.Text = ""; cmbEstadoCivil.SelectedItem = cmbEstadoCivil.Items[0]; cmbSexo.SelectedItem = cmbSexo.Items[0]; dtpFecha.Value = ConfigTime.getFechaSinHora(); } }
public Main(Usuario us, Rol ro) { InitializeComponent(); i = 0; usuario = us; rol = ro; DateTime f = ConfigTime.getFecha(); }
private void dgvMedicoXEspecialidad_DoubleClick(object sender, EventArgs e) { //CON ESTE MEDICO X ESP ID HAY QUE LOS TURNOS QUE TIENE EL AFILIADO QUE VOY A SELECCIONAR DESPUES if (dgvMedicoXEspecialidad.SelectedRows.Count == 1) { if (dateTimePicker1.Value >= ConfigTime.getFechaSinHora()) { DataGridViewRow row = dgvMedicoXEspecialidad.SelectedRows[0]; medxespid = row.Cells[0].Value.ToString(); fecha = dateTimePicker1.Value; this.Width = 1030; Dictionary <string, object> parametros = new Dictionary <string, object>() { { "@medxespid", medxespid }, { "@fecha", fecha }, }; //******************************** List <Turno> listaTurnos = new List <Turno>(); listaTurnos = ConexionesDB.ExecuteReader("Get_Turnos_Prof_ReservadosTodos", parametros).ToTurno(); dgvTurnos.DataSource = listaTurnos; dgvTurnos.Columns.Clear(); dgvTurnos.AutoGenerateColumns = false; dgvTurnos.Columns.Add(new DataGridViewTextBoxColumn() { DataPropertyName = "Id", HeaderText = "Codigo", Width = 128, ReadOnly = true }); dgvTurnos.Columns.Add(new DataGridViewTextBoxColumn() { DataPropertyName = "Afiliado", HeaderText = "Nro Afiliado", Width = 128, ReadOnly = true }); dgvTurnos.Columns.Add(new DataGridViewTextBoxColumn() { DataPropertyName = "Fecha", HeaderText = "Fecha", Width = 128, ReadOnly = true }); //******************************** } else { MessageBox.Show("Debe ingresar una fecha igual o posterior al dia de hoy", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } } }
private void dgvTurnos_DoubleClick(object sender, EventArgs e) { if (dgvTurnos.SelectedRows.Count == 1) { txtNroAfiliado.Enabled = false; DataGridViewRow row = dgvTurnos.SelectedRows[0]; DateTime fecha = ConfigTime.getFechaSinHora(); Turno t = (Turno)row.DataBoundItem; int horas = ConfigTime.getFecha().Hour; int minutos = ConfigTime.getFecha().Minute; int segundos = ConfigTime.getFecha().Second; DateTime fechaactual = ConfigTime.getFechaSinHora().AddHours(horas).AddMinutes(minutos).AddSeconds(segundos); Dictionary <string, object> parametros = new Dictionary <string, object>() { { "@nroafiliado", t.Afiliado } }; List <Bono> lista = new List <Bono>(); lista = ConexionesDB.ExecuteReader("Get_Bonos_Afiliado", parametros).ToBono(); //dgvTurnos.DataSource = listaTurnos; if (lista.Count != 0) { Dictionary <string, object> parametros2 = new Dictionary <string, object>() { { "@nroafiliado", t.Afiliado }, { "@nroturno", t.Id }, { "@fecha", fechaactual } }; try { ConexionesDB.ExecuteNonQuery("Registrar_Llegada", parametros2); MessageBox.Show("Se registro la llegada correctamente del horario: " + t.Fecha.ToString(), "Exito", MessageBoxButtons.OK, MessageBoxIcon.Information); } catch { MessageBox.Show("Hubo un problema al registrar la llegada, intente nuevamente", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } Hide(); Main acerrar = null; FormCollection fc = Application.OpenForms; foreach (Form frm in fc) { if (frm.Name == "Main") { acerrar = (Main)frm; } } if (acerrar != null) { acerrar.Show(); } } else { MessageBox.Show("No tenia bonos comprados, compre uno primero", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } } }
public frmRegistroResultado(Profesional pro) { //this.Width = InitializeComponent(); dtpFechaTurno.Value = ConfigTime.getFechaSinHora(); profesional = pro; label4.Visible = false; txtSintomas.Visible = false; label3.Visible = false; txtDiagnostico.Visible = false; }
private void dataGridView1_DoubleClick(object sender, EventArgs e) { if (dataGridView1.SelectedRows.Count == 1) { if (dtpFechaTurno.Value >= ConfigTime.getFechaSinHora()) { button1.Enabled = false; dataGridView1.Enabled = false; this.Width = 980; } else { MessageBox.Show("Debe ingresar una fecha igual o posterior al dia de hoy", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } } }
private void btnFiltrar_Click(object sender, EventArgs e) { if (dtpFecha.Value > ConfigTime.getFechaSinHora()) { Dictionary <string, object> parametros = new Dictionary <string, object>() { { "@nroafiliado", afiliado.NroAfiliado }, { "@fecha", dtpFecha.Value.Date } }; List <Turno> t = new List <Turno>(); t = ConexionesDB.ExecuteReader("Turnos_Afiliado", parametros).ToTurno(); dataGridView1.DataSource = t; //load_datagrid(); } else { MessageBox.Show("Debe ingresar una fecha mayor a la de hoy", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
public string CreateVerifyCode() { int codeLen = 4; if (codeLen == 0) { codeLen = Length; } string[] arr = CodeSerial.Split(','); string code = ""; int randValue = -1; Random rand = new Random(unchecked ((int)ConfigTime.Now().Ticks)); for (int i = 0; i < codeLen; i++) { randValue = rand.Next(0, arr.Length - 1); code += arr[randValue]; } return(code); }
private bool validarFechas() { DateTime fecha1 = monthCalendar1.SelectionStart; DateTime fecha2 = monthCalendar2.SelectionStart; if (fecha1.CompareTo(fecha2) >= 0) { MessageBox.Show("Fechas Incorrectas. Verifique que la fecha 1 es mayor a la fecha 2", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); return(false); } if (fecha1.CompareTo(ConfigTime.getFechaSinHora()) < 0) { MessageBox.Show("Fechas Incorrectas. Verifique que la fecha 1 es mayor al dia de hoy", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); return(false); } else { return(true); } }
private void boton_comprar_Click(object sender, EventArgs e) { try { int horas = ConfigTime.getFecha().Hour; int minutos = ConfigTime.getFecha().Minute; int segundos = ConfigTime.getFecha().Second; DateTime fechaactual = ConfigTime.getFechaSinHora().AddHours(horas).AddMinutes(minutos).AddSeconds(segundos); ConexionesDB.ExecuteReader("Comprar_Bono", new Dictionary <string, object> { { "@cantidad", cantidad }, { "@precio", precio }, { "@afiliado", afiliado.NroAfiliado }, { "@fecha", fechaactual }, { "@plan", afiliado.PlanUsuario } }); MessageBox.Show("Compra Registrada", "Ok", MessageBoxButtons.OK, MessageBoxIcon.Information); } catch { MessageBox.Show("Hubo un error al acceder a la base de datos, intente nuevamente", "Intente nuevamente", MessageBoxButtons.OK, MessageBoxIcon.Information); return; } Hide(); Main acerrar = null; FormCollection fc = Application.OpenForms; foreach (Form frm in fc) { if (frm.Name == "Main") { acerrar = (Main)frm; } } if (acerrar != null) { acerrar.Show(); } }
private void btnCancelarTurno_Click(object sender, EventArgs e) { if (comboBox1.Text != string.Empty && textBox1.Text != string.Empty) { if (dtpFecha.Value > ConfigTime.getFechaSinHora()) { if (dataGridView1.SelectedRows.Count == 1) { DataGridViewRow r = new DataGridViewRow(); r = dataGridView1.SelectedRows[0]; Turno turno = (Turno)r.DataBoundItem; Dictionary <string, object> parametros = new Dictionary <string, object>() { { "@nroturno", turno.Id }, { "@nroafiliado", afiliado.NroAfiliado }, { "@fecha", dtpFecha.Value.Date }, { "@motivo", textBox1.Text }, { "@tipo", comboBox1.Text } }; List <Turno> t = new List <Turno>(); try { t = ConexionesDB.ExecuteReader("Cancelar_Turno_Afiliado", parametros).ToTurno(); //dataGridView1.DataSource = t; } catch { MessageBox.Show("Error al cancelar el turno, intente nuevamente", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } } else { MessageBox.Show("Debe seleccionar 1 fila", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } } else { MessageBox.Show("Debe ingresar una fecha mayor a la de hoy", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } } else { MessageBox.Show("Debe completar todos los campos", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } MessageBox.Show("Se cancelo el turno con exito", "Cancelado", MessageBoxButtons.OK, MessageBoxIcon.Information); Hide(); Main amostrar = null; FormCollection fc = Application.OpenForms; foreach (Form frm in fc) { if (frm.Name == "Main") { amostrar = (Main)frm; } } if (amostrar != null) { amostrar.Show(); } }
private void frmCancelarAtencionAfiliado_Load(object sender, EventArgs e) { dtpFecha.Value = ConfigTime.getFechaSinHora().AddDays(1); load_datagrid(); }
public frmLlegadaPaciente() { InitializeComponent(); dateTimePicker1.Value = ConfigTime.getFechaSinHora(); }
private void btnCancelar_Click(object sender, EventArgs e) { if (textBox1.Text != string.Empty && cmbTipoCancelacion.Text != string.Empty) { if (chk_fecha.Checked == true) { if (chk_horario.Checked == true) { if (hora1.Text != string.Empty && hora2.Text != string.Empty && minuto1.Text != string.Empty && minuto2.Text != string.Empty) { /*QUIERE CANCELAR UN RANGO*/ int horain, horafi, minin, minfi; if (int.TryParse(hora1.Text, out horain) && int.TryParse(hora2.Text, out horafi) && int.TryParse(minuto1.Text, out minin) && int.TryParse(minuto2.Text, out minfi)) { if (horain < 24 && horain >= 0 && horafi < 24 && horafi >= 0 && minin < 60 && minin >= 0 && minfi < 60 && minfi >= 0) { DateTime d = ((Fecha)drop_fecha.SelectedItem).DiaMesAnio; DateTime dInicio = new DateTime(DateTime.Parse(ConfigurationManager.AppSettings["fecha"]).Year, 1, 1, Int32.Parse(hora1.Text), Int32.Parse(minuto1.Text), 0); TimeSpan tInicio = dInicio.TimeOfDay; DateTime dFin = new DateTime(DateTime.Parse(ConfigurationManager.AppSettings["fecha"]).Year, 1, 1, Int32.Parse(hora2.Text), Int32.Parse(minuto2.Text), 0); TimeSpan tFin = dFin.TimeOfDay; Dictionary <string, object> parametros = new Dictionary <string, object>() { { "@motivo", textBox1.Text }, { "@tipo", cmbTipoCancelacion.Text.Substring(0, 1) }, { "@matricula", profesional.Matricula }, { "@fecha", d }, { "@horain", tInicio }, { "@horafin", tFin } }; try { ConexionesDB.ExecuteNonQuery("Cancelar_Turnos_ProfxFranja", parametros); } catch { MessageBox.Show("Error al cancelar el turno, intente nuevamente", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } } else { MessageBox.Show("Error en los horarios ingresadas", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } } else { MessageBox.Show("Debe ingresar horarios validos numericos. Intente nuevamente", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } } else { MessageBox.Show("Debe completar todos los campos", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } } else { /*QUIERE CANCELAR TODO EL DIA*/ DateTime d = ((Fecha)drop_fecha.SelectedItem).DiaMesAnio; DateTime dInicio = new DateTime(ConfigTime.getFechaSinHora().Year, 1, 1, 0, 0, 0); TimeSpan tInicio = dInicio.TimeOfDay; DateTime dFin = new DateTime(ConfigTime.getFechaSinHora().Year, 1, 1, 23, 59, 0); TimeSpan tFin = dFin.TimeOfDay; Dictionary <string, object> parametros = new Dictionary <string, object>() { { "@motivo", textBox1.Text }, { "@tipo", cmbTipoCancelacion.Text.Substring(0, 1) }, { "@matricula", profesional.Matricula }, { "@fecha", d }, { "@horain", tInicio }, { "@horafin", tFin } }; try { ConexionesDB.ExecuteNonQuery("Cancelar_Turnos_ProfxFranja", parametros); } catch { MessageBox.Show("Error al cancelar el turno, intente nuevamente", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } } } else { //*QUIERE CANCELAR RANGO DIAS*/ if (chk_dias.Checked == true) { DateTime dia_desde = monthCalendar1.SelectionStart; DateTime dia_hasta = monthCalendar2.SelectionStart; if (dia_desde >= DateTime.Today && dia_desde < dia_hasta) { Dictionary <string, object> parametros = new Dictionary <string, object>() { { "@motivo", textBox1.Text }, { "@tipo", cmbTipoCancelacion.Text.Substring(0, 1) }, { "@matricula", profesional.Matricula }, { "@fecha_desde", dia_desde }, { "@fecha_hasta", dia_hasta } }; try { ConexionesDB.ExecuteNonQuery("Cancelar_Turnos_Varios_Dias", parametros); } catch { MessageBox.Show("Error al cancelar el turno, intente nuevamente", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } } else { MessageBox.Show("La fecha inicial tiene que ser mayor a la fecha final y posterior al dia de hoy", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } } else { MessageBox.Show("Debe elegir una opcion", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } } } else { MessageBox.Show("Debe completar todos los campos", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } MessageBox.Show("Se han cancelado los turnos con exito", "Cancelado", MessageBoxButtons.OK, MessageBoxIcon.Information); Hide(); Main amostrar = null; FormCollection fc = Application.OpenForms; foreach (Form frm in fc) { if (frm.Name == "Main") { amostrar = (Main)frm; } } if (amostrar != null) { amostrar.Show(); } }