Пример #1
0
        public int getUltimaPaginaRubros(List <Rubro> rubros)
        {
            string query = "SELECT [TheBigBangQuery].[getUltimaLineaFiltroRubro](@table, @fechaActual)";

            try
            {
                SqlCommand com = new SqlCommand(query);

                DataTable table = new DataTable();
                table.Columns.Add("rub_id", typeof(decimal));

                foreach (Rubro r in rubros)
                {
                    table.Rows.Add(r.id);
                }

                SqlParameter param = new SqlParameter("@table", SqlDbType.Structured);
                param.TypeName = "[TheBigBangQuery].[RubrosList]";
                param.Value    = table;

                com.Parameters.Add(param);
                com.Parameters.AddWithValue("@fechaActual", Generals.getFecha());

                return(DatabaseConection.executeParamFunction <int>(com));
            }
            catch (Exception e)
            {
                throw e;
            }
        }
Пример #2
0
        private void EliminarButton_Click(object sender, EventArgs e)
        {
            try
            {
                ListViewItem item = listaRoles.SelectedItems[0];

                Rol rol = roles.Find(elem => elem.nombre.Equals(item.Text));
                if (item.ForeColor == Color.Gray)
                {
                    // Le quito la baja logica al ROl
                    rol.bajaLogica = Generals.getFechaMinima();
                }
                else
                {
                    // Le agrego la baja logica con la fecha de hoy
                    rol.bajaLogica = Generals.getFecha();
                }
                item.ForeColor = item.ForeColor == Color.Gray ? Color.Black : Color.Gray;
                RolesDao rolesDao = new RolesDao();
                rolesDao.actualizarRol(rol);
            }
            catch (Exception ex) {
                MessageBox.Show("Debe seleccionar algun rol para poder deshabilitarlo/habilitarlo");
            }
        }
Пример #3
0
        public void insertarFactura(SqlTransaction transaction, string tipoPago, Compra compra, Action <int> resNuevoId)
        {
            string procedure = "[TheBigBangQuery].[insertarNuevaFactura]";

            try {
                SqlCommand command = new SqlCommand(procedure);
                command.Transaction = transaction;
                command.CommandType = CommandType.StoredProcedure;
                command.CommandType = CommandType.StoredProcedure;

                command.Parameters.AddWithValue("@idCompra", compra.id);
                command.Parameters.AddWithValue("@tipoPago", tipoPago);
                command.Parameters.AddWithValue("@fecha", Generals.getFecha());
                command.Parameters.AddWithValue("@idEmpresa", compra.publicacion.espectaculo.empresa.id);
                SqlParameter param = new SqlParameter("@numeroFactura", SqlDbType.Decimal)
                {
                    Direction = ParameterDirection.Output
                };
                command.Parameters.Add(param);

                DatabaseConection.executeNoParamFunction(command);
                var newId = param.Value;
                int newIdInt;
                if (int.TryParse(newId.ToString(), out newIdInt))
                {
                    resNuevoId(newIdInt);
                }
            }
            catch (Exception ex) {
                throw new SqlInsertException("Error al realizar la rendicion de comisiones", 0);
            }
        }
Пример #4
0
        private void button1_Click(object sender, EventArgs e)
        {
            Compra           compra      = new Compra();
            List <Ubicacion> ubicaciones = new List <Ubicacion>();

            foreach (var u in UbicacionesListView.CheckedItems)
            {
                Ubicacion ubi = (Ubicacion)((ListViewItem)u).Tag;
                compra.total += ubi.precio;
                ubicaciones.Add(ubi);
            }
            ComprasDao     comprasDao = new ComprasDao();
            SqlTransaction trans      = DatabaseConection.getInstance().BeginTransaction();


            compra.ubicaciones = ubicaciones;
            compra.fechaCompra = Generals.getFecha();
            compra.cantidad    = ubicaciones.Count;
            Cliente clie = new Cliente();

            compra.cli = clie;


            ubicacionesSeleccionadas = ubicaciones;
            try
            {
                comprasDao.insertarCompra(compra, publicacionActual, trans);
                trans.Commit();
                MessageBox.Show("Compra realizada con exito");
            }
            catch (Exception ex) {
                trans.Rollback();
                MessageBox.Show("Ha ocurrido un error al procesar la compra");
            }
        }
