Exemple #1
0
        /// <summary>
        /// add user to database
        /// </summary>
        /// <param name="UserUserName">username</param>
        /// <param name="UserPassword">password</param>
        /// <param name="UserName">name</param>
        /// <returns>Success status</returns>
        public User AddUser(User user)
        {
            DataSet ReturnedData = SqlConnector.Select("user_username", "[BarberShop].[dbo].[Users]", $"where user_username = '******'");

            if (!DataToObj.IsRecordExist(ReturnedData))
            {
                SqlConnector.Insert("Users", $"'{user.UserUserName.Trim()}','{user.UserPassword.Trim()}','{user.UserName.Trim()}'");
                return(DataToObj.DataToUser(SqlConnector.Select("*", "[BarberShop].[dbo].[Users]", $"where user_username = '******'")));
            }
            return(null);
        }
Exemple #2
0
        public bool IsAppointmentOccupied(DateTime DateTime)
        {
            DataSet ReturnedData = SqlConnector.Select("appointment_id", "Appointments", $"where appointment_time = '{DateTime.ToString()}'");

            return(DataToObj.IsRecordExist(ReturnedData));
        }
Exemple #3
0
        /// <summary>
        /// function to check if wished time is occupied
        /// </summary>
        /// <param name="UADT">UpdateAppointmentDateTime object</param>
        /// <returns>boolean value</returns>
        public bool IsAppointmentOccupied(UpdateAppointmentDateTime UADT)
        {
            DataSet ReturnedData = SqlConnector.Select("appointment_id", "Appointments", $"where '{UADT.NewDateTime}' = appointment_time");

            return(DataToObj.IsRecordExist(ReturnedData));
        }
Exemple #4
0
        /// <summary>
        /// function to check if Appointment its of user
        /// </summary>
        /// <param name="Data">Jobject containt 2 parameters: "UserId":{user_id}, "AppId":{appointment_id}</param>
        /// <returns>boolean value of Success</returns>
        public bool IsAppointmentOfUser(int UID, int AID)
        {
            DataSet ReturnedData = SqlConnector.Select("user_user_id, appointment_id", "Users, Appointments", $"where user_user_id = {UID} and appointment_id = {AID} and appointment_user_id = {UID}");

            return(DataToObj.IsRecordExist(ReturnedData));
        }
Exemple #5
0
        /// <summary>
        /// function to check if a Property Value is already taken
        /// </summary>
        /// <param name="Prop"> field name</param>
        /// <param name="PropValue">fieil value</param>
        /// <returns>is prop exists (true/false)</returns>
        public bool IsPropInUse(string Prop, string PropValue)
        {
            DataSet ReturnedData = SqlConnector.Select($"{Prop}", "[BarberShop].[dbo].[Users]", $"where {Prop} = '{PropValue}'");

            return(DataToObj.IsRecordExist(ReturnedData));
        }