예제 #1
0
        public virtual void RemoveStock(long oidStock, long oidPartida)
        {
            Stocks.Remove(oidStock);
            Batch partida = Partidas.GetItem(oidPartida);

            UpdateStocks(partida, true);
        }
예제 #2
0
        private void Partida_OpenReadCompleted(object sender, OpenReadCompletedEventArgs e)
        {
            Partidas res = JsonConvert.DeserializeObject <Partidas>(new StreamReader(e.Result).ReadToEnd());

            List <ModeloPartida> listaPartida = new List <ModeloPartida>();


            foreach (var partida in res.partidas)
            {
                var dataPartida = partida.DataPartida.Split(' ');
                var diaPardida  = dataPartida[0].Split('-');

                Clube mandante  = res.clubes.FirstOrDefault(c => c.Value.id == partida.ClubeMandanteId).Value;
                Clube visitante = res.clubes.FirstOrDefault(c => c.Value.id == partida.ClubeVisitanteId).Value;

                ModeloPartida modelo = new ModeloPartida();
                modelo.NomeMandante       = mandante.Nome;
                modelo.NomeVisitante      = visitante.Nome;
                modelo.PosicaoMandante    = mandante.Posicao;
                modelo.PosicaoVisitante   = visitante.Posicao;
                modelo.UrlEscudoMandante  = mandante.Escudos.Url_45_X_45;
                modelo.UrlEscudoVisitante = visitante.Escudos.Url_45_X_45;
                modelo.LocalPartida       = partida.localPartida;
                modelo.DataPartida        = diaPardida[2] + "/" + diaPardida[1] + "/" + diaPardida[0] + " " + dataPartida[1];

                listaPartida.Add(modelo);
            }

            atualizaListaJogosRodada(listaPartida);
        }
예제 #3
0
        public void CrearPartida(string usuario, string partida, string mazo)
        {
            Partidas Partida = null;

            try
            {
                // Notifico a los otros usuarios de la nueva partida.
                Partida = new Partidas()
                {
                    Usuario = usuario, Nombre = partida, Mazo = mazo, Activa = true
                };
                Partida.Preparar();
                Partida.Jugar.OnFinJuego += Juego_OnFin;
            }
            catch (System.Exception e)
            {
                Partida = null;
                Clients.Caller.mostrarError($"[ERROR: 404] No se encontró el archivo de información.");
            }

            if (Partida != null)
            {
                Partida.Jugar.Jugador1 = new Jugador()
                {
                    ConectionID = Context.ConnectionId, Nombre = usuario
                };
                juego.ListPartidas.Add(Partida);
                Clients.Others.agregarPartida(Partida);
                Clients.Caller.cleanErrors();
                Clients.Caller.esperarJugador();
            }
        }
예제 #4
0
 protected void GRDPartidas_SelectedIndexChanged(object sender, EventArgs e)
 {
     try
     {
         if (SesionUsu.Usu_TipoUsu == "SA")
         {
             Partidas objPartida  = new Partidas();
             string   Verificador = string.Empty;
             objPartida.Id               = Convert.ToString(GRDPartidas.SelectedRow.Cells[4].Text);
             objPartida.Ejercicio        = Convert.ToString(GRDPartidas.SelectedRow.Cells[3].Text);
             Session["SessionIdPartida"] = objPartida.Id;
             CN_Partida.ObtenerDatosPartida(ref objPartida, ref Verificador);
             txtPartida.Text            = objPartida.Clave;
             txtDescrip.Text            = objPartida.Descrip;
             txtConcepto.Text           = objPartida.Concepto;
             txtEjercicio.Text          = objPartida.Ejercicio;
             Multiview1.ActiveViewIndex = 1;
         }
         else
         {
             ScriptManager.RegisterStartupScript(this.Page, Page.GetType(), "modal", "mostrar_modal(0, 'No tiene los privilegios para realizar esta acción.')", true);
         }
     }
     catch (Exception ex)
     {
         ScriptManager.RegisterStartupScript(this.Page, Page.GetType(), "modal", "mostrar_modal(0, '" + ex.Message + ".')", true);
     }
 }
