Exemplo n.º 1
0
        public fecha get_periodo()
        {
            fecha fecha = new fecha();

            using (SqlConnection connection = DBConnection.getConnection())
            {
                SqlCommand command = new SqlCommand("dbo.get_periodo", connection);
                command.CommandType = CommandType.StoredProcedure;

                try
                {
                    connection.Open();
                    command.ExecuteNonQuery();
                    SqlDataReader reader = command.ExecuteReader();
                    while (reader.Read())
                    {
                        fecha = leerFecha(fecha, reader);
                    }
                    return(fecha);
                }
                catch (SqlException ex)
                {
                    Console.WriteLine(ex);
                    return(fecha);
                }
                finally { connection.Close(); }
            }
        }
 public ActionResult registroFecha(fecha objfecha)
 {
     if (ModelState.IsValid)
     {
         db.fecha.Add(objfecha);
         db.SaveChanges();
         return(RedirectToAction("detalle"));
     }
     return(View(objfecha));
 }
Exemplo n.º 3
0
        private void dgvWorklist_SelectionChanged(object sender, EventArgs e)
        {
            try
            {
                if (((DataGridView)sender).SelectedRows.Count > 0)
                {
                    tbDNI.Text =
                        ((DataGridView)sender).SelectedRows[0].Cells["Patient ID"].Value.ToString();
                    tbNombre.Text =
                        ((DataGridView)sender).SelectedRows[0].Cells["Patient Name"].Value.ToString();

                    fecha birthdateValue = new fecha(((DataGridView)sender).SelectedRows[0].Cells["Patient BirthDate"].Value.ToString());
                    dtNacimiento.Value = new DateTime(birthdateValue.year, birthdateValue.month, birthdateValue.day);

                    if (((DataGridView)sender).SelectedRows[0].Cells["Patient Sex"].Value.ToString() == "M")
                    {
                        rbMasculino.Checked = true;
                    }
                    else if (((DataGridView)sender).SelectedRows[0].Cells["Patient Sex"].Value.ToString() == "F")
                    {
                        rbFemenino.Checked = true;
                    }
                    else
                    {
                        rbNSNC.Checked = true;
                    }

                    tbPeso.Text =
                        ((DataGridView)sender).SelectedRows[0].Cells["Patient Weight"].Value.ToString();
                    tbAccessionNumber.Text =
                        ((DataGridView)sender).SelectedRows[0].Cells["Accession Number"].Value.ToString();
                    tbModalidad.Text =
                        ((DataGridView)sender).SelectedRows[0].Cells["Modality"].Value.ToString();

                    System.Diagnostics.Debug.WriteLine(((DataGridView)sender).SelectedRows[0].Cells["Fecha"].Value.ToString());

                    fecha fechaStudy = new fecha(((DataGridView)sender).SelectedRows[0].Cells["Fecha"].Value.ToString());
                    dtFecha.Value = new DateTime(fechaStudy.year, fechaStudy.month, fechaStudy.day);

                    time studyTime = new time(((DataGridView)sender).SelectedRows[0].Cells["Time"].Value.ToString());
                    nHora.Value    = studyTime.hour;
                    nMinutos.Value = studyTime.minutes;

                    //tbMedico.Text =
                    //    ((DataGridView)sender).SelectedRows[0].Cells["Physician Reading Study"].Value.ToString();
                    tbReferente.Text =
                        ((DataGridView)sender).SelectedRows[0].Cells["Referring Physician"].Value.ToString();
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show("Ocurrió el siguiente error al copiar los datos del Worklist a los campos locales:\n" + ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
            }
        }
Exemplo n.º 4
0
        private fecha leerFecha(fecha pFecha, SqlDataReader reader)
        {
            try
            {
                pFecha.fecha_inicio = reader.GetString(0);
            }
            catch (System.Data.SqlTypes.SqlNullValueException ex)
            { }

            try
            {
                pFecha.fecha_final = reader.GetString(1);
            }
            catch (System.Data.SqlTypes.SqlNullValueException ex)
            { }
            return(pFecha);
        }
        public void setPeriodo(fecha pfecha)
        {
            using (SqlConnection connection = DBConnection.getConnection())
            {
                SqlCommand command = new SqlCommand("dbo.ingresar_periodo", connection);
                command.CommandType = CommandType.StoredProcedure;

                command.Parameters.AddWithValue("@fecha_inicio", SqlDbType.VarChar).Value = pfecha.fecha_inicio;
                command.Parameters.AddWithValue("@fecha_fin", SqlDbType.VarChar).Value    = pfecha.fecha_final;
                try
                {
                    connection.Open();
                    command.ExecuteNonQuery();
                }
                catch (SqlException ex)
                {
                    Console.WriteLine(ex);
                }
                finally { connection.Close(); }
            }
        }
Exemplo n.º 6
0
 Select Case Weekday(fecha)
     Case 1