Пример #5
0
        public IngresarTarjetaForm()
        {
            tarjeta = new Tarjeta();
            InitializeComponent();

            VencimientoDatePicker.Value = Generals.getFecha();
        }
Пример #6
0
 public SaveGameReader(string saveFilePath)
 {
     _savegame     = new SaveGameFile(saveFilePath, SaveFileFormat.DUNE_37);
     _generals     = new Generals(_savegame.UncompressedData, new Dune37Offsets());
     _offsets      = new Dune37Offsets();
     _saveFilePath = saveFilePath;
 }
        public string Send([FromBody] EmailDto EmailDto)
        {
            var    ajas    = EmailDto.CorreoVar;
            string message = "";

            try
            {
                generals = new Generals();

                if (generals.SendEmailToBd(EmailDto) && generals.SendEmailSMTP(EmailDto))
                {
                    message = "success";
                }
                else
                {
                    message = "error";
                }
            }
            catch (Exception)
            {
                return(JsonConvert.SerializeObject(message));
            }

            return(JsonConvert.SerializeObject(message));
        }
Пример #8
0
        private Compra parsearCompraDelReader(SqlDataReader reader)
        {
            Compra compra = new Compra();

            compra.id          = (int)reader.GetSqlDecimal(0);
            compra.fechaCompra = reader.IsDBNull(1) ? Generals.getFechaMinima() : (DateTime)reader.GetSqlDateTime(1);
            string        medioPago = reader.IsDBNull(2) ? null : reader.GetSqlString(2).ToString();
            List <string> medios    = medioPago.Split('/').ToList();
            Tarjeta       tarjeta   = new Tarjeta();

            if (medios.Count == 3)
            {
                tarjeta.titular     = medios[0];
                tarjeta.numero      = medios[1];
                tarjeta.vencimiento = medios[2];
            }
            else
            {
                tarjeta.numero = medioPago;
            }
            compra.medioPago = tarjeta;
            compra.cantidad  = reader.IsDBNull(3) ? 0 : (int)reader.GetSqlDecimal(3);
            compra.total     = reader.IsDBNull(4) ? 0 : (float)reader.GetSqlDecimal(4).ToDouble();
            Publicacion publi = new Publicacion();

            publi.id = reader.IsDBNull(5) ? -1 : (int)reader.GetSqlDecimal(5);
            Espectaculo espe = new Espectaculo();

            espe.descripcion   = reader.IsDBNull(6) ? null : reader.GetSqlString(6).ToString();
            publi.espectaculo  = espe;
            compra.publicacion = publi;


            return(compra);
        }
Пример #9
0
        public void insertarEmpresaConUsuario(Empresa empresa, String usuario, String contraseña)
        {
            string query = "EXEC [TheBigBangQuery].[InsertarEmpresaConUsuario]" +
                           "@usuario = '" + usuario + "'," +
                           "@contraseña = '" + contraseña + "'," +
                           "@razonSocial = '" + empresa.razonSocial + "'," +
                           "@cuit = '" + empresa.cuit + "'," +
                           "@mail = '" + empresa.mailEmpresa + "'," +
                           "@telefono = '" + empresa.telefonoEmpresa + "'," +
                           "@calle = '" + empresa.direccion.calle + "'," +
                           "@altura = '" + empresa.direccion.numero + "'," +
                           "@piso = '" + empresa.direccion.piso + "'," +
                           "@depto = '" + empresa.direccion.depto + "'," +
                           "@localidad = '" + empresa.direccion.localidad + "'," +
                           "@codigoPostal = '" + empresa.direccion.codigoPostal + "'," +
                           "@ciudad = '" + empresa.direccion.ciudad + "'," +
                           "@fechaCreacion = '" + Generals.getFecha() + "'";

            try
            {
                DatabaseConection.executeNoParamFunction(query);
            }
            catch (SqlException e) {
                throw e;
            }
        }