예제 #5
0
 protected void BTNGuardarPartida_Click(object sender, EventArgs e)
 {
     try
     {
         Partidas objPartidas = new Partidas();
         if (SesionUsu.Usu_TipoUsu == "SA")
         {
             objPartidas.Partida   = txtPartida.Text;
             objPartidas.Descrip   = txtDescrip.Text;
             objPartidas.Concepto  = txtConcepto.Text;
             objPartidas.Ejercicio = SesionUsu.Usu_Ejercicio;
             objPartidas.Estatus   = "A";
             string Verificador = string.Empty;
             CN_Partida.InsertarPartida(ref objPartidas, ref Verificador);
             if (Verificador == "0")
             {
                 ScriptManager.RegisterStartupScript(this.Page, Page.GetType(), "modal", "mostrar_modal(0, 'Se ha guardado correctament.')", true);
                 txtPartida.Text = "";
                 txtDescrip.Text = "";
             }
             else
             {
                 ScriptManager.RegisterStartupScript(this.Page, Page.GetType(), "modal", "mostrar_modal(1, '" + Verificador + ".')", true);
             }
         }
         else
         {
             ScriptManager.RegisterStartupScript(this.Page, Page.GetType(), "modal", "mostrar_modal(1, 'No tiene los privilegios para realizar esta acción.')", true);
         }
     }
     catch (Exception ex)
     {
         ScriptManager.RegisterStartupScript(this.Page, Page.GetType(), "modal", "mostrar_modal(1, '" + ex.Message + ".')", true);
     }
 }
        // Rechazar solicitud de anulacion
        public void RechazarAnulacion(ComprobanteModel comprobante, string userName)
        {
            ComprobanteDetalle cdService  = new ComprobanteDetalle();
            IPartidas          parService = new Partidas();

            comprobante.TC_ESTATUS                   = Convert.ToInt16(BusinessEnumerations.EstatusCarga.CONCILIADO).ToString();
            comprobante.TC_FECHA_RECHAZO             = DateTime.Now;
            comprobante.TC_USUARIO_RECHAZO           = userName;
            comprobante.TC_USUARIO_RECHAZO_ANULACION = userName;
            comprobante.TC_FECHA_RECHAZO_ANULACION   = DateTime.Now;
            //Prueba
            //using (var trx = new TransactionScope())
            //{
            //    using (var db = new DBModelEntities())
            //    {

            //            var detalles = cdService.GetAll(c => c.TC_ID_COMPROBANTE == comprobante.TC_ID_COMPROBANTE).ToList();
            //            detalles.ForEach(c =>
            //            {
            //                var clonePart = c.SAX_PARTIDAS.CloneEntity();
            //                var partEntity = c.SAX_PARTIDAS;
            //                clonePart.PA_FECHA_ANULACION = null;
            //                clonePart.PA_USUARIO_ANULACION = null;
            //                parService.Update(partEntity, clonePart);
            //            });
            //        }
            //    trx.Complete();
            //}
            base.Update(comprobante);
        }
예제 #7
0
파일: Grupo.cs 프로젝트: andremp3/Testes
 public void MontarPartidas()
 {
     //TO-DO: Fazer isso com o loop
     Partidas.Add(new Partida {
         Lutador1 = Participantes[0], Lutador2 = Participantes[1]
     });
     Partidas.Add(new Partida {
         Lutador1 = Participantes[0], Lutador2 = Participantes[2]
     });
     Partidas.Add(new Partida {
         Lutador1 = Participantes[0], Lutador2 = Participantes[3]
     });
     Partidas.Add(new Partida {
         Lutador1 = Participantes[0], Lutador2 = Participantes[4]
     });
     Partidas.Add(new Partida {
         Lutador1 = Participantes[1], Lutador2 = Participantes[2]
     });
     Partidas.Add(new Partida {
         Lutador1 = Participantes[1], Lutador2 = Participantes[3]
     });
     Partidas.Add(new Partida {
         Lutador1 = Participantes[1], Lutador2 = Participantes[4]
     });
     Partidas.Add(new Partida {
         Lutador1 = Participantes[2], Lutador2 = Participantes[3]
     });
     Partidas.Add(new Partida {
         Lutador1 = Participantes[2], Lutador2 = Participantes[4]
     });
     Partidas.Add(new Partida {
         Lutador1 = Participantes[3], Lutador2 = Participantes[4]
     });
 }
