コード例 #1
0
ファイル: Comprar.cs プロジェクト: rodrigomc1/gdd_migracion
 private void checkBoxRangoFecha_CheckedChanged(object sender, EventArgs e)
 {
     if (checkBoxRangoFecha.Checked)
     {
         dateTimePickerFechaDesde.Enabled      = true;
         dateTimePickerFechaHasta.Enabled      = true;
         dateTimePickerFechaDesde.Format       = DateTimePickerFormat.Custom;
         dateTimePickerFechaDesde.CustomFormat = "yyyy-MM-dd HH:mm";
         dateTimePickerFechaDesde.Value        = SystemDate.GetDate();
         dateTimePickerFechaHasta.Format       = DateTimePickerFormat.Custom;
         dateTimePickerFechaHasta.CustomFormat = "yyyy-MM-dd HH:mm";
         dateTimePickerFechaHasta.Value        = SystemDate.GetDate().AddDays(7);
     }
     else
     {
         dateTimePickerFechaDesde.Enabled      = false;
         dateTimePickerFechaHasta.Enabled      = false;
         dateTimePickerFechaDesde.Format       = DateTimePickerFormat.Custom;
         dateTimePickerFechaDesde.CustomFormat = " ";
         dateTimePickerFechaDesde.Value        = DateTime.Parse("1890-01-01 00:00");
         dateTimePickerFechaHasta.Format       = DateTimePickerFormat.Custom;
         dateTimePickerFechaHasta.CustomFormat = " ";
         dateTimePickerFechaHasta.Value        = DateTime.Parse("2500-01-01 00:00");
     }
 }
コード例 #2
0
        public void UpdatePublicacion(Publicacion publicacion)
        {
            String sp = "PLEASE_HELP.SP_UPDATE_PUBLICACION";

            SqlCommand cmd = new SqlCommand(sp);

            cmd.CommandType = CommandType.StoredProcedure;

            cmd.Parameters.AddWithValue("@codigoPublicacion", publicacion.Codigo);

            if (publicacion.Estado.Descripcion == "PUBLICADA")
            {
                cmd.Parameters.AddWithValue("@fechaInicio", SystemDate.GetDate());
            }
            else
            {
                cmd.Parameters.AddWithValue("@fechaInicio", DBNull.Value);
            }

            cmd.Parameters.AddWithValue("@fechaEvento", publicacion.FechaEvento);
            cmd.Parameters.AddWithValue("@descripcion", publicacion.Descripcion);
            cmd.Parameters.AddWithValue("@direccion", publicacion.Direccion);
            cmd.Parameters.AddWithValue("@rubroId", publicacion.Rubro.Id);
            cmd.Parameters.AddWithValue("@gradoId", publicacion.Grado.Id);

            cmd.Parameters.AddWithValue("@estadoId", publicacion.Estado.Id);

            Conexion.ExecuteProcedure(cmd);

            RepoUbicacion repoUbicacion = new RepoUbicacion();


            repoUbicacion.DeleteAndAddNewUbicaciones(publicacion.Codigo, publicacion.Ubicaciones);
        }
コード例 #3
0
        //Validaciones
        private Boolean FormDataOK()
        {
            int errorCount = 0;

            if (!checkBoxVariasFechas.Checked)
            {
                if (!(SystemDate.GetDate() < dateTimePickerFechaEvento.Value))
                {
                    errorMessage += "La Fecha de Evento debe ser posterior a la fecha actual.\n"; errorCount++;
                }
            }
            else
            {
                if (publicacionesList.Count == 0)
                {
                    errorMessage += "No hay Fechas de Evento ingresadas para la Publicación.\n"; errorCount++;
                }
            }

            if (String.IsNullOrEmpty(txtNombrePublicacion.Text.ToString()))
            {
                errorMessage += "El campo Nombre está vacio.\n"; errorCount++;
            }
            if (String.IsNullOrEmpty(txtDireccion.Text.ToString()))
            {
                errorMessage += "El campo Dirección está vacio.\n"; errorCount++;
            }
            if (publicacion.Ubicaciones.Count == 0)
            {
                errorMessage += "La Publicación no tiene Ubicaciones.\n"; errorCount++;
            }

            return(errorCount == 0);
        }
