Ejemplo n.º 1
0
        public string ICredentials(string Username, string Password)
        {
            string dbpwd      = null;
            string dbusername = null;
            string Responce   = "";

            databaseHelper = new DAL.DAL.DatabaseHelper();
            DbDataReader drReader = databaseHelper.ExecuteReader("SELECT * FROM IRegistration WHERE Username='******'", CommandType.Text);

            if (drReader.HasRows)
            {
                if (drReader.Read())
                {
                    dbpwd      = drReader.IsDBNull(drReader.GetOrdinal("Password")) ? string.Empty : drReader.GetString(drReader.GetOrdinal("Password"));
                    dbusername = drReader.IsDBNull(drReader.GetOrdinal("Username")) ? string.Empty : drReader.GetString(drReader.GetOrdinal("Username"));
                }
            }
            if (Username != null && Password != null)
            {
                if (Username == dbusername && Password == dbpwd)
                {
                    return("Success");
                }
            }
            return("Fail");
        }
Ejemplo n.º 2
0
        public int SaveCredentials(string Username, string Password, string Email)
        {
            int Responce = 10;

            databaseHelper = new DAL.DAL.DatabaseHelper();
            string       dbpwd    = null;
            DbDataReader drReader = databaseHelper.ExecuteReader("SELECT * FROM Registration WHERE Username='******'", CommandType.Text);

            if (drReader.HasRows)
            {
                if (drReader.Read())
                {
                    dbpwd = drReader.IsDBNull(drReader.GetOrdinal("Password")) ? string.Empty : drReader.GetString(drReader.GetOrdinal("Password"));
                }
            }
            if (dbpwd != Username)
            {
                int i = databaseHelper.ExecuteNonQuery("insert into Registration(Username,Password,Email) values ('" + Username + "','" + Password + "','" + Email + "')", CommandType.Text);
                Responce = i;
                return(Responce);
            }
            else
            {
                return(0);
            }
        }
        public int SaveCredentials(string Username, string Password, string Email)
        {
            int Responce = 10;

            databaseHelper = new DAL.DAL.DatabaseHelper();
            int i = databaseHelper.ExecuteNonQuery("insert into Registration(Username,Password,Email) values ('" + Username + "','" + Password + "','" + Email + "')", CommandType.Text);

            Responce = i;
            return(Responce);
        }
        public int BALPayments(int Year, string Cardnumber, int CVV, double TotalCost, string OrderNumber)
        {
            int Responce = 10;

            databaseHelper = new DAL.DAL.DatabaseHelper();
            int i = databaseHelper.ExecuteNonQuery("insert into PaymentDetails(TotalCost,Year,CardNumber,CVV,OrderNumber) values ('" + TotalCost + "','" + Year + "','" + Cardnumber + "','" + CVV + "','" + OrderNumber + "')", CommandType.Text);

            Responce = i;
            return(Responce);
        }
        public int BALPayments(int Year, string Cardnumber, int CVV, double TotalCost, string OrderNumber)
        {
            int      Responce = 10;
            DateTime dateTime = new DateTime();

            databaseHelper = new DAL.DAL.DatabaseHelper();
            int i = databaseHelper.ExecuteNonQuery("insert into Payments(TotalCost,Year,CardNumber,CVV,OrderNumber,DateTime) values ('" + TotalCost + "','" + Year + "','" + Cardnumber + "','" + CVV + "','" + OrderNumber + "','" + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + "')", CommandType.Text);

            Responce = i;
            return(Responce);
        }
Ejemplo n.º 6
0
        public string GetFoodDetails()
        {
            string response = "";

            try
            {
                using (DAL.DAL.DatabaseHelper dbHelper = new DAL.DAL.DatabaseHelper())
                {
                    using (DataSet ds = dbHelper.ExecuteDataSet("SELECT * FROM Food_Items", CommandType.Text))
                    {
                        response = JsonConvert.SerializeObject(ds, Newtonsoft.Json.Formatting.Indented);
                    }
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }


            return(response);
        }