예제 #8
0
        public void PartidasGrid(ref Partidas objPartidas, ref List <Partidas> List)
        {
            CD_Datos      CDDatos = new CD_Datos();
            OracleCommand cmm     = null;

            try
            {
                OracleDataReader dr         = null;
                String[]         Parametros = { "p_capitulo", "P_EJERCICIO" };
                String[]         Valores    = { objPartidas.SubCapt, objPartidas.Ejercicio };

                cmm = CDDatos.GenerarOracleCommandCursor("PKG_PRESUPUESTO.Obt_Grid_Cat_Partida", ref dr, Parametros, Valores);

                while (dr.Read())
                {
                    objPartidas           = new Partidas();
                    objPartidas.Partida   = Convert.ToString(dr.GetValue(0));
                    objPartidas.Concepto  = Convert.ToString(dr.GetValue(1));
                    objPartidas.Descrip   = Convert.ToString(dr.GetValue(2));
                    objPartidas.Id        = Convert.ToString(dr.GetValue(3));
                    objPartidas.Ejercicio = Convert.ToString(dr.GetValue(4));
                    List.Add(objPartidas);
                }
                dr.Close();
            }
            catch (Exception ex)
            {
                throw new Exception(ex.Message);
            }
            finally
            {
                CDDatos.LimpiarOracleCommand(ref cmm);
            }
        }
예제 #9
0
 protected void GRDPartidas_RowDeleting(object sender, GridViewDeleteEventArgs e)
 {
     try
     {
         Partidas objPartida  = new Partidas();
         string   Verificador = string.Empty;
         int      fila        = e.RowIndex;
         objPartida.Id = Convert.ToString(GRDPartidas.Rows[fila].Cells[4].Text);
         if (SesionUsu.Usu_TipoUsu == "SU")
         {
             CN_Partida.EliminarPartida(objPartida, ref Verificador);
             if (Verificador == "0")
             {
                 ScriptManager.RegisterStartupScript(this.Page, Page.GetType(), "modal", "mostrar_modal(1, 'Se ha eliminado correctamente.')", true);
             }
             else
             {
                 ScriptManager.RegisterStartupScript(this.Page, Page.GetType(), "modal", "mostrar_modal(0, '" + Verificador + ".')", true);
             }
         }
         else
         {
             ScriptManager.RegisterStartupScript(this.Page, Page.GetType(), "modal", "mostrar_modal(0, '" + Verificador + ".')", true);
         }
     }
     catch (Exception ex)
     {
         ScriptManager.RegisterStartupScript(this.Page, Page.GetType(), "modal", "mostrar_modal(0, '" + ex.Message + ".')", true);
     }
 }
예제 #10
0
        public void ObtenerDatosPartida(ref Partidas objPartidas, ref string Verificador)
        {
            CD_Datos      CDDatos = new CD_Datos();
            OracleCommand Cmd     = null;

            try
            {
                string[] ParametrosIn  = { "P_ID", "P_EJERCICIO" };
                object[] Valores       = { objPartidas.Id, objPartidas.Ejercicio };
                string[] ParametrosOut = { "P_CLAVE", "P_CONCEPTO", "P_DESCRIPCION", "P_BANDERA" };

                Cmd = CDDatos.GenerarOracleCommand("OBT_SAF_PRESUP_PARTIDAS", ref Verificador, ParametrosIn, Valores, ParametrosOut);
                if (Verificador == "0")
                {
                    objPartidas           = new Partidas();
                    objPartidas.Id        = Convert.ToString(Cmd.Parameters["P_ID"].Value);
                    objPartidas.Clave     = Convert.ToString(Cmd.Parameters["P_CLAVE"].Value);
                    objPartidas.Concepto  = Convert.ToString(Cmd.Parameters["P_CONCEPTO"].Value);
                    objPartidas.Descrip   = Convert.ToString(Cmd.Parameters["P_DESCRIPCION"].Value);
                    objPartidas.Ejercicio = Convert.ToString(Cmd.Parameters["P_EJERCICIO"].Value);
                }
            }
            catch (Exception ex)
            {
                throw new Exception(ex.Message);
            }
            finally
            {
                CDDatos.LimpiarOracleCommand(ref Cmd);
            }
        }
