コード例 #1
0
        public int Activar(ActivacionConvertidor A)
        {
            try
            {
                using (var db = new NtLinkLocalServiceEntities())
                {
                    if (A.Id == 0)
                    {
                        db.ActivacionConvertidor.AddObject(A);
                    }
                    else
                    {
                        db.ActivacionConvertidor.Where(p => p.Id == A.Id).FirstOrDefault();
                        db.ActivacionConvertidor.ApplyCurrentValues(A);
                    }
                    db.SaveChanges();
                    return(1);
                }
            }

            catch (Exception ee)
            {
                Logger.Error(ee);
                if (ee.InnerException != null)
                {
                    Logger.Error(ee.InnerException);
                }
                return(0);
            }
        }
コード例 #2
0
 public ActivacionConvertidor GetActivo(string key, string Mac)
 {
     try
     {
         //rgv
         using (var db = new NtLinkLocalServiceEntities())
         {
             ActivacionConvertidor ac = db.ActivacionConvertidor.Where(p => p.key == key && p.Mac == Mac && p.Activo == true).FirstOrDefault();
             return(ac);
         }
     }
     catch (Exception eee)
     {
         Logger.Error(eee.Message);
         if (eee.InnerException != null)
         {
             Logger.Error(eee.InnerException);
         }
         return(null);
     }
 }
コード例 #3
0
        public string Activar(string Llave, string RFC)
        {
            string LL    = descifrar(Llave);
            var    datos = LL.Split('|');
            string Mac   = datos[0];
            string Key   = datos[1];

            ValidadarActivador V = new ValidadarActivador();
            var A = V.GetActivador(Key);

            if (A == null)
            {
                return("La clave no es valida");
            }
            if (A.Mac != null)
            {
                return("La clave ya no es valida");
            }
            ActivacionConvertidor act = new ActivacionConvertidor();

            act.key             = Key;
            act.Mac             = Mac;
            act.RFC             = RFC;
            act.Activo          = true;
            act.FechaActivacion = DateTime.Now;
            act.FechaAlta       = A.FechaAlta;
            act.Admin           = A.Admin;
            act.Id = A.Id;
            int z = V.Activar(act);

            if (z == 1)
            {
                return("OK");
            }
            else
            {
                return("Error de base");
            }
        }