Пример #10
0
        public List <Publicacion> filtrarPaginasPorRubro(int pagina, List <Rubro> rubros)
        {
            string             funcion = "SELECT * FROM [TheBigBangQuery].[getPaginaPublicacionesPorFiltroRubros](@pagina, @table, @fechaActual)";
            List <Publicacion> publis  = new List <Publicacion>();
            SqlDataReader      reader  = null;

            try
            {
                SqlCommand command = new SqlCommand(funcion);
                command.CommandText = funcion;

                DataTable table = new DataTable();
                table.Columns.Add("rub_id", typeof(decimal));

                foreach (Rubro r in rubros)
                {
                    table.Rows.Add(r.id);
                }

                SqlParameter param = new SqlParameter("@table", SqlDbType.Structured);
                param.TypeName = "[TheBigBangQuery].[RubrosList]";
                param.Value    = table;

                command.Parameters.AddWithValue("@pagina", pagina);
                command.Parameters.Add(param);
                command.Parameters.AddWithValue("@fechaActual", Generals.getFecha());

                reader = DatabaseConection.executeQuery(command);
                if (reader.HasRows)
                {
                    while (reader.Read())
                    {
                        Publicacion publi = ParserPublicaciones.parsearPublicacionDelReader(reader);
                        publi.espectaculo.descripcion = reader.IsDBNull(6) ? null : reader.GetSqlString(6).ToString();
                        publi.espectaculo.direccion   = reader.IsDBNull(7) ? null : reader.GetSqlString(7).ToString();
                        publi.gradoPublicacion.nivel  = reader.IsDBNull(8) ? null : reader.GetSqlString(8).ToString();
                        publis.Add(publi);
                    }
                }


                return(publis);
            }
            catch (Exception e)
            {
                throw new DataNotFoundException("No se han encontrado publicaciones pertenecientes a los rubros seleccionados");
            }
            finally {
                if (reader != null & !reader.IsClosed)
                {
                    reader.Close();
                }
            }
        }
Пример #11
0
        public GenerarPublicacionForm()
        {
            InitializeComponent();
            // Dia Minimo: ayer
            DateTime fecha = Generals.getFecha();

            fechasDeLaPublicacion.Add(fecha);
            this.FechaEventoTimePicker.MinDate = fecha;
            this.FechaEventoTimePicker.Value   = fecha;

            initContent();
        }
Пример #12
0
 public void LimpiarButton_Click(object sender, EventArgs e)
 {
     NombreCliente.Text                = "";
     ApellidoCliente.Text              = "";
     MailCliente.Text                  = "";
     TelefonoCliente.Text              = "";
     CuilCliente.Text                  = "";
     dirDelCliente                     = null;
     FechaNacimientoCliente.Value      = Generals.getFecha();
     DniCliente.Text                   = "";
     ListaTiposDocumento.SelectedIndex = 0;
 }
Пример #13
0
        private Premio parsearPremioDelReader(SqlDataReader r)
        {
            Premio pre = new Premio();

            pre.id = (int)r.GetSqlDecimal(0);
            pre.puntosNecesarios = (int)r.GetSqlDecimal(1);
            pre.nombre           = r.IsDBNull(2) ? null : r.GetSqlString(2).ToString();
            pre.fechaVencimiento = r.IsDBNull(3) ? Generals.getFechaMinima() : (DateTime)r.GetSqlDateTime(3);


            return(pre);
        }
Пример #14
0
    public void RemoveGeneral(int generalID)
    {
        if (Generals.Contains(generalID) == false)
        {
            return;
        }

        Generals.Remove(generalID);

        GeneralInfo general = GamePublic.Instance.DataManager.GetGeneralInfo(generalID);

        general.KingID = 0;
    }
Пример #15
0
        public void Save()
        {
            if (Generals.Count(gen => gen.Id == Id) != 0)
            {
                Update();
                return;
            }             //If general already exist;

            using (IDbConnection cnn = new SQLiteConnection(DBPath))
            {
                cnn.Execute($"INSERT INTO Generals VALUES(@Id, @Name, @Description, @Type, @Health, @Size, @BuildTime, @BuildCost, @Mod, @Weight);", this);
            }
        }