예제 #11
0
 protected void BTNEditarPartida_Click(object sender, EventArgs e)
 {
     try
     {
         if (SesionUsu.Usu_TipoUsu == "SA")
         {
             Partidas objPartida  = new Partidas();
             string   Verificador = string.Empty;
             objPartida.Id        = (String)Session["SessionIdPartida"];
             objPartida.Clave     = txtPartida.Text;
             objPartida.Descrip   = txtDescrip.Text;
             objPartida.Concepto  = txtConcepto.Text;
             objPartida.Ejercicio = txtEjercicio.Text;
             CN_Partida.EditarPartida(ref objPartida, ref Verificador);
             if (Verificador == "0")
             {
                 ScriptManager.RegisterStartupScript(this.Page, Page.GetType(), "modal", "mostrar_modal(1, 'Se han realizado los cambios correctamente.')", true);
             }
             else
             {
                 ScriptManager.RegisterStartupScript(this.Page, Page.GetType(), "modal", "mostrar_modal(0, '" + Verificador + ".')", true);
             }
         }
         else
         {
             ScriptManager.RegisterStartupScript(this.Page, Page.GetType(), "modal", "mostrar_modal(0, 'No tiene los privilegios para realizar esta acción.')", true);
         }
     }
     catch (Exception ex)
     {
         ScriptManager.RegisterStartupScript(this.Page, Page.GetType(), "modal", "mostrar_modal(0, '" + ex.Message + ".')", true);
     }
 }
예제 #12
0
        public override string ToString()
        {
            var sb = new StringBuilder();

            sb.AppendLine(Partida.GetHeader());
            Partidas.ForEach(partida => sb.AppendLine(partida.ToString()));
            return(sb.ToString());
        }
예제 #13
0
        private void DibujarTablero(Partidas Match)
        {
            var jugador1 = new { Nombre = Match.Jugar.Jugador1.Nombre, Cartas = Match.Jugar.Jugador1.Mazo };
            var jugador2 = new { Nombre = Match.Jugar.Jugador2.Nombre, Cartas = Match.Jugar.Jugador2.Mazo };


            Clients.Client(Match.Jugar.Jugador1.ConectionID).dibujarTablero(jugador1, jugador2, Match.Jugar.MazoCompleto);
            Clients.Client(Match.Jugar.Jugador2.ConectionID).dibujarTablero(jugador1, jugador2, Match.Jugar.MazoCompleto);
        }
예제 #14
0
        public void AddPartidaDebit(Account debitAccount, decimal amount)
        {
            var partida = new Partida()
            {
                Account     = debitAccount,
                PartidaType = PartidaType.Debit,
                Amount      = amount,
            };

            Partidas.Add(partida);
        }
예제 #15
0
        public void AddPartidaCredit(Account creditAccount, decimal amount)
        {
            var partida = new Partida()
            {
                Account     = creditAccount,
                PartidaType = PartidaType.Credit,
                Amount      = amount,
            };

            Partidas.Add(partida);
        }
예제 #16
0
        public virtual void LoadPartidasByAlbaranProveedor(long oid, bool childs)
        {
            Batchs partidas = Batchs.GetChildListByAlbaranRecibido(this, oid, childs);

            foreach (Batch item in partidas)
            {
                if ((Partidas.GetItem(item.Oid) == null) && (!Partidas.ContainsDeleted(item.Oid)))
                {
                    Partidas.AddItem(item);
                }
            }
        }
예제 #17
0
 public void PartidasGrid(ref Partidas objPartida, ref List <Partidas> List)
 {
     try
     {
         CD_Partidas CD_Partidas = new CD_Partidas();
         CD_Partidas.PartidasGrid(ref objPartida, ref List);
     }
     catch (Exception ex)
     {
         throw new Exception(ex.Message);
     }
 }
