Exemple #1
0
        static public List <Lib.User> SearchNewContact(string findString)
        {
            bool          emailAdress = false;
            StringBuilder query;

            if (new EmailAddressAttribute().IsValid(findString))
            {
                emailAdress = true;
            }
            if (emailAdress)
            {
                query = new StringBuilder("exec SearchByEmail  '" + findString + "'");
            }
            else
            {
                query = new StringBuilder("exec SearchNewContact '" + findString + "'");
            }
            Thread      DatabaseThread = new Thread(new ParameterizedThreadStart(UsersInfo));
            QueryStatus qs             = new QueryStatus(query.ToString());

            DatabaseThread.Start(qs);
            while (qs.status == Status.Loading)
            {
                //loading
                continue;
            }
            if (query.Length > 0)
            {
                return(qs.container as List <Lib.User>);
            }
            else
            {
                return(null);
            }
        }
Exemple #2
0
        static public void LogOut()
        {
            Thread        DatabaseThread = new Thread(new ParameterizedThreadStart(DBWork));
            StringBuilder query          = new StringBuilder("exec LogOut  '" + user.email);
            QueryStatus   qs             = new QueryStatus(query.ToString());

            DatabaseThread.Start(qs);
        }
Exemple #3
0
        /// <summary>
        /// Добавлення текстового повідомлення до БД
        /// </summary>
        /// <param name="text">текст повідомлення</param>
        /// <param name="time">час</param>
        static public void AddMessageText(string text, DateTime time)
        {
            Thread        DatabaseThread = new Thread(new ParameterizedThreadStart(DBWork));
            StringBuilder query          = new StringBuilder("exec AddingMessage  '" + user.username + "', '" +
                                                             reciever.username + "', '" + text + "', '" + time + "'");
            QueryStatus qs = new QueryStatus(query.ToString());

            DatabaseThread.Start(qs);
        }
Exemple #4
0
        static public void DeleteProfile()
        {
            Thread        DatabaseThread = new Thread(new ParameterizedThreadStart(DBWork));
            StringBuilder query          = new StringBuilder("exec DeleteProfile  '" + user.email);
            QueryStatus   qs             = new QueryStatus(query.ToString());

            DatabaseThread.Start(qs);

            /*while (qs.status == Status.Loading)
             *  //loading
             *  continue;*/
        }
Exemple #5
0
        /// <summary>
        /// отрмання імені користувача по емейлу
        /// </summary>
        /// <param name="email"></param>
        /// <returns></returns>
        static public string NamePicker(string email)
        {
            StringBuilder query          = new StringBuilder("select dbo.ReturnName('" + email + "')");
            Thread        DatabaseThread = new Thread(new ParameterizedThreadStart(ReturnMethods));
            QueryStatus   qs             = new QueryStatus(query.ToString());

            DatabaseThread.Start(qs);
            while (qs.status == Status.Loading)
            {
                //loading
                continue;
            }
            return(Convert.ToString(qs.container.ToString()));
        }
Exemple #6
0
        /// <summary>
        /// зміна паролю
        /// </summary>
        /// <param name="username">користувач</param>
        /// <param name="email">емейл</param>
        /// <param name="newPassword">новий пароль</param>
        static public bool ResetPassword(string username, string email, string newPassword)
        {
            StringBuilder query = new StringBuilder("exec ToResetPassword '" + username + "', '" +
                                                    email + "', '" + newPassword + "'");
            Thread      DatabaseThread = new Thread(new ParameterizedThreadStart(DBWork));
            QueryStatus qs             = new QueryStatus(query.ToString());

            DatabaseThread.Start(qs);
            while (qs.status == Status.Loading)
            {
                //loading bar
                continue;
            }
            return(qs.BoolStatus());
        }
Exemple #7
0
        /// <summary>
        /// Створпення нового користувача
        /// </summary>
        /// <param name="userName">ім'я</param>
        /// <param name="password">пароль</param>
        /// <param name="email">емейл</param>
        /// <param name="birthDay">дата народження</param>
        /// <returns></returns>
        static public bool NewUser(string userName, string password, string email, DateTime birthDay)
        {
            Thread        DatabaseThread = new Thread(new ParameterizedThreadStart(DBWork));
            StringBuilder query          = new StringBuilder("exec AddUser '" + userName + "', '" +
                                                             password + "', '" + email + "', '" + birthDay + "'");
            QueryStatus qs = new QueryStatus(query.ToString());

            DatabaseThread.Start(qs);
            while (qs.status == Status.Loading)
            {
                //loading
                continue;
            }
            return(qs.BoolStatus());
        }
Exemple #8
0
        /// <summary>
        /// Вхід в систему
        /// </summary>
        /// <param name="email">email</param>
        /// <param name="password">пароль</param>
        /// <returns></returns>
        static public bool SignIn(string email, string password)
        {
            Thread        DatabaseThread = new Thread(new ParameterizedThreadStart(DBWork));
            StringBuilder query          = new StringBuilder("exec SignIn '" + email + "', '" +
                                                             password + "'");
            QueryStatus qs = new QueryStatus(query.ToString());

            DatabaseThread.Start(qs);
            while (qs.status == Status.Loading)
            {
                //loading
                continue;
            }
            return(qs.BoolStatus());
        }
Exemple #9
0
        /// <summary>
        /// пошук по емейлі
        /// </summary>
        /// <param name="email">емейл</param>
        static public List <Lib.User> SearchByEmail(string email)
        {
            StringBuilder query          = new StringBuilder("exec SearchByEmail  '" + email + "'");
            Thread        DatabaseThread = new Thread(new ParameterizedThreadStart(UsersInfo));
            QueryStatus   qs             = new QueryStatus(query.ToString());

            DatabaseThread.Start(qs);
            while (qs.status == Status.Loading)
            {
                //loading
                continue;
            }
            if (query.Length > 0)
            {
                return(qs.container as List <Lib.User>);
            }
            else
            {
                return(null);
            }
        }
Exemple #10
0
        /// <summary>
        /// Отримуємо дату народження
        /// </summary>
        static public DateTime BirthDatePicker(int id)
        {
            StringBuilder query          = new StringBuilder("select dbo.ReturnBirthDay(" + id + ")");
            Thread        DatabaseThread = new Thread(new ParameterizedThreadStart(ReturnMethods));
            QueryStatus   qs             = new QueryStatus(query.ToString());

            DatabaseThread.Start(qs);
            while (qs.status == Status.Loading)
            {
                //loading
                continue;
            }
            if (qs.container != null)
            {
                return(Convert.ToDateTime(qs.container));
            }
            else
            {
                return(DateTime.Now);
            }
        }
Exemple #11
0
        /// <summary>
        /// Отримання id користувача
        /// </summary>
        /// <param name="email">пошта</param>
        /// <returns></returns>
        static public int IdPicker(string email)
        {
            StringBuilder query          = new StringBuilder("select dbo.ID('" + email + "')");
            Thread        DatabaseThread = new Thread(new ParameterizedThreadStart(ReturnMethods));
            QueryStatus   qs             = new QueryStatus(query.ToString());

            DatabaseThread.Start(qs);
            while (qs.status == Status.Loading)
            {
                //loading
                continue;
            }
            if (qs.container != null)
            {
                return(Convert.ToInt32(qs.container));
            }
            else
            {
                return(-1);
            }
        }