コード例 #1
0
ファイル: BussinesModel.cs プロジェクト: faverhofff/validsat
        static public void storeConfigApp(string rfc, string nombre, string correo, string servidor, string password, string cp, string ciec_key, string sat_key, string path_ciec, string path_sat, string rfc_update = "")
        {
            var db = new validsatEntities(connection, true);
            cnf_rfcadministrados row = new cnf_rfcadministrados();

            if (((ExisteRfc(rfc)) != null && rfc_update == "") || ((ExisteRfc(rfc)) != null && rfc_update != "" && rfc != rfc_update))
            {
                throw new RfcExistsException();
            }

            if (rfc_update != "")
            {
                row = db.cnf_rfcadministrados.First(e => e.rfc_rfcempresa == rfc_update);
            }

            row.rfc_nombreempresa       = nombre;
            row.rfc_rfcempresa          = rfc;
            row.rfc_codigopostal        = cp;
            row.rfc_correoelectronico   = correo;
            row.rfc_emailnomservidorent = servidor;
            row.rfc_emailcontrasena     = password;
            row.rfc_llaveempresa        = Global.Instance.userLogin.emp_empresa;
            row.rfc_passwordclaveciec   = ciec_key;
            row.rfc_passwordkeysat      = sat_key;
            row.rfc_pathllavesat        = path_ciec;
            row.rfc_pathcertificadosat  = path_sat;

            if (rfc_update == "")
            {
                db.cnf_rfcadministrados.Add(row);
            }

            db.SaveChanges();
        }
コード例 #2
0
ファイル: BussinesModel.cs プロジェクト: faverhofff/validsat
 static public int countCodigosPostales()
 {
     using (var db = new validsatEntities(connection, true))
     {
         return(db.cnf_codigospostales.Count());
     }
 }
コード例 #3
0
ファイル: BussinesModel.cs プロジェクト: faverhofff/validsat
        static public List <cnf_rfcadministrados> getRfcAdministrados(long empresa, bool nuevo_registro = false)
        {
            try
            {
                using (var db = new validsatEntities(connection, true))
                {
                    List <cnf_rfcadministrados> salida = new List <cnf_rfcadministrados>();

                    if (nuevo_registro)
                    {
                        cnf_rfcadministrados agregar = new cnf_rfcadministrados();
                        agregar.rfc_nombreempresa = "Agregar Empresa";
                        agregar.rfc_rfcempresa    = "";
                        agregar.rfc_codigopostal  = "";
                        salida.Add(agregar);
                    }

                    salida.AddRange(db.cnf_rfcadministrados.Where(e => e.rfc_llaveempresa == empresa).ToList());
                    return(salida);
                }
            }
            catch (DbEntityValidationException e)
            {
                return(null);
            }
        }
コード例 #4
0
ファイル: BussinesModel.cs プロジェクト: faverhofff/validsat
 static public List <cnf_codigospostales> dameCodigosPostales(int skip = 0, int limit = -1)
 {
     using (var db = new validsatEntities(connection, true))
     {
         if (limit >= 0)
         {
             return(db.cnf_codigospostales.Take(limit).ToList());
         }
         else
         {
             return(db.cnf_codigospostales.ToList());
         }
     }
 }
コード例 #5
0
ファイル: BussinesModel.cs プロジェクト: faverhofff/validsat
        static public cnf_rfcadministrados ExisteRfc(string rfc)
        {
            try
            {
                using (var db = new validsatEntities(connection, true))
                {
                    return(db.cnf_rfcadministrados.FirstOrDefault(e => e.rfc_rfcempresa == rfc));
                }
            }
            catch (DbEntityValidationException e)
            {
                return(null);
            }

            return(null);
        }
コード例 #6
0
ファイル: BussinesModel.cs プロジェクト: faverhofff/validsat
        static public bool ExistenRfcAdministrados(long empresa)
        {
            try
            {
                using (var db = new validsatEntities(connection, true))
                {
                    cnf_rfcadministrados rfcadministrados = db.cnf_rfcadministrados.FirstOrDefault(e => e.rfc_llaveempresa == empresa);

                    return(rfcadministrados != null);;
                }
            }
            catch (DbEntityValidationException e)
            {
                return(false);
            }
        }
コード例 #7
0
ファイル: BussinesModel.cs プロジェクト: faverhofff/validsat
        static public void test()
        {
            var db = new validsatEntities(connection, true);

            for (int j = 5204; j <= 1000000; j++)
            {
                cnf_rfcadministrados row = new cnf_rfcadministrados();
                row.rfc_nombreempresa     = RandomString(50);
                row.rfc_rfcempresa        = RandomString(10);
                row.rfc_codigopostal      = RandomString(10);
                row.rfc_correoelectronico = RandomString(15);
                row.rfc_emailcontrasena   = RandomString(10);

                db.cnf_rfcadministrados.Add(row);
                db.SaveChanges();
            }
        }