예제 #18
0
 public bool Balances()
 {
     if (!Partidas.Any())
     {
         return(true);
     }
     else
     {
         return(Partidas.Where(partida => partida.PartidaType == PartidaType.Credit).Sum(partida => partida.Amount) ==
                Partidas.Where(partida => partida.PartidaType == PartidaType.Debit).Sum(partida => partida.Amount));
     }
 }
예제 #19
0
 public void EliminarPartida(Partidas objPartida, ref string Verificador)
 {
     try
     {
         CD_Partidas CD_Partidas = new CD_Partidas();
         CD_Partidas.EliminarPartida(objPartida, ref Verificador);
     }
     catch (Exception ex)
     {
         throw new Exception(ex.Message);
     }
 }
예제 #20
0
 public void ObtenerDatosPartida(ref Partidas objPartida, ref string Verificador)
 {
     try
     {
         CD_Partidas CD_Partidas = new CD_Partidas();
         CD_Partidas.ObtenerDatosPartida(ref objPartida, ref Verificador);
     }
     catch (Exception ex)
     {
         throw new Exception(ex.Message);
     }
 }
예제 #21
0
        public virtual void LoadPartidasByExpediente(long oid, bool childs)
        {
            Batchs partidas = Batchs.GetChildListByExpediente(this, oid, childs);

            foreach (Batch item in partidas)
            {
                if ((Partidas.GetItem(item.Oid) == null) && (!Partidas.ContainsDeleted(item.Oid)))
                {
                    Partidas.AddItem(item);
                }
            }
        }
예제 #22
0
        public void CarregarLista()
        {
            var lista = _servico.listar();

            if (lista != null)
            {
                foreach (var itens in lista)
                {
                    Partidas.Add(itens);
                }
            }
        }
예제 #23
0
        public virtual void LoadStockByPartida(long oid, bool childs, bool throwStockException)
        {
            if (_stocks.GetItemByBatch(oid) == null)
            {
                Stocks stocks = Stocks.GetChildListByPartida(this, oid, childs);

                foreach (Stock item in stocks)
                {
                    _stocks.AddItem(item);
                }

                _stocks.UpdateStocks(Partidas.GetItem(oid), throwStockException);
            }
        }
예제 #24
0
        public virtual void UpdateGastosPartidas()
        {
            InputDeliveryLineList conceptos = InputDeliveryLineList.GetByExpedienteStockList(Oid, false, true);

            if (Ayuda)
            {
                if (_expedientes_rea == null)
                {
                    LoadChilds(typeof(REAExpedient), true, false);
                }
            }

            KilosTotal = 0;

            foreach (BatchInfo item in Partidas)
            {
                if (item.OidExpediente != Oid)
                {
                    continue;
                }
                KilosTotal += item.KilosIniciales;
            }

            decimal ayudas     = 0;
            decimal kilos      = 0;
            decimal ayuda_kilo = 0;

            foreach (BatchInfo item in Partidas)
            {
                if (item.OidExpediente != Oid)
                {
                    continue;
                }

                if (Ayuda)
                {
                    ayudas     = ExpedientesREA.GetTotalAyudas(item.CodigoAduanero);
                    kilos      = Partidas.GetTotalKilos(item.CodigoAduanero);
                    ayuda_kilo = ayudas / kilos;
                }
                else
                {
                    ayuda_kilo = 0;
                }

                item.CalculaCostes(GastoPorKilo, ayuda_kilo);
            }
        }
예제 #25
0
        public Partida CrearNuevaPartida(string jugadorunonombre, string jugadorunoconexion, string nombrepartida, string nombremazo)
        {
            var mazoseleccionado = this.Mazos.SingleOrDefault(x => x.Nombre == nombremazo);
            var NuevoJugador     = new Jugador()
            {
                Nombre = jugadorunonombre, ConecctionID = jugadorunoconexion
            };
            Partida partida = new Partida(mazoseleccionado, NuevoJugador)
            {
                Nombre = nombrepartida
            };

            partida.JugadorUno = NuevoJugador;
            Partidas.Add(partida);
            return(partida);
        }
예제 #26
0
        public virtual void UpdateTotalesProductos(bool estimated = true)
        {
            if (Partidas == null)
            {
                return;
            }

            _base.AyudaEstimada        = 0;
            _base.CosteTotalCalculado  = 0;
            _base.KilosTotal           = Partidas.Sum(x => x.KilosIniciales);
            _base.BultosTotal          = Partidas.Sum(x => x.BultosIniciales);
            _base.AyudaEstimada        = Partidas.Where(x => x.Ayuda == true).Sum(x => x.AyudaKilo * x.KilosIniciales);
            _base.CosteTotalCalculado += Partidas.Sum(x => x.PrecioCompraKilo * x.KilosIniciales);

            UpdateGastos(estimated);
        }
예제 #27
0
        private void Clube_OpenReadCompleted(object sender, OpenReadCompletedEventArgs e)
        {
            Partidas     res         = JsonConvert.DeserializeObject <Partidas>(new StreamReader(e.Result).ReadToEnd());
            List <Clube> listaClubes = new List <Clube>();

            foreach (var clubeHash in res.clubes)
            {
                Clube clube = new Clube();
                clube.Nome    = clubeHash.Value.Nome;
                clube.Posicao = clubeHash.Value.Posicao;
                clube.Escudos = clubeHash.Value.Escudos;


                listaClubes.Add(clube);
            }

            AtualizaListaClubes(listaClubes.OrderBy(c => c.Posicao));
        }
예제 #28
0
        public void TestlistaPartidos()
        {
            Assert.AreEqual <int>(0, listaJugadors.Count);

            for (int i = 0; i < listaJugadors.Count; i++)
            {
                for (int j = i + 1; j < listaJugadors.Count; j++)
                {
                    Partidas par = new Partidas();
                    par.NomJugador1      = listaJugadors[i].Nom;
                    par.ApellidoJugador1 = listaJugadors[i].Apellido;
                    par.NomJugador2      = listaJugadors[j].Nom;
                    par.ApellidoJugador2 = listaJugadors[j].Apellido;
                    listaPartidas.Add(par);
                }
            }

            Assert.IsNotNull(listaPartidas);
        }
예제 #29
0
        public void CompararCartas()
        {
            var p1 = new Jugador()
            {
                Nombre = "juan", ConectionID = "12345142"
            };
            var p2 = new Jugador()
            {
                Nombre = "marcos", ConectionID = "12345123"
            };


            var juego = new Partidas()
            {
                Activa = true, Nombre = "nueva partida", Usuario = p1.Nombre, Mazo = "Armas de videojuegos"
            };

            juego.Preparar();
            juego.Jugar.Jugador1 = p1;
            juego.Jugar.Jugador2 = p2;

            juego.Comenzar();

            var carta  = p1.Mazo[0];
            var carta2 = p2.Mazo[0];

            Jugador ganoManoEsperado = null;
            var     attr             = carta.Atributos[0].Propiedad;

            if (carta.Atributos[0].Valor >= carta.Atributos[1].Valor)
            {
                ganoManoEsperado = p1;
            }
            else
            {
                ganoManoEsperado = p2;
            }

            var ganoManoObtenido = juego.Jugar.CompararCartas(attr);

            Assert.AreEqual(ganoManoEsperado, ganoManoObtenido);
        }
예제 #30
0
 protected void DDLClave_SelectedIndexChanged(object sender, EventArgs e)
 {
     try
     {
         Partidas objPartidas = new Partidas();
         objPartidas.Ejercicio = SesionUsu.Usu_Ejercicio;
         List <Partidas> list = new List <Partidas>();
         objPartidas.SubCapt = DDLClave.SelectedValue.Substring(0, 2);
         CN_Partida.PartidasGrid(ref objPartidas, ref list);
         //SqlDataAdapter sda = new SqlDataAdapter(cmd);
         //DataSet ds = new DataSet();
         //sda.Fill(ds);//
         GRDPartidas.DataSource = list;
         GRDPartidas.DataBind();
     }
     catch (Exception ex)
     {
         ScriptManager.RegisterStartupScript(this.Page, Page.GetType(), "modal", "mostrar_modal(0, '" + ex.Message + ".')", true);
     }
 }