Пример #1
0
        public static DataBase GetInstance()
        {
            if (instance == null)
                instance = new DataBase();

            return instance;
        }
 public static DataTable GetLotteryUser(string sPhoneNumber)
 {
     DataBase dataBase = new DataBase();
     string sql = "select * from Players where CellPhoneNo = @CellPhoneNo";
     SqlParameter[] sqlparameter = new SqlParameter[1];
     sqlparameter[0] = new SqlParameter("@CellPhoneNo", sPhoneNumber);
     return dataBase.ExcuteSqlReturnDataTable(sql, sqlparameter);
 }
 public static DataTable GetUserDownloadInfo(string sPhoneNumber)
 {
     DataBase dataBase = new DataBase();
     string sql = "select * from DownloadHistory where CellPhoneNo = @CellPhoneNo";
     SqlParameter[] sqlparameter = new SqlParameter[1];
     sqlparameter[0] = new SqlParameter("@CellPhoneNo", sPhoneNumber);
     return dataBase.ExcuteSqlReturnDataTable(sql, sqlparameter);
 }
 public static void DownloadGame2(string sPhoneNumber)
 {
     DataBase dataBase = new DataBase();
     string sql = "exec spDownloadGame2 @CellPhoneNo = @CellPhone";
     SqlParameter[] sqlparameter = new SqlParameter[1];
     sqlparameter[0] = new SqlParameter("@CellPhone", sPhoneNumber);
     dataBase.ExcuteSqlReturnInt(sql, sqlparameter);
 }
Пример #5
0
        public void DataAccessUpdateTest()
        {
            var data     = new DataAccess.DataBase(Path.Combine(Path.GetTempPath(), Guid.NewGuid().ToString()));
            var storedId = data.StoreFile("www.sample.com", "file.txt", @"//Storage/file1.txt", 100, string.Empty, string.Empty, DateTime.Now);
            var file     = data.GetFullFile(storedId);

            file.Should().NotBeNull();
            file.Should().BeOfType <FullFile>();
        }
 public static DataTable GetLotteryHistory(string sPhoneNumber)
 {
     DataBase dataBase = new DataBase();
     string sql = "select a.cellphoneno,a.lotterytime,b.awardname,a.cardcode from LotteryHistory a join Awards b on a.AwardId = b.AwardId";
     if (!string.IsNullOrWhiteSpace(sPhoneNumber))
     {
         sql += "where CellPhoneNo = " + sPhoneNumber;
     }
     return dataBase.ExcuteSqlReturnDataTable(sql);
 }
Пример #7
0
        public void DataAccessStoreAndGetTest()
        {
            var data = new DataAccess.DataBase(Path.Combine(Path.GetTempPath(), Guid.NewGuid().ToString()));

            data.StoreFile("www.sample.com", "file.txt", @"//Storage/file1.txt", 100, string.Empty, string.Empty, DateTime.Now);
            data.StoreFile("www.sample.com", "file2.txt", @"//Storage/file2.txt", 100, string.Empty, string.Empty, DateTime.Now);
            var files = data.GetFiles(0, 1).ToArray();

            files.Should().NotBeNull();
            files.Count().Should().Be(1);
            var file = files.First();

            file.Should().NotBeNull();
            file.Should().BeOfType <FullFile>();
            file.Name.Should().Be("file.txt");
        }
Пример #8
0
        public Administrador GetNameAdmin(string rut_admin, string pass_admin)
        {
            DataAccess.DataBase bd = new DataAccess.DataBase();
            bd.connect();
            string sql = "SELECT NOM_ADMIN FROM ADMINISTRADOR WHERE RUT_ADMIN='" + rut_admin + "' AND PASS_ADMIN= '" + pass_admin + "'";

            bd.CreateCommand(sql);
            Administrador llocal = new Administrador();
            Administrador a      = null;
            DbDataReader  result = bd.Query();

            result.Read();
            a = new Administrador(result.GetString(0));
            result.Close();
            bd.Close();
            return(a);
        }
Пример #9
0
        public Restaurant ReturnNombre(string email_rest, string pass_rest)
        {
            DataAccess.DataBase bd = new DataAccess.DataBase();
            bd.connect();
            string sql = "SELECT NOMBRE_REST FROM RESTAURANT WHERE EMAIL_REST='" + email_rest + "' AND PASS_REST= '" + pass_rest + "'";

            bd.CreateCommand(sql);
            Restaurant   llocal = new Restaurant();
            Restaurant   a      = null;
            DbDataReader result = bd.Query();

            result.Read();
            a = new Restaurant(result.GetString(0));
            result.Close();
            bd.Close();
            return(a);
        }
Пример #10
0
        public bool LoginAdmin(string rut_admin, string pass_admin)
        {
            bool ok = false;

            DataAccess.DataBase bd = new DataAccess.DataBase();
            bd.connect();
            string sql = "SELECT * FROM ADMINISTRADOR WHERE RUT_ADMIN='" + rut_admin + "' AND PASS_ADMIN= '" + pass_admin + "'";

            bd.CreateCommand(sql);
            DbDataReader result = bd.Query();

            if (result.Read())
            {
                ok = true;
            }
            //Administrador c = new Administrador(result.GetString(0), result.GetString(1));
            result.Close();
            bd.Close();
            return(ok);
        }