コード例 #4
0
        //Publicar un espectáculo
        private void btnPublicar_Click(object sender, EventArgs e)
        {
            //Verifica que la fecha de evento sea anterior a la fecha actual
            if (publicacionToEdit.FechaEvento <= SystemDate.GetDate())
            {
                MessageBox.Show("La Fecha del Evento a publicar es anterior a la fecha actual.", "Error");
                return;
            }

            DialogResult dialogResult = MessageBox.Show("¿Desea publicar el evento seleccionado?", "Publicar Evento", MessageBoxButtons.YesNo);

            if (dialogResult == DialogResult.Yes)
            {
                try
                {
                    repoPublicacion.CambiarEstadoPublicacion(publicacionToEdit, "PUBLICADA");
                    MessageBox.Show("El Evento ha sido publicado.", "Message");
                    RefreshDataGridViewPublicacion();
                }
                catch (Exception)
                {
                    MessageBox.Show(Messages.ERROR_INESPERADO, "Error");
                }
            }
        }
コード例 #5
0
        private Concert ConcertWithCurrentDateAndConcertDate(DateTime now, DateTime concertDate)
        {
            SystemDate systemDate = new SystemDate(new DateTime(2017, 12, 01));
            var        concert    = concertFactory.Create("a", "b", "c",
                                                          concertDate, systemDate);

            return(concert);
        }
コード例 #6
0
 private Concert CreateInternal(string titleGeo, string titleEng, string description, DateTime concertDate, ConcertId id = null, ISystemDate systemDate = null)
 {
     return(new Concert(
                id ?? new ConcertId(Guid.NewGuid().ToString()),
                new EventTitleSummary(new GeoTitle(titleGeo)).WithAnotherTitle(new EngTitle(titleEng)),
                new EventDescription(concertDate, description, systemDate ?? SystemDate.Now())
                ));
 }
コード例 #7
0
        public List <PublicacionDTO> GetPublicacionesByFilter(List <String> rubrosList, DateTime desde, DateTime hasta, String descripcion)
        {
            DataTable filteredTable = new DataTable();

            String     sp  = "PLEASE_HELP.SP_GET_PUBLICACIONES_ACTIVAS";
            SqlCommand cmd = new SqlCommand(sp);

            cmd.CommandType = CommandType.StoredProcedure;

            cmd.Parameters.AddWithValue("@fechaDesde", desde);
            cmd.Parameters.AddWithValue("@fechaHasta", hasta);
            cmd.Parameters.AddWithValue("@fechaActual", SystemDate.GetDate());

            if (!String.IsNullOrEmpty(descripcion))
            {
                cmd.Parameters.AddWithValue("@descripcion", descripcion);
            }


            DataTable sourceTable = Conexion.GetData(cmd);

            filteredTable = sourceTable.Clone();


            if (rubrosList.Count == 0)
            {
                return(FromRowsToPublicacionDTO(sourceTable));
            }
            else
            {
                String sqlWhere = String.Empty;

                String sqlOrder = "Pub_Comision DESC";

                foreach (String rubro in rubrosList)
                {
                    sqlWhere += "Pub_Rubro = '" + rubro + "' OR ";
                }

                sqlWhere = sqlWhere.Substring(0, sqlWhere.Length - 4);

                DataRow[] filteredRows = sourceTable.Select(sqlWhere, sqlOrder);

                //foreach (DataRow row in filteredRows)
                //{
                //    filteredTable.ImportRow(row);
                //}

                //filteredTable = filteredRows.CopyToDataTable();

                if (filteredRows.Any())
                {
                    filteredTable = filteredRows.CopyToDataTable();
                }

                return(FromRowsToPublicacionDTO(filteredTable));
            }
        }
