Exemple #1
0
    public string DeleteUser(string userId, string ctrl)
    {
        string crlHash = Generic.GetHash(Generic.GetWebConfigValue("WebServiceKey"));

        if (ctrl != crlHash) return string.Empty;

        db_config_users dcu = null;

        try
        {
            // first validation to garanty that user is graiter then zero
            int auxUserId = Convert.ToInt32(userId);
            if (auxUserId < 0) return "User ID is less then zero";

            dcu = new db_config_users(auxUserId);
            dcu.Open();

            if (dcu.AllUsers.Count == 0) return "User not available";

            dcu.DeleteUser();
        }
        catch (Exception ex)
        {
            return ex.Message;
        }
        finally
        {
            if (dcu != null) dcu.Close();
        }

        return "Operation Done";
    }