Пример #16
0
        public Compra getDetalleCompraPorId(int id)
        {
            string query = "SELECT comp_id, comp_fecha_y_hora,comp_medio_de_pago, comp_cantidad,comp_total, " +
                           "publ_id, espe_descripcion, publ_fecha_hora_espectaculo, publ_estado, empr_razon_social, rub_descripcion " +
                           "FROM TheBigBangQuery.Compras " +
                           "JOIN TheBigBangQuery.Publicacion ON (publ_id = comp_publicacion) " +
                           "JOIN TheBigBangQuery.Espectaculo ON (publ_espectaculo = espe_id) " +
                           "JOIN TheBigBangQuery.Empresa ON (espe_empresa = empr_id) " +
                           "JOIN TheBigBangQuery.Rubro ON (espe_rubro = rub_id) " +
                           "WHERE comp_id = @compID";
            SqlDataReader reader = null;

            try
            {
                Compra     compra  = new Compra();
                SqlCommand command = new SqlCommand(query);
                command.CommandText = query;

                command.Parameters.Add("@compID", id);

                reader = DatabaseConection.executeQuery(command);
                if (reader.HasRows)
                {
                    reader.Read();
                    compra = parsearCompraDelReader(reader);
                    compra.publicacion.fechaEvento = reader.IsDBNull(7) ? Generals.getFechaMinima() : (DateTime)reader.GetSqlDateTime(7);
                    compra.publicacion.estado      = reader.IsDBNull(8) ? null : reader.GetSqlString(8).ToString();
                    Empresa emp = new Empresa();
                    emp.razonSocial = reader.IsDBNull(9) ? null : reader.GetSqlString(9).ToString();
                    Rubro rub = new Rubro();
                    rub.descripcion = reader.IsDBNull(10) ? null : reader.GetSqlString(10).ToString();
                    compra.publicacion.espectaculo.rubro   = rub;
                    compra.publicacion.espectaculo.empresa = emp;

                    return(compra);
                }
                return(compra);
            }
            catch (Exception e)
            {
                throw new DataNotFoundException("No se ha encontrado los detalles de la compra seleccionada");
            }
            finally {
                if (reader != null & !reader.IsClosed)
                {
                    reader.Close();
                }
            }
        }
Пример #17
0
        public void habilitarODesahabilitarEmpresa(Empresa empresa)
        {
            string query = "UPDATE TheBigBangQuery.Empresa " +
                           "SET empr_dado_baja = " +
                           (empresa.bajaLogica != null ? "'" + Generals.getFecha().ToString("yyyy-dd-MM") + "'" : "NULL") +
                           " WHERE empr_id = 1";

            try
            {
                DatabaseConection.executeNoParamFunction(query);
            }
            catch (SqlException ex) {
                throw ex;
            }
        }
Пример #18
0
        public int getUltimaPaginaDesc(string desc)
        {
            string query = "SELECT [TheBigBangQuery].[getUltimaLineaFiltroDesc](@desc, @fechaActual)";

            try
            {
                SqlCommand com = new SqlCommand(query);
                com.Parameters.AddWithValue("@desc", desc);
                com.Parameters.AddWithValue("@fechaActual", Generals.getFecha());
                return(DatabaseConection.executeParamFunction <int>(com));
            }
            catch (Exception e) {
                throw e;
            }
        }