コード例 #8
0
        public int GetPuntosClienteById(int?id)
        {
            String query = "SELECT COALESCE(SUM(Puntuacion_Cantidad), 0) as puntos FROM " + table
                           + " WHERE Puntuacion_Cliente = @Id AND Puntuacion_Fecha_Vencimiento > @fechaActual";
            SqlCommand command = new SqlCommand(query);

            command.Parameters.AddWithValue("@Id", id);
            command.Parameters.AddWithValue("@fechaActual", SystemDate.GetDate());
            return((int)Conexion.GetData(command).Rows[0]["puntos"]);
        }
コード例 #9
0
        public List <PublicacionDTO> GetPublicacionesActivas()
        {
            String     sp  = "PLEASE_HELP.SP_GET_PUBLICACIONES_ACTIVAS";
            SqlCommand cmd = new SqlCommand(sp);

            cmd.CommandType = CommandType.StoredProcedure;

            cmd.Parameters.AddWithValue("@fechaActual", SystemDate.GetDate());
            DataTable publicacionesTable = Conexion.GetData(cmd);

            return(FromRowsToPublicacionDTO(publicacionesTable));
        }
コード例 #10
0
        public FormGenerarPublicacion()
        {
            InitializeComponent();

            this.loginUser.id       = (int)UserSession.UserId;
            this.loginUser.username = UserSession.Username;

            publicacion.Ubicaciones = new List <Ubicacion>();

            LoadComboBox();

            dateTimePickerFechaEvento.Value = SystemDate.GetDate();
        }
コード例 #11
0
        public void ChangePointsToPremio(long?idUser, long idPremio)
        {
            String     sp  = "PLEASE_HELP.SP_CANJEAR_PUNTOS";
            SqlCommand cmd = new SqlCommand(sp);

            cmd.CommandType = CommandType.StoredProcedure;

            cmd.Parameters.AddWithValue("@idUser", idUser);
            cmd.Parameters.AddWithValue("@idPremio", idPremio);
            cmd.Parameters.AddWithValue("@fechaActual", SystemDate.GetDate());

            Conexion.ExecuteProcedure(cmd);
        }
コード例 #12
0
        public void UploadedImagesBucket_WithDatePlaceHolders_HasCurrentValues()
        {
            // Arrange
            AwsS3Config awsS3Config = new AwsS3Config();

            SystemDate.Set(new DateTime(2020, 03, 01));

            // Act
            string actal = awsS3Config.UploadedImagesBucket;

            // Assert
            string expected = "tinamous-debug-media-upload-2-2020-3-1";

            Assert.AreEqual(expected, actal);
        }
コード例 #13
0
        private void ClearAll()
        {
            txtNombrePublicacion.Clear();
            txtDireccion.Clear();

            dateTimePickerFechaEvento.Value = SystemDate.GetDate().AddDays(7);

            checkBoxVariasFechas.Checked = false;

            publicacionesList = new List <Publicacion>();

            publicacion.Ubicaciones = new List <Ubicacion>();

            txtStock.Clear();
        }
コード例 #14
0
        private Boolean CheckDatesOK()
        {
            int errorCount = 0;

            if (dateTimePickerFechaEvento.Value <= SystemDate.GetDate())
            {
                errorMessage += "La Fecha de Evento no puede igual o menor a la fecha actual.\n"; errorCount++;
            }
            if (dateTimePickerFechaEvento.Value <= newPublicacion.FechaEvento)
            {
                errorMessage += "Las Fechas de Evento a ingresar deben ser posteriores a las últimas ingresadas.\n"; errorCount++;
            }
            ;

            return(errorCount == 0);
        }
コード例 #15
0
        public void RendirComisiones(int cantidadARendir, Decimal idPublicacion)
        {
            String     sp      = "PLEASE_HELP.SP_RENDIR_COMISIONES";
            SqlCommand command = new SqlCommand(sp);

            command.CommandType = CommandType.StoredProcedure;

            command.Parameters.AddWithValue("@cantidadARendir", cantidadARendir);
            command.Parameters.AddWithValue("@idPublicacion", idPublicacion);
            command.Parameters.AddWithValue("@fechaActual", SystemDate.GetDate());

            if (Conexion.InsertUpdateOrDeleteData(command) < 1)
            {
                throw new Exception();
            }
        }
