Beispiel #1
0
        public AltasTest()
        {
            var mocu = new Mock <IRepositoryBase <Entrada> >();

            _controller = new HomeController(mocu.Object);
            _claves     = new Claves();
        }
Beispiel #2
0
 public HomeController(IRepositoryBase <Entrada> context)
 {
     _context   = context;
     _rito      = RiotApi.GetInstance(k);
     _claves    = new Claves();
     _staticApi = StaticRiotApi.GetInstance(k);
 }
        public async Task <ActionResult> DeleteConfirmed(int id)
        {
            Claves claves = await db.Claves.FindAsync(id);

            db.Claves.Remove(claves);
            await db.SaveChangesAsync();

            return(RedirectToAction("Index"));
        }
Beispiel #4
0
        private bool ToUpdate(DBKuupEntities db)
        {
            Claves Claves = this.ToTable();

            db.Claves.Attach(Claves);
            db.Entry(Claves).State = EntityState.Modified;
            db.SaveChanges();
            return(true);
        }
        public async Task <ActionResult> Edit([Bind(Include = "IdClave,Clave,Descripcion")] Claves claves)
        {
            if (ModelState.IsValid)
            {
                claves.Clave           = Seguridad.Encrypt(claves.Clave);
                claves.Descripcion     = Seguridad.Encrypt(claves.Descripcion);
                db.Entry(claves).State = EntityState.Modified;
                await db.SaveChangesAsync();

                return(RedirectToAction("Index"));
            }
            return(View(claves));
        }
Beispiel #6
0
        private bool ToInsert(DBKuupEntities db)
        {
            Claves Claves = this.ToTable();

            db.Claves.Add(Claves);
            db.Entry(Claves).State = EntityState.Added;
            db.SaveChanges();
            if ((from q in db.Claves where q.CVE_NUM_CLAVE == Claves.CVE_NUM_CLAVE && q.CVE_NUM_SEC_CLAVE == Claves.CVE_NUM_SEC_CLAVE select q).Count() != 0)
            {
                return(true);
            }
            return(false);
        }
Beispiel #7
0
        public Claves ToTable()
        {
            Claves Tabla = new Claves();

            Tabla.CVE_NUM_CLAVE         = this.NumeroDeClave;
            Tabla.CVE_NUM_SEC_CLAVE     = this.NumeroDeSecuencial;
            Tabla.CVE_NOM_CLAVE         = this.NombreDeClave;
            Tabla.CVE_DESCRIPCION       = this.Descripcion;
            Tabla.CVE_DATO_ADICIONAL_I  = this.AdicionalI;
            Tabla.CVE_DATO_ADICIONAL_II = this.AdicionalII;
            Tabla.CVE_CVE_ESTATUS       = this.CveDeEstatus;
            return(Tabla);
        }
        public async Task <ActionResult> Delete(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            Claves claves = await db.Claves.FindAsync(id);

            if (claves == null)
            {
                return(HttpNotFound());
            }
            return(View(claves));
        }
Beispiel #9
0
        public bool limpiaMitad(string dat)
        {
            bool der = false;

            if (tipo == 'I')
            {
                if (Convert.ToInt32(claves[1]) < Convert.ToInt32(dat))
                {
                    Claves.RemoveAt(2);
                    Claves.RemoveAt(2);
                    Apuntadores.RemoveAt(3);
                    Apuntadores.RemoveAt(3);
                }
                else
                {
                    Claves.RemoveAt(1);
                    Claves.RemoveAt(1);
                    Claves.RemoveAt(1);
                    Apuntadores.RemoveAt(3);
                    Apuntadores.RemoveAt(3);
                    der = true;
                }
            }
            else
            {
                if (Convert.ToInt32(claves[1]) < Convert.ToInt32(dat))
                {
                    Claves.RemoveAt(2);
                    Claves.RemoveAt(2);
                    Apuntadores.RemoveAt(2);
                    Apuntadores.RemoveAt(2);
                }
                else
                {
                    Claves.RemoveAt(1);
                    Claves.RemoveAt(1);
                    Claves.RemoveAt(1);
                    Apuntadores.RemoveAt(1);
                    Apuntadores.RemoveAt(1);
                    Apuntadores.RemoveAt(1);
                    der = true;
                }
            }
            return(der);
        }