Пример #19
0
        public List <Publicacion> getPublicacionesPorPagina(int pagina, Nullable <int> empresaId = null)
        {
            string             function          = "SELECT * FROM [TheBigBangQuery].[GetPublicacionesPorPaginaSinFiltroDeEmpresa](@pagina, @empresa, @fechaActual)";
            SqlDataReader      reader            = null;
            List <Publicacion> publicacionesList = new List <Publicacion>();

            try
            {
                SqlCommand command = new SqlCommand(function);
                command.CommandText = function;

                command.Parameters.AddWithValue("@pagina", pagina);
                if (empresaId != null)
                {
                    command.Parameters.AddWithValue("@empresa", empresaId);
                }
                else
                {
                    command.Parameters.AddWithValue("@empresa", DBNull.Value);
                }

                command.Parameters.AddWithValue("@fechaActual", Generals.getFecha());

                reader = DatabaseConection.executeQuery(command);
                if (reader.HasRows)
                {
                    while (reader.Read())
                    {
                        Publicacion publi = ParserPublicaciones.parsearPublicacionDelReader(reader);
                        publi.espectaculo.descripcion = reader.IsDBNull(6) ? null : reader.GetSqlString(6).ToString();
                        publi.espectaculo.direccion   = reader.IsDBNull(7) ? null : reader.GetSqlString(7).ToString();
                        publi.gradoPublicacion.nivel  = reader.IsDBNull(8) ? null : reader.GetSqlString(8).ToString();
                        publicacionesList.Add(publi);
                    }
                }
                return(publicacionesList);
            }
            catch (Exception ex)
            {
                throw new DataNotFoundException("No se han encontrado publicaciones para la pagina seleccionada");
            }
            finally {
                if (reader != null && !reader.IsClosed)
                {
                    reader.Close();
                }
            }
        }
Пример #20
0
 private void VencimientoTextBox_TextChanged(object sender, EventArgs e)
 {
     try {
         DateTime fecha = VencimientoDatePicker.Value;
         if (fecha.CompareTo(Generals.getFecha()) < 0)
         {
             // FECHA ANTERIOR A HOY
             tarjeta.vencimiento = null;
         }
         else
         {
             tarjeta.vencimiento = fecha.ToString("yyyy/MM");
         }
     }
     catch (Exception ex) { }
 }
Пример #21
0
        private void borrarFormulario()
        {
            this.FechaEventoTimePicker.Value           = FechaEventoTimePicker.MinDate;
            this.DireccionTextBox.Text                 = "";
            this.RubroComboBox.SelectedItem            = null;
            this.GradoPublicacionComboBox.SelectedItem = null;
            this.UbicacionesListView.Items.Clear();
            this.textBox1.Text = "";

            this.ubicacionesList.Clear();
            this.fechasDeLaPublicacion.Clear();
            this.fechasDeLaPublicacion.Add(Generals.getFecha());
            direccionPublicacion = "";
            rubro                  = null;
            gradoPublicacion       = null;
            descripcionPublicacion = "";
        }
Пример #22
0
 private void KategoriaDLL()
 {
     SqlConnection con = Generals.GetNewConnection();
     try
     {
         SqlCommand cmd = new SqlCommand("Select KategoriaID, VleraKategorise from Kategoria", con);
         SqlDataReader rdr = cmd.ExecuteReader();
         KategoriaDropDownList.DataTextField = "VleraKategorise";
         KategoriaDropDownList.DataValueField = "KategoriaID";
         KategoriaDropDownList.DataSource = rdr;
         KategoriaDropDownList.DataBind();
         KategoriaDropDownList.Items.Insert(0, "Selekto Kategorin");
     }
     finally
     {
         con.Close();
     }
 }
Пример #23
0
        private void DeshabilitarClienteButton_Click(object sender, EventArgs e)
        {
            ClientesDao clientesDao = new ClientesDao();

            try
            {
                bool isHabilitado = clienteSeleccionado.bajaLogica == null;
                if (!isHabilitado)
                {
                    clienteSeleccionado.bajaLogica = Generals.getFecha();
                }
                clientesDao.habilitarODesabilitarCliente(clienteSeleccionado);
                ((ListViewItem)ListaCliente.SelectedItems[0]).ForeColor = isHabilitado ? Color.Gray : Color.Black;
            }
            catch (Exception ex) {
                Console.Write(ex.Message);
            }
        }