コード例 #16
0
        public FormAgregarFechas(List <Publicacion> list)
        {
            InitializeComponent();
            dataGridViewFechas.AllowUserToResizeRows = false;
            dataGridViewFechas.RowHeadersVisible     = false;

            newPublicacion.FechaEvento = DateTime.MinValue;

            dateTimePickerFechaEvento.Value = SystemDate.GetDate().AddDays(7);

            this.publicacionList = list;

            foreach (Publicacion p in publicacionList)
            {
                dataGridViewFechas.Rows.Add(p.FechaEvento);
            }
        }
コード例 #17
0
        public void InsertCliente(Cliente cliente)
        {
            String     sp      = "PLEASE_HELP.SP_ALTA_CLIENTE";
            SqlCommand command = new SqlCommand(sp);

            command.CommandType = CommandType.StoredProcedure;

            command.Parameters.AddWithValue("@nombre", cliente.nombre);
            command.Parameters.AddWithValue("@apellido", cliente.apellido);
            command.Parameters.AddWithValue("@tipo_doc", cliente.tipoDocumento);
            command.Parameters.AddWithValue("@nro_doc", cliente.nroDocumento);
            command.Parameters.AddWithValue("@cuil", cliente.cuil);
            command.Parameters.AddWithValue("@email", cliente.email);
            command.Parameters.AddWithValue("@telefono", cliente.telefono);
            command.Parameters.AddWithValue("@localidad", cliente.localidad);
            command.Parameters.AddWithValue("@direccion", cliente.direccion);
            if (cliente.nroPiso == null)
            {
                command.Parameters.AddWithValue("@nropiso", DBNull.Value);
            }
            else
            {
                command.Parameters.AddWithValue("@nropiso", cliente.nroPiso);
            }
            command.Parameters.AddWithValue("@depto", cliente.depto);
            command.Parameters.AddWithValue("@codpostal", cliente.codigoPostal);
            command.Parameters.AddWithValue("@fechanac", cliente.fechaNacimiento);

            command.Parameters.AddWithValue("@fechacreacion", SystemDate.GetDate());
            if (String.IsNullOrEmpty(cliente.tarjetaCredito))
            {
                command.Parameters.AddWithValue("@tarjetacredito", DBNull.Value);
            }
            else
            {
                command.Parameters.AddWithValue("@tarjetacredito", cliente.tarjetaCredito);
            }
            command.Parameters.AddWithValue("@firstLogin", cliente.primerLogin);
            command.Parameters.AddWithValue("@username", cliente.username);
            command.Parameters.AddWithValue("@password", cliente.GetPassword());

            if (Conexion.InsertUpdateOrDeleteData(command) < 2)
            {
                throw new Exception("No se ha podido registrar el cliente, intentelo nuevamente.");
            }
        }
コード例 #18
0
        public void CambiarEstadoPublicacion(Publicacion publicacion, String estado)
        {
            String query = "PLEASE_HELP.SP_CAMBIAR_ESTADO_PUBLICACION";

            SqlCommand cmd = new SqlCommand(query);

            cmd.CommandType = CommandType.StoredProcedure;

            if (estado == "PUBLICADA")
            {
                cmd.Parameters.AddWithValue("@fechaPublicacion", SystemDate.GetDate());
            }

            cmd.Parameters.AddWithValue("@codigoPublicacion", publicacion.Codigo);
            cmd.Parameters.AddWithValue("@estado", estado);


            Conexion.ExecuteProcedure(cmd);
        }
コード例 #19
0
ファイル: Cliente.cs プロジェクト: rodrigomc1/gdd_migracion
 public Cliente(string nombre, string apellido, string tipoDocumento, int nroDocumento, long cuil,
                string email, long telefono, string localidad, string direccion, byte nroPiso, string depto, string codPostal, DateTime fechaNac,
                string tarjetaCredito)
 {
     this.nombre          = nombre;
     this.apellido        = apellido;
     this.tipoDocumento   = tipoDocumento;
     this.nroDocumento    = nroDocumento;
     this.cuil            = cuil;
     this.email           = email;
     this.telefono        = telefono;
     this.localidad       = localidad;
     this.direccion       = direccion;
     this.nroPiso         = nroPiso;
     this.depto           = depto;
     this.codigoPostal    = codPostal;
     this.fechaNacimiento = fechaNac;
     this.fechaCreacion   = SystemDate.GetDate();
     this.tarjetaCredito  = tarjetaCredito;
 }
