Beispiel #1
0
        public DataSet ListarTurnobyCodigo(int turno)
        {
            IDbConnection conn = DBComon.Conexion();

            conn.Open();

            DataSet   dataSet = null;
            TurnoDST  turnos  = new TurnoDST();
            DataTable dt      = new DataTable();

            SqlCommand Command = new SqlCommand("SELECT T.ID, (SELECT C.MODULO FROM COLA C WHERE C.COD_COLA = T.COD_COLA) MODULO," +
                                                "(SELECT N.NOMBRE FROM CLIENTE N WHERE N.COD_CLI = T.COD_CE) NOMBRE, T.FECHA," +
                                                "(SELECT E.ESTADO FROM CRITERIOS_ESTADO E WHERE E.COD_CE = T.COD_CE) ESTADO" +
                                                "FROM TURNO T WHERE t.COD_CE in ('1', '2') and T.ID =" + turno + "'", conn as SqlConnection);

            Command.CommandType = CommandType.Text;
            SqlDataAdapter da = new SqlDataAdapter(Command);

            dataSet = new DataSet();
            da.Fill(dataSet, "Turno");

            conn.Close();

            return(dataSet);
        }
Beispiel #2
0
        public List <TurnoDST> ListarTurnos()
        {
            IDbConnection conn = DBComon.Conexion();

            conn.Open();

            SqlCommand Command = new SqlCommand("SELECT T.ID, (SELECT C.MODULO FROM COLA C WHERE C.COD_COLA = T.COD_COLA) MODULO," +
                                                "(SELECT N.NOMBRE FROM CLIENTE N WHERE N.COD_CLI = T.COD_CE) NOMBRE, T.FECHA," +
                                                "(SELECT E.ESTADO FROM CRITERIOS_ESTADO E WHERE E.COD_CE = T.COD_CE) ESTADO" +
                                                "FROM TURNO T WHERE t.COD_CE in ('1', '2')", conn as SqlConnection);

            Command.CommandType = CommandType.Text;
            IDataReader     reader = Command.ExecuteReader();
            List <TurnoDST> lista  = new List <TurnoDST>();

            while (reader.Read())
            {
                TurnoDST turno = new TurnoDST();
                turno.Id       = reader.GetInt32(0);
                turno.Cod_cli  = reader.GetInt32(1);
                turno.Cod_cola = reader.GetInt32(2);
                turno.Fecha    = reader.GetDateTime(3);
                turno.Cod_ce   = reader.GetInt32(4);

                lista.Add(turno);
            }

            conn.Close();
            return(lista);
        }
Beispiel #3
0
        public int DeleteTurno(TurnoDST dsTurno)
        {
            IDbConnection conn = DBComon.Conexion();

            conn.Open();

            SqlCommand Command = new SqlCommand("delete TURNO where id = @id", conn as SqlConnection);

            Command.CommandType = CommandType.Text;
            Command.Parameters.Add(new SqlParameter("@id", dsTurno.Id));

            int resultado = Command.ExecuteNonQuery();

            conn.Close();
            return(resultado);
        }
Beispiel #4
0
        public int updateTurnobyEstado(TurnoDST dsTurno)
        {
            IDbConnection conn = DBComon.Conexion();

            conn.Open();
            SqlCommand Command = new SqlCommand("UPDATE TURNO SET COD_CE = @Cod_ce  WHERE id = @id", conn as SqlConnection);

            Command.CommandType = CommandType.Text;

            Command.Parameters.Add(new SqlParameter("@id", dsTurno.Id));
            Command.Parameters.Add(new SqlParameter("@cod_ce", dsTurno.Cod_ce));

            int resultado = Command.ExecuteNonQuery();

            conn.Close();
            return(resultado);
        }
Beispiel #5
0
        public void insertTurno(TurnoDST dsTurno)
        {
            IDbConnection conn = DBComon.Conexion();

            conn.Open();
            SqlCommand Command = new SqlCommand("INSERT INTO TURNO ( COD_CLI, COD_COLA, FECHA, COD_CE) " +
                                                " VALUES ( @cod_cli, @cod_cola, @fecha, @cod_ce)", conn as SqlConnection);

            Command.CommandType = CommandType.Text;

            Command.Parameters.AddWithValue("cod_cli", dsTurno.Cod_cli);
            Command.Parameters.AddWithValue("cod_cola", dsTurno.Cod_cola);
            Command.Parameters.AddWithValue("fecha", dsTurno.Fecha);
            Command.Parameters.AddWithValue("cod_ce", dsTurno.Cod_ce);

            Command.ExecuteNonQuery();
            conn.Close();
        }
Beispiel #6
0
        public void GuardarModificarCliente()
        {
            string   turno  = lblCodigo.Text.ToString();
            TurnoDST turnod = new TurnoDST();

            if (turno == "")
            {
                turnod.Cod_cola = Convert.ToInt32(cmbModulo.Value.ToString());
                turnod.Cod_cli  = Convert.ToInt32(cmbNombre.Text.ToString());
                turnod.Fecha    = Convert.ToDateTime(dateFecha.Date);
                turnod.Cod_ce   = Convert.ToInt32(cmbEstado.Value.ToString());

                dsTur.InsertTurno(turnod);
                lblError1.Text = "Turno Guardado";
            }
            else
            {
                lblError1.Text = "Consulte con su proveedor";
            }
        }
Beispiel #7
0
 public int Eliminarturno(TurnoDST dsTurno)
 {
     return(new TurnosDALC().DeleteTurno(dsTurno));
 }
Beispiel #8
0
 public int updateTurnobyEstado(TurnoDST dsTurno)
 {
     return(new TurnosDALC().updateTurnobyEstado(dsTurno));
 }
Beispiel #9
0
        public void InsertTurno(TurnoDST dsTurno)
        {
            TurnosDALC turno = new TurnosDALC();

            turno.insertTurno(dsTurno);
        }