public static void deleteUser(UserData u)
        {
            // CALL `p_delete_user`(@_user_id);
            try
            {
                using (MySqlConnection conn = new MySqlConnection(App.setting.connectString))
                {
                    conn.Open();
                    string query = "CALL `p_delete_user` (@_user_id);";

                    using (MySqlCommand cmd = new MySqlCommand(query, conn))
                    {
                        cmd.Parameters.AddWithValue("@_user_id", u.ID);
                        cmd.ExecuteNonQuery();
                    };
                    conn.Close();
                };
            }
            catch (MySqlException)
            {

            }
            catch (Exception)
            {

            }
        }
        public static List<UserData> toUsers(this MySqlDataReader reader)
        {
            if (reader.HasRows)
            {
                List<UserData> results = new List<UserData>();
                while (reader.Read())
                {
                    if (!reader.IsDBNull(0))
                    {
                        UserData u = new UserData();
                        u.ID = reader.GetInt32(Define.user_id);
                        u.Full_Name = reader.GetString(Define.user_full_name);
                        u.Permision = Permision.Read(reader.GetString(Define.user_permision));
                        u.Status = reader.GetBoolean(Define.user_status);
                        u.Type = reader.GetInt32(Define.user_type);
                        u.Time = reader.GetDateTime(Define.user_time);
                        u.setDirectpass(reader.GetString(Define.user_pass));
                        try
                        {
                            u.Comment = reader.GetString(Define.user_content);
                        }
                        catch (Exception)
                        {
                        }
                        try
                        {
                            u.Phone = reader.GetString(Define.user_phone);
                        }
                        catch (Exception)
                        {
                        }
                        try
                        {
                            u.Email = reader.GetString(Define.user_email);
                        }
                        catch (Exception)
                        {
                        }
                        u.User_Name = reader.GetString(Define.user_name);
                        results.Add(u);
                    }

                }
                return results;
            }
            return null;
        }
        public static int insertUser(UserData u)
        {
            int result = 0;
            try
            {

                using (MySqlConnection conn = new MySqlConnection(App.setting.connectString))
                {
                    conn.Open();
                    string query = "`p_insert_user`";
                    using (MySqlCommand cmd = new MySqlCommand(query, conn))
                    {
                        cmd.Parameters.Add(new MySqlParameter("@_fullname", MySqlDbType.Text) { Direction = System.Data.ParameterDirection.Input, Value = u.Full_Name });
                        cmd.Parameters.Add(new MySqlParameter("@_user_name", MySqlDbType.VarChar, 100) { Direction = System.Data.ParameterDirection.Input, Value = u.User_Name });
                        cmd.Parameters.Add(new MySqlParameter("@_user_pass", MySqlDbType.VarChar, 100) { Direction = System.Data.ParameterDirection.Input, Value = u.Pass });
                        cmd.Parameters.Add(new MySqlParameter("@_user_type", MySqlDbType.Int32) { Direction = System.Data.ParameterDirection.Input, Value = u.Type });
                        cmd.Parameters.Add(new MySqlParameter("@_user_phone", MySqlDbType.VarChar, 100) { Direction = System.Data.ParameterDirection.Input, Value = u.Phone });
                        cmd.Parameters.Add(new MySqlParameter("@_user_email", MySqlDbType.VarChar, 100) { Direction = System.Data.ParameterDirection.Input, Value = u.Email });
                        cmd.Parameters.Add(new MySqlParameter("@_user_finger_print", MySqlDbType.LongBlob) { Direction = System.Data.ParameterDirection.Input, Value = u.Finger_Print });
                        cmd.Parameters.Add(new MySqlParameter("@_result", MySqlDbType.Int32) { Direction = System.Data.ParameterDirection.Output, Value = 0 });
                        cmd.CommandType = System.Data.CommandType.StoredProcedure;
                        cmd.ExecuteScalar();
                        result = Convert.ToInt32(cmd.Parameters["@_result"].Value);

                    };
                    conn.Close();
                };
            }
            catch (Exception)
            {

            }
            return result;
        }
        public static UserData toUser(this MySqlDataReader reader)
        {
            UserData u = null;
            while (reader.Read())
            {
                if (!reader.IsDBNull(0))
                {
                    u = new UserData();
                    u.ID = reader.GetInt32(Define.user_id);
                    u.Full_Name = reader.GetString(Define.user_full_name);
                    u.Permision = Permision.Read(reader.GetString(Define.user_permision));
                    u.Status = reader.GetBoolean(Define.user_status);
                    u.Type = reader.GetInt32(Define.user_type);
                    u.Time = reader.GetDateTime(Define.user_time);
                    u.User_Name = reader.GetString(Define.user_name);
                    u.setDirectpass(reader.GetString(Define.user_pass));
                    try
                    {
                        u.Comment = reader.GetString(Define.user_content);
                    }
                    catch (Exception)
                    {
                    }
                    try
                    {
                        u.Phone = reader.GetString(Define.user_phone);
                    }
                    catch (Exception)
                    {
                    }

                    try
                    {
                        u.Email = reader.GetString(Define.user_email);
                    }
                    catch (Exception)
                    {
                    }

                    try
                    {
                        u.Finger_Print = new byte[10 * 1024 * 1024];
                        long bytesRead = reader.GetBytes(reader.GetOrdinal(Define.user_finger_print), 0, u.Finger_Print, 0, u.Finger_Print.Length);
                        Console.WriteLine(bytesRead + " bytes downloaded from table to file.");
                    }
                    catch (Exception)
                    {

                    }
                }
            }
            return u;
        }