public DataTable GetAllTours()
        {
            DataSet ds = new DataSet();

            Bd_Interface.ReturnAdapter($"SELECT * FROM Tours").Fill(ds, "Tours");

            return(ds.Tables["Tours"]);
        }
        bool IsWrongLog()
        {
            string query = $"Select * from Accounts Where Login = '******'";

            DataTable DTable = new DataTable();

            Bd_Interface.ReturnAdapter(query).Fill(DTable);

            if (DTable.Rows.Count == 0)
            {
                return(false);
            }

            return(true);
        }
Exemple #3
0
        private int CheckLogPass(ref bool IsAdmin)
        {
            string Pass  = Program.GetHash(PassTB.Text);
            string query = $"Select * from Accounts Where Login = '******' and Pass = '******'";

            DataTable DTable = new DataTable();

            Bd_Interface.ReturnAdapter(query).Fill(DTable);

            if (DTable.Rows.Count == 1)
            {
                IsAdmin = (bool)DTable.Rows[0].ItemArray[3];
                return((int)DTable.Rows[0].ItemArray[0]);
            }

            return(0);
        }
        void CreateNewAccount()
        {
            if (PassTB.Text != RepeatPassTB.Text)
            {
                WrongPass();
                return;
            }

            if (IsWrongLog())
            {
                WrongLog();
                return;
            }

            string Pass = Program.GetHash(PassTB.Text);

            Bd_Interface.MakeQuery($"Insert INTO Accounts(Login,Pass,Adm,Date,Deleted) VALUES ('{LogTB.Text}','{Pass}',0,CURRENT_TIMESTAMP, 0)");

            CorrectLogPass();
        }