예제 #1
0
        public bool Listar(ref strTATCitas[] ARR, DateTime FechaInicio, strTATCitas str)
        {
            DB.conexionBD();

            DB.COM1.Connection = DB.objConexion;
            DB.objConexion.Open();
            int Cuantos = 0;

            DB.COM1.CommandText = "Select count(*) from dbo.visCitasPorFecha where FechaCita <  dateadd(second, 60 ,@FechaInicio) and FechaCita> @FechaInicio and ELIMINADO = 0 AND nombreCliente like '%' + '" + str.nombreCliente + "' + '%'";
            SqlParameter SQP2 = new SqlParameter("@FechaInicio", FechaInicio);

            SQP2.SqlDbType = SqlDbType.DateTime;
            DB.COM1.Parameters.Add(SQP2);
            Cuantos             = (int)DB.COM1.ExecuteScalar();
            DB.COM1.CommandText = "Select * from dbo.visCitasPorFecha  where FechaCita <  dateadd(second, 60 ,@FechaInicio) and FechaCita> @FechaInicio and ELIMINADO = 0  and nombreCliente like  '%' + '" + str.nombreCliente + "' + '%' ORDER BY FechaCita asc";

            try
            {
                DB.REG1 = DB.COM1.ExecuteReader();
                int i = 0;
                ARR = new strTATCitas[Cuantos];

                while (DB.REG1.Read())
                {
                    ARR[i]                  = new strTATCitas();
                    ARR[i].idCita           = (int)DB.REG1["idCita"];
                    ARR[i].idCliente        = (int)DB.REG1["idCliente"];
                    ARR[i].FechaCita        = (DateTime)DB.REG1["FechaCita"];
                    ARR[i].idEstadoCita     = (int)DB.REG1["idEstadoCita"];
                    ARR[i].Firma            = (string)DB.REG1["Firma"];
                    ARR[i].idTamaño         = (int)DB.REG1["idTamaño"];
                    ARR[i].Costo            = Convert.ToDouble(DB.REG1["Costo"]);
                    ARR[i].Anticipo         = Convert.ToDouble(DB.REG1["Anticipo"]);
                    ARR[i].ZonaCuerpo       = (string)DB.REG1["ZonaCuerpo"];
                    ARR[i].Descripcion      = (string)DB.REG1["Descripcion"];
                    ARR[i].USUARIO          = (string)DB.REG1["USUARIO"];
                    ARR[i].ELIMINADO        = (bool)DB.REG1["ELIMINADO"];
                    ARR[i].NumeroSesion     = (int)DB.REG1["NumeroSesion"];
                    ARR[i].nombreCliente    = (string)DB.REG1["nombreCliente"];
                    ARR[i].Tamaño           = (string)DB.REG1["Tamaño"];
                    ARR[i].NombreEstadoCita = (string)DB.REG1["NombreEstadoCita"];
                    ARR[i].Telefono         = (string)DB.REG1["Telefono"];
                    ARR[i].EstadoCorreo     = (bool)DB.REG1["EstadoCorreo"];
                    ARR[i].Correo           = (string)DB.REG1["Correo"];
                    i++;
                }
                DB.REG1.Close();
                DB.objConexion.Close();
                DB.COM1.Parameters.Clear();
                return(true);
            }
            catch (Exception e)
            {
                DB.objConexion.Close();
                DB.REG1.Close();
                DB.COM1.Parameters.Clear();
                return(false);
            }
        }
예제 #2
0
        public bool Listar(ref strTATCitas[] ARR, DateTime Fecha)
        {
            DB.conexionBD();

            DB.COM1.Connection = DB.objConexion;
            DB.objConexion.Open();
            int Cuantos = 0;

            DB.COM1.CommandText = "select  count(*) from (Select idCita from dbo.visCitasPorFecha where CAST(FechaRegistro AS DATE) = CAST(@Fecha AS DATE) and ELIMINADO = 0 AND Aprobado = 0 group by idCita,Anticipo,FechaRegistro,nombreCliente,nombreEmpleado) as A";
            SqlParameter SQP2 = new SqlParameter("@Fecha", Fecha);

            SQP2.SqlDbType = SqlDbType.DateTime;
            DB.COM1.Parameters.Add(SQP2);
            Cuantos = (int)DB.COM1.ExecuteScalar();

            DB.COM1.CommandText = "Select idCita,Anticipo,nombreCliente,nombreEmpleado,FechaRegistro from dbo.visCitasPorFecha where CAST(FechaRegistro AS DATE) = CAST(@Fecha AS DATE) and ELIMINADO = 0 AND Aprobado = 0 group by idCita,Anticipo,FechaRegistro,nombreCliente,nombreEmpleado ORDER BY FechaRegistro asc";

            try
            {
                DB.REG1 = DB.COM1.ExecuteReader();
                int i = 0;
                ARR = new strTATCitas[Cuantos];

                while (DB.REG1.Read())
                {
                    ARR[i]                = new strTATCitas();
                    ARR[i].idCita         = (int)DB.REG1["idCita"];
                    ARR[i].Anticipo       = Convert.ToDouble(DB.REG1["Anticipo"]);
                    ARR[i].nombreCliente  = (string)DB.REG1["nombreCliente"];
                    ARR[i].NombreEmpleado = (string)DB.REG1["NombreEmpleado"];
                    ARR[i].FechaRegistro  = (DateTime)DB.REG1["FechaRegistro"];
                    i++;
                }
                DB.REG1.Close();
                DB.objConexion.Close();
                DB.COM1.Parameters.Clear();
                return(true);
            }
            catch (Exception e)
            {
                DB.objConexion.Close();
                DB.REG1.Close();
                DB.COM1.Parameters.Clear();
                return(false);
            }
        }
