Esempio n. 1
0
    public string DeleteUserPage(string userId, string pageId, string ctrl)
    {
        string crlHash = Generic.GetHash(Generic.GetWebConfigValue("WebServiceKey"));

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

        db_config_users dcu = null;

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

            // first validation to guarantee that page is greater than zero
            int auxPageId = Convert.ToInt32(pageId);
            if (auxPageId < 0) return "Page ID is less then zero";

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

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

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

        return "Operation Done";
    }