Пример #24
0
    public void AddGeneral(int generalID)
    {
        GeneralInfo general = GamePublic.Instance.DataManager.GetGeneralInfo(generalID);

        if (general.KingID != KingID)
        {
            Debugging.LogError("Function:AddGeneral; KingID:" + KingID + ", general.KingID:" + general.KingID);
            return;
        }

        if (Generals.Contains(generalID))
        {
            return;
        }

        general.CityID = ID;
        Generals.Add(generalID);
    }
Пример #25
0
        public ListadoForm()
        {
            InitializeComponent();
            estadisticasDao = new EstadisticasDao();

            for (int i = Generals.getFecha().Year + 1; i >= 2000; i--)
            {
                this.AñoComboBox.Items.Add(i.ToString());
            }

            new GradoDePublicacionDao().getGradosDePublicacion().ForEach(elem => {
                this.gradoComboBox.Items.Add(elem);
            });
            this.gradoComboBox.SelectedIndex       = 1;
            this.AñoComboBox.SelectedIndex         = 0;
            this.TrimestreComboBox.SelectedIndex   = 0;
            this.EstadisticaComboBox.SelectedIndex = 0;
        }
Пример #26
0
        private void PunetoriiDLL()
        {
            SqlConnection con = Generals.GetNewConnection();

            try
            {
                SqlCommand    cmd = new SqlCommand("Select RoliID, Roli from Roli", con);
                SqlDataReader rdr = cmd.ExecuteReader();
                RoliDropDownList.DataTextField  = "Roli";
                RoliDropDownList.DataValueField = "RoliID";
                RoliDropDownList.DataSource     = rdr;
                RoliDropDownList.DataBind();
                RoliDropDownList.Items.Insert(0, "Selekto Rolin");
            }
            finally
            {
                con.Close();
            }
        }
Пример #27
0
        public static void Refresh(string materialId = "")
        {
            if (materialId == "")
            {
                for (int i = 0; i < Generals.Length; i++)
                {
                    Generals[i].Save();
                }
            }
            else
            {
                List <General> generals = Generals.Where(gen => gen.BuildCosts.Count(item => item.Id == materialId) != 0 && gen.BuildCosts.Count(item => Material.GetMaterial(item.Id).Weight == null) == 0).ToList();

                foreach (General general in generals)
                {
                    general.Update();
                }
            }
        }
Пример #28
0
    public void AddGeneral(int generalID)
    {
        if (Generals.Contains(generalID))
        {
            return;
        }

        Generals.Add(generalID);

        GeneralInfo general = GamePublic.Instance.DataManager.GetGeneralInfo(generalID);

        if (general.KingID != 0)
        {
            KingInfo king = GamePublic.Instance.DataManager.GetKingInfo(general.KingID);
            king.RemoveGeneral(generalID);
        }

        general.KingID = ID;
    }
Пример #29
0
        public FiltrosForm()
        {
            InitializeComponent();

            rubrosDao = new RubrosDao();

            rubrosDao.getRubros().ForEach(elem => {
                this.RubrosListView.Items.Add(elem, false);
            });

            FechaIDatePicker.MinDate = Generals.getFechaMinima();
            FechaIDatePicker.Value   = Generals.getFecha();
            FechaFDatePicker.MinDate = Generals.getFechaMinima().AddDays(1);
            FechaFDatePicker.Value   = Generals.getFecha().AddDays(1);
            this.DescripcionFilterTextBox.Enabled = true;
            this.FechaIDatePicker.Enabled         = false;
            this.FechaFDatePicker.Enabled         = false;
            this.RubrosListView.Enabled           = false;
        }
Пример #30
0
        private void GrupiDLL()
        {
            SqlConnection con = Generals.GetNewConnection();

            try
            {
                SqlCommand    cmd = new SqlCommand("Select GrupiID, Grupi from Grupi", con);
                SqlDataReader rdr = cmd.ExecuteReader();
                GrupiDropDownList.DataTextField  = "Grupi";
                GrupiDropDownList.DataValueField = "GrupiID";
                GrupiDropDownList.DataSource     = rdr;
                GrupiDropDownList.DataBind();
                GrupiDropDownList.Items.Insert(0, "Selekto Grupin");
            }
            finally
            {
                con.Close();
            }
        }