예제 #3
0
        public bool DAO(ref strTATCitas str, int Instruccion, DataTable dtInventario, DataTable dtFechaCitas, DataTable dtImgTatto)
        {
            DB.conexionBD();

            DB.COM1.CommandText = "spCitasDET";
            DB.COM1.CommandType = CommandType.StoredProcedure;

            DB.COM1.Connection = DB.objConexion;
            DB.objConexion.Open();

            try
            {
                DB.COM1.Parameters.AddWithValue("ACCION", Instruccion);
                DB.COM1.Parameters.AddWithValue("idCita", str.idCita);
                DB.COM1.Parameters.AddWithValue("idCliente", str.idCliente);
                DB.COM1.Parameters.AddWithValue("idEstadoCita", str.idEstadoCita);
                DB.COM1.Parameters.AddWithValue("idTamaño", str.idTamaño);
                DB.COM1.Parameters.AddWithValue("Firma", str.Firma);
                DB.COM1.Parameters.AddWithValue("Costo", str.Costo);
                DB.COM1.Parameters.AddWithValue("Anticipo", str.Anticipo);
                DB.COM1.Parameters.AddWithValue("ZonaCuerpo", str.ZonaCuerpo);
                DB.COM1.Parameters.AddWithValue("Descripcion", str.Descripcion);
                DB.COM1.Parameters.AddWithValue("EstadoCorreo", str.EstadoCorreo);
                DB.COM1.Parameters.AddWithValue("USUARIO", str.USUARIO);
                DB.COM1.Parameters.AddWithValue("FECHAHORACAMBIO", DateTime.Now);
                DB.COM1.Parameters.AddWithValue("ELIMINADO", str.ELIMINADO);
                DB.COM1.Parameters.AddWithValue("FechaRegistro", str.FechaRegistro);
                DB.COM1.Parameters.AddWithValue("tblCitasInventario", dtInventario);
                DB.COM1.Parameters.AddWithValue("tblImagenesTattoo", dtImgTatto);
                DB.COM1.Parameters.AddWithValue("tblSesionesCitas", dtFechaCitas);

                DB.REG1 = DB.COM1.ExecuteReader();

                if (DB.REG1.HasRows)
                {
                    DB.REG1.Read();
                    str.idCita           = (int)DB.REG1["idCita"];
                    str.idCliente        = (int)DB.REG1["idCliente"];
                    str.idEstadoCita     = (int)DB.REG1["idEstadoCita"];
                    str.idTamaño         = (int)DB.REG1["idTamaño"];
                    str.Costo            = Convert.ToDouble(DB.REG1["Costo"]);
                    str.Anticipo         = Convert.ToDouble(DB.REG1["Anticipo"]);
                    str.ZonaCuerpo       = (string)DB.REG1["ZonaCuerpo"];
                    str.Descripcion      = (string)DB.REG1["Descripcion"];
                    str.USUARIO          = (string)DB.REG1["USUARIO"];
                    str.FECHAHORACAMBIO  = (DateTime)DB.REG1["FECHAHORACAMBIO"];
                    str.ELIMINADO        = (bool)DB.REG1["ELIMINADO"];
                    str.nombreCliente    = (string)DB.REG1["nombreCliente"];
                    str.Tamaño           = (string)DB.REG1["Tamaño"];
                    str.NombreEstadoCita = (string)DB.REG1["NombreEstadoCita"];
                    str.Telefono         = (string)DB.REG1["Telefono"];
                }
                return(true);
            }
            catch (Exception e)
            {
                return(false);
            }
            finally
            {
                DB.REG1.Close();
                DB.objConexion.Close();
                DB.COM1.Parameters.Clear();
                DB.COM1.CommandType = CommandType.Text;
            }
        }