コード例 #20
0
        public void InsertPublicacion(Publicacion publicacion)
        {
            RepoUbicacion repoUbicacion = new RepoUbicacion();

            String sp = "PLEASE_HELP.SP_GENERAR_PUBLICACION";

            SqlCommand cmd = new SqlCommand(sp);

            cmd.CommandType = CommandType.StoredProcedure;


            if (publicacion.Estado.Descripcion == "PUBLICADA")
            {
                cmd.Parameters.AddWithValue("@fechaInicio", SystemDate.GetDate());
            }
            else
            {
                cmd.Parameters.AddWithValue("@fechaInicio", DBNull.Value);
            }

            cmd.Parameters.AddWithValue("@fechaEvento", publicacion.FechaEvento);
            cmd.Parameters.AddWithValue("@descripcion", publicacion.Descripcion);
            cmd.Parameters.AddWithValue("@direccion", publicacion.Direccion);
            cmd.Parameters.AddWithValue("@rubroId", publicacion.Rubro.Id);
            cmd.Parameters.AddWithValue("@gradoId", publicacion.Grado.Id);
            cmd.Parameters.AddWithValue("@empresaId", publicacion.Empresa.id);
            cmd.Parameters.AddWithValue("@estadoId", publicacion.Estado.Id);

            SqlParameter publicacionId = new SqlParameter("@idPublicacion", SqlDbType.Int);

            publicacionId.Direction = ParameterDirection.Output;

            cmd.Parameters.Add(publicacionId);

            Conexion.ExecuteProcedure(cmd);

            long ubicacionPublicacionID = Convert.ToInt64(publicacionId.Value);

            //Insert de Ubicaciones
            repoUbicacion.InsertUbicaciones(ubicacionPublicacionID, publicacion.Ubicaciones);
        }
コード例 #21
0
        public void GenerateCompras(List <Ubicacion> ubicacionesList, int?userId, String medioPago, String compraEmail)
        {
            String sp = "PLEASE_HELP.SP_COMPRAR_ENTRADA";

            foreach (Ubicacion u in ubicacionesList)
            {
                SqlCommand cmd = new SqlCommand(sp);
                cmd.CommandType = CommandType.StoredProcedure;

                cmd.Parameters.AddWithValue("@compraCliente", userId);
                cmd.Parameters.AddWithValue("@compraFecha", SystemDate.GetDate());
                cmd.Parameters.AddWithValue("@compraMedioPago", medioPago);
                cmd.Parameters.AddWithValue("@compraEmail", compraEmail);
                cmd.Parameters.AddWithValue("@compraFila", u.Fila);
                cmd.Parameters.AddWithValue("@compraAsiento", u.Asiento);
                cmd.Parameters.AddWithValue("@compraPublicacion", u.Publicacion);
                cmd.Parameters.AddWithValue("@compraPrecio", u.Precio);

                Conexion.ExecuteProcedure(cmd);
            }
        }
コード例 #22
0
 public void TearDown()
 {
     SystemDate.Reset();
 }
コード例 #23
0
 public Concert CreateFrom(ConcertSnapshot snapshot)
 {
     return(new Concert(new ConcertId(snapshot.Id.ToString()),
                        new EventTitleSummary(new GeoTitle(snapshot.TitleGeo)),
                        new EventDescription(snapshot.ConcertDate, snapshot.Description, SystemDate.Now()),
                        new EventOrganizer(snapshot.Organizer)
                        ));
 }
コード例 #24
0
ファイル: Cliente.cs プロジェクト: rodrigomc1/gdd_migracion
 public void SetFechaCreacion()
 {
     this.fechaCreacion = SystemDate.GetDate();
 }