Beispiel #10
0
        public Claves[] ReadAppSettings()
        {
            Claves Clave;

            Claves[] ArrayClaves = new Claves[MAX_CLAVES_APP_SETTINGS];
            int      i           = 0;

            foreach (string key in ConfigurationManager.AppSettings.Keys)
            {
                Clave       = new Claves();
                Clave.key   = key;
                Clave.Value = ConfigurationManager.AppSettings[key];

                ArrayClaves[i++] = Clave;
            }

            return(ArrayClaves);
        }
Beispiel #11
0
        public async Task <ActionResult> Edit(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            Claves claves = await db.Claves.FindAsync(id);

            if (claves == null)
            {
                return(HttpNotFound());
            }
            else
            {
                claves.Clave       = Seguridad.Decrypt(claves.Clave);
                claves.Descripcion = Seguridad.Decrypt(claves.Descripcion);
            }
            return(View(claves));
        }
Beispiel #12
0
 public void recorreDatos(bool izq)
 {
     if (tipo == 'I' || tipo == 'R')
     {
         if (izq)
         {
             Claves.RemoveAt(0);
             Claves.RemoveAt(0);
             Apuntadores.RemoveAt(1);
             Apuntadores.RemoveAt(1);
         }
         else
         {
             Claves.RemoveAt(1);
             Claves.RemoveAt(1);
             Claves.RemoveAt(1);
             Apuntadores.RemoveAt(2);
             Apuntadores.RemoveAt(2);
             Apuntadores.RemoveAt(2);
         }
     }
     else
     {
         if (izq)
         {
             Claves.RemoveAt(0);
             Claves.RemoveAt(0);
             Apuntadores.RemoveAt(0);
             Apuntadores.RemoveAt(0);
         }
         else
         {
             Claves.RemoveAt(0);
             Apuntadores.RemoveAt(0);
         }
     }
 }
Beispiel #13
0
 public void borraEntrada(string dat, long pointer)
 {
     Apuntadores.Remove(pointer);
     Claves.Remove(dat);
 }
Beispiel #14
0
        public void insertaDato(string dat, Int64 apun)
        {
            if (tipo == 'H')
            {
                if (claves.Count == 0)
                {
                    claves.Add(dat);
                    Apuntadores.Insert(0, apun);
                    return;
                }

                for (int i = 0; i < Claves.Count; i++)
                {
                    if (longitudCve > 4)
                    {
                        if (claves[i].Replace("\0", "").CompareTo(dat) > 0)
                        {
                            Claves.Insert(i, dat);
                            Apuntadores.Insert(i, apun);
                            break;
                        }
                        else
                        {
                            Claves.Add(dat);
                            Apuntadores.Insert(Apuntadores.Count - 2, apun);
                            break;
                        }
                    }
                    else
                    {
                        if (Convert.ToInt32(claves[i].Replace("\0", "")) > Convert.ToInt32(dat))
                        {
                            Claves.Insert(i, dat);
                            Apuntadores.Insert(i, apun);
                            break;
                        }
                        else
                        {
                            if (i == Claves.Count - 1)
                            {
                                Claves.Add(dat);
                                Apuntadores.Insert(Apuntadores.Count - 1, apun);
                                break;
                            }
                        }
                    }
                }
            }
            else
            {
                for (int i = 0; i < Claves.Count; i++)
                {
                    if (longitudCve > 4)
                    {
                        if (claves[i].Replace("\0", "").CompareTo(dat) > 0)
                        {
                            Claves.Insert(i, dat);
                            Apuntadores.Insert(i + 1, apun);
                            break;
                        }
                    }
                    else
                    {
                        if (Convert.ToInt32(claves[i].Replace("\0", "")) > Convert.ToInt32(dat))
                        {
                            Claves.Insert(i, dat);
                            Apuntadores.Insert(i + 1, apun);
                            break;
                        }
                        if (i == Claves.Count - 1)
                        {
                            Claves.Add(dat);
                            Apuntadores.Add(apun);
                            break;
                        }
                    }
                }
            }
        }
        public List <string> generarClaves(int p, int q)
        {
            Claves clave = new Claves();

            return(clave.generar(p, q));
        }