Beispiel #1
0
        public List <historial> buscar(int cliente)
        {
            List <historial> list = new List <historial>();

            try
            {
                if (con == null)
                {
                    con = new conexion();
                }
                con.conectar();
                SqlCommand cmd = new SqlCommand("_sp_BuscardetalleCita", con.cnxn);
                cmd.CommandType = CommandType.StoredProcedure;
                cmd.Parameters.AddWithValue("@cliente", cliente);
                SqlDataReader dr = cmd.ExecuteReader();
                if (dr.HasRows)
                {
                    while (dr.Read())
                    {
                        historial h = new historial();
                        h.idCliente = dr.GetInt32(0);
                        DateTime?f = (Convert.IsDBNull(dr["fecha"]) ? null : (DateTime?)Convert.ToDateTime(dr["fecha"]));
                        h.fecha       = f;
                        h.observacion = (dr["observacion"].Equals(null) ? null : dr["observacion"].ToString().Trim(new char[] { ' ' }));
                        // confirmador = dr.GetString(4).Trim(new char[] { ' ' });

                        h.veces        = (Convert.IsDBNull(dr["veces"]) ? null : (int?)Convert.ToInt32(dr["veces"]));
                        h.hora         = (dr["hora"].Equals(null) ? null : dr["hora"].ToString().Trim(new char[] { ' ' }));
                        h.teleoperador = (dr["teleoperador"].Equals(null) ? null : dr["teleoperador"].ToString().Trim(new char[] { ' ' }));
                        list.Add(h);
                    }
                    con.desconectar();
                }
                return(list);
            }

            catch
            {
                con.desconectar();
                return(list);
            }
        }
Beispiel #2
0
        private void MetroWindow_Loaded(object sender, RoutedEventArgs e)
        {
            /* txtConfirmador.ItemsSource = llenarCombo();
             * txtConfirmador.DisplayMemberPath = "Value";
             * txtConfirmador.SelectedValuePath = "Key";*/
            txtTeleOperador.ItemsSource       = llenarComboTO();
            txtTeleOperador.DisplayMemberPath = "Value";
            txtTeleOperador.SelectedValuePath = "Key";
            if (subStatus != null)
            {
                this.Title = Title + " " + subStatus.descripcion + " | " + cli.nombre + " " + cli.apellido;
                txtobservacion.Focus();
                switch (subStatus.idSubStatus)
                {
                case 1:
                    txtobservacion.IsEnabled = true;
                    dpFechaNac.IsEnabled     = true;
                    hora.IsEnabled           = true;
                    min.IsEnabled            = true;
                    // txtConfirmador.IsEnabled = true;
                    txtVeces.IsEnabled = false;
                    break;

                case 2:
                    txtobservacion.IsEnabled = true;
                    dpFechaNac.IsEnabled     = false;
                    hora.IsEnabled           = false;
                    min.IsEnabled            = false;
                    //txtConfirmador.IsEnabled = true;
                    txtVeces.IsEnabled = true;
                    break;

                case 3:
                    txtobservacion.IsEnabled = true;
                    dpFechaNac.IsEnabled     = false;
                    hora.IsEnabled           = false;
                    min.IsEnabled            = false;
                    //txtConfirmador.IsEnabled = true;
                    txtVeces.IsEnabled = false;
                    break;

                case 4:
                    txtobservacion.IsEnabled = true;
                    dpFechaNac.IsEnabled     = true;
                    hora.IsEnabled           = true;
                    min.IsEnabled            = true;
                    //txtConfirmador.IsEnabled = true;
                    txtVeces.IsEnabled = false;
                    break;

                case 5:
                    txtobservacion.IsEnabled = true;
                    dpFechaNac.IsEnabled     = false;
                    hora.IsEnabled           = false;
                    min.IsEnabled            = false;
                    //txtConfirmador.IsEnabled = true;
                    txtVeces.IsEnabled = false;
                    break;

                default:
                    txtobservacion.IsEnabled = true;
                    dpFechaNac.IsEnabled     = false;
                    hora.IsEnabled           = false;
                    min.IsEnabled            = false;
                    //txtConfirmador.IsEnabled = true;
                    txtVeces.IsEnabled = false;
                    break;
                }
            }
            else
            {
                this.Title = Title + " " + subStt.descripcion + " | " + cli.nombre + " " + cli.apellido;
                if (subStt.id_status == 11)
                {
                    txtobservacion.IsEnabled = true;
                    dpFechaNac.IsEnabled     = true;
                    hora.IsEnabled           = true;
                    min.IsEnabled            = true;
                    //txtConfirmador.IsEnabled = false;
                    txtVeces.IsEnabled = false;
                }
                if (subStt.id_status == 12)
                {
                    txtobservacion.IsEnabled = true;
                    dpFechaNac.IsEnabled     = true;
                    hora.IsEnabled           = false;
                    min.IsEnabled            = false;
                    // txtConfirmador.IsEnabled = false;
                    txtVeces.IsEnabled = true;
                }
                if (subStt.id_status == 2)
                {
                    txtobservacion.IsEnabled = true;
                    dpFechaNac.IsEnabled     = true;
                    hora.IsEnabled           = true;
                    min.IsEnabled            = true;
                    //txtConfirmador.IsEnabled = true;
                    txtVeces.IsEnabled = false;
                }
                if (subStt.id_status != 12 && subStt.id_status != 12 && subStt.id_status != 11 && subStt.id_status != 2)
                {
                    txtobservacion.IsEnabled = true;
                    dpFechaNac.IsEnabled     = false;
                    hora.IsEnabled           = false;
                    min.IsEnabled            = false;
                    //txtConfirmador.IsEnabled = true;
                    txtVeces.IsEnabled = false;
                }
            }
            Clases.historial his = new Clases.historial();
            dtgrdetalle.ItemsSource = his.buscar(cli.id_cliente);
        }