Пример #11
0
        public bool LoginUsuario(string rut_usuario, string pass_usuario)
        {
            bool ok = false;

            DataAccess.DataBase bd = new DataAccess.DataBase();
            bd.connect();
            string sql = "SELECT * FROM USUARIO WHERE RUT_USUARIO='" + rut_usuario + "' AND PASS_USUARIO= '" + pass_usuario + "'";

            bd.CreateCommand(sql);
            DbDataReader result = bd.Query();

            if (result.Read())
            {
                ok = true;
            }
            //Administrador c = new Administrador(result.GetString(0), result.GetString(1));
            result.Close();
            bd.Close();
            return(ok);
        }
Пример #12
0
        public List <Restaurant> getCodeRest()
        {
            DataAccess.DataBase bd = new DataAccess.DataBase();
            bd.connect(); //método conectar

            List <Restaurant> rest = new List <Restaurant>();
            string            sql  = "SELECT COD_REST,NOMBRE_REST FROM RESTAURANT";

            bd.CreateCommand(sql);
            DbDataReader readed = bd.Query();//resultado de la consulta

            while (readed.Read())
            {
                Restaurant r = new Restaurant(readed.GetInt32(0), readed.GetString(1));
                rest.Add(r);
            }
            readed.Close();
            bd.Close();
            return(rest);
        }
Пример #13
0
        public bool LoginRest(string email_rest, string pass_rest)
        {
            bool ok = false;

            DataAccess.DataBase bd = new DataAccess.DataBase();
            bd.connect();
            string sql = "SELECT * FROM RESTAURANT WHERE EMAIL_REST='" + email_rest + "' AND PASS_REST= '" + pass_rest + "'";

            bd.CreateCommand(sql);
            DbDataReader result = bd.Query();

            if (result.Read())
            {
                ok = true;
            }
            //Administrador c = new Administrador(result.GetString(0), result.GetString(1));
            result.Close();
            bd.Close();
            return(ok);
        }
 public EstadisticaDAO()
 {
     db = DataBase.GetInstance();
 }
Пример #15
0
 public ClienteDAO()
 {
     db = DataBase.GetInstance();
 }
Пример #16
0
 public ProductoDAO()
 {
     db = DataBase.GetInstance();
 }
Пример #17
0
 public ViajeDAO()
 {
     db = DataBase.GetInstance();
 }
 public static void StoreLotteryUser(string sPhoneNumber)
 {
     DataBase dataBase = new DataBase();
     string sql = "exec spNewPlayer @CellPhoneNo = @CellPhone";
     SqlParameter[] sqlparameter = new SqlParameter[1];
     sqlparameter[0] = new SqlParameter("@CellPhone", sPhoneNumber);
     dataBase.ExcuteSqlReturnInt(sql, sqlparameter);
 }
 public static DataTable ReduceCountAndSaveHistory(string sPhoneNumber, string sAwardId)
 {
     DataBase dataBase = new DataBase();
     string sql = "exec spLotteryProcess @CellPhoneNo = @CellPhone , @AwardID = @Award ";
     SqlParameter[] sqlparameter = new SqlParameter[2];
     sqlparameter[0] = new SqlParameter("@CellPhone", sPhoneNumber);
     sqlparameter[1] = new SqlParameter("@Award", sAwardId);
     return dataBase.ExcuteSqlReturnDataTableTransaction(sql, sqlparameter);
 }
Пример #20
0
 public MillaDAO()
 {
     db = DataBase.GetInstance();
 }
Пример #21
0
 public AeronaveDAO()
 {
     db = DataBase.GetInstance();
 }
 public FabricanteDAO()
 {
     db = DataBase.GetInstance();
 }
 public static DataTable GetLotteryAllUser()
 {
     DataBase dataBase = new DataBase();
     string sql = "select * from Players ";
     return dataBase.ExcuteSqlReturnDataTable(sql);
 }
Пример #24
0
 public ServicioDAO()
 {
     db = DataBase.GetInstance();
 }
 public static bool UpdateAward(string sAwardId,string sAwardName, string sRate, string sTotalCount, string sSurplusCount)
 {
     DataBase dataBase = new DataBase();
     string sql = "update Awards set AwardName = @AwardName ,Rate = @Rate, TotalCount = @TotalCount,SurplusCount = @SurplusCount where AwardId = @AwardId ";
     SqlParameter[] sqlparameter = new SqlParameter[5];
     sqlparameter[0] = new SqlParameter("@AwardName", sAwardName);
     sqlparameter[1] = new SqlParameter("@Rate", sRate);
     sqlparameter[2] = new SqlParameter("@TotalCount", sTotalCount);
     sqlparameter[3] = new SqlParameter("@SurplusCount", sSurplusCount);
     sqlparameter[4] = new SqlParameter("@AwardId", sAwardId);
     return dataBase.ExcuteSqlReturnInt(sql, sqlparameter) > 0;
 }
Пример #26
0
 public ButacaDAO()
 {
     db = DataBase.GetInstance();
 }
 public static DataTable GetAllLotteryAwards()
 {
     DataBase dataBase = new DataBase();
     string sql = "select * from Awards";
     return dataBase.ExcuteSqlReturnDataTable(sql);
 }
 public static DataTable GetGame2DownTime()
 {
     DataBase dataBase = new DataBase();
     string sql = "select * from DownloadHistory where Game2 = 1";
     return dataBase.ExcuteSqlReturnDataTable(sql);
 }
Пример #29
0
 public RolDAO()
 {
     db = DataBase.GetInstance();
 }
Пример #30
0
 public CiudadDAO()
 {
     db = DataBase